You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2019/06/20 15:48:44 UTC

[kudu] 01/03: KUDU-2869. Fix compiler error with devtoolset-7 (gcc 7)

This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch branch-1.10.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 556c72043cbab59174b009f4f4cf3bb9aa8d7e85
Author: Todd Lipcon <to...@apache.org>
AuthorDate: Wed Jun 19 00:09:58 2019 -0700

    KUDU-2869. Fix compiler error with devtoolset-7 (gcc 7)
    
    For whatever reason, some particular C++ syntax used in port.h caused
    gcc 7 to crash with an internal error during compilation. This just
    rephrases the code in a different way to avoid the issue.
    
    Change-Id: Id95a4be07ff1e5ef60a95c65f5a850020f80a273
    Reviewed-on: http://gerrit.cloudera.org:8080/13677
    Tested-by: Grant Henke <gr...@apache.org>
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
---
 src/kudu/gutil/port.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/kudu/gutil/port.h b/src/kudu/gutil/port.h
index 0cf416e..f0b06d7 100644
--- a/src/kudu/gutil/port.h
+++ b/src/kudu/gutil/port.h
@@ -1192,10 +1192,9 @@ using enable_if_numeric = std::enable_if<
 //   int32_t x = UnalignedLoad<int32_t>(void_ptr);
 //
 template<typename T,
-         typename port_internal::enable_if_numeric<T>::type* = nullptr,
-         bool USE_REINTERPRET = port_internal::LoadByReinterpretCast<T>()>
+         typename port_internal::enable_if_numeric<T>::type* = nullptr>
 inline T UnalignedLoad(const void* src) {
-  if (USE_REINTERPRET) {
+  if (port_internal::LoadByReinterpretCast<T>()) {
     return *reinterpret_cast<const T*>(src);
   }
   T ret;
@@ -1213,10 +1212,9 @@ inline T UnalignedLoad(const void* src) {
 // NOTE: this reverses the usual style-guide-suggested order of arguments
 // to match the more natural "*p = v;" ordering of a normal store.
 template<typename T,
-         typename port_internal::enable_if_numeric<T>::type* = nullptr,
-         bool USE_REINTERPRET = port_internal::LoadByReinterpretCast<T>()>
+         typename port_internal::enable_if_numeric<T>::type* = nullptr>
 inline void UnalignedStore(void* dst, const T& src) {
-  if (USE_REINTERPRET) {
+  if (port_internal::LoadByReinterpretCast<T>()) {
     *reinterpret_cast<T*>(dst) = src;
   } else {
     memcpy(dst, &src, sizeof(T));