You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by om...@apache.org on 2019/10/23 17:49:25 UTC

[orc] 02/02: ORC-552: Fix c++ compilation for centos 6 and 8, and MacOs 10.14.

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

omalley pushed a commit to branch branch-1.5
in repository https://gitbox.apache.org/repos/asf/orc.git

commit 61e9d008d06a4f9291ee62737fbfd0e34f9b20d5
Author: Owen O'Malley <om...@apache.org>
AuthorDate: Mon Oct 14 14:40:06 2019 -0700

    ORC-552: Fix c++ compilation for centos 6 and 8, and MacOs 10.14.
    
    Fixes #436
    
    Signed-off-by: Owen O'Malley <om...@apache.org>
---
 c++/src/ColumnPrinter.cc                | 56 ++++++++++++++++-----------------
 c++/src/Vector.cc                       | 28 ++++++++---------
 c++/test/TestColumnReader.cc            |  3 ++
 cmake_modules/FindSnappy.cmake          |  2 +-
 cmake_modules/ThirdpartyToolchain.cmake |  2 +-
 5 files changed, 47 insertions(+), 44 deletions(-)

diff --git a/c++/src/ColumnPrinter.cc b/c++/src/ColumnPrinter.cc
index 379ef0b..b4b5860 100644
--- a/c++/src/ColumnPrinter.cc
+++ b/c++/src/ColumnPrinter.cc
@@ -289,8 +289,8 @@ namespace orc {
     return std::unique_ptr<ColumnPrinter>(result);
   }
 
-  VoidColumnPrinter::VoidColumnPrinter(std::string& buffer
-                                       ): ColumnPrinter(buffer) {
+  VoidColumnPrinter::VoidColumnPrinter(std::string& _buffer
+                                       ): ColumnPrinter(_buffer) {
     // PASS
   }
 
@@ -302,8 +302,8 @@ namespace orc {
     writeString(buffer, "null");
   }
 
-  LongColumnPrinter::LongColumnPrinter(std::string& buffer
-                                       ): ColumnPrinter(buffer),
+  LongColumnPrinter::LongColumnPrinter(std::string& _buffer
+                                       ): ColumnPrinter(_buffer),
                                           data(nullptr) {
     // PASS
   }
@@ -324,9 +324,9 @@ namespace orc {
     }
   }
 
-  DoubleColumnPrinter::DoubleColumnPrinter(std::string& buffer,
+  DoubleColumnPrinter::DoubleColumnPrinter(std::string& _buffer,
                                            const Type& type
-                                           ): ColumnPrinter(buffer),
+                                           ): ColumnPrinter(_buffer),
                                               data(nullptr),
                                               isFloat(type.getKind() == FLOAT){
     // PASS
@@ -348,8 +348,8 @@ namespace orc {
     }
   }
 
-  Decimal64ColumnPrinter::Decimal64ColumnPrinter(std::string& buffer
-                                                 ): ColumnPrinter(buffer),
+  Decimal64ColumnPrinter::Decimal64ColumnPrinter(std::string& _buffer
+                                                 ): ColumnPrinter(_buffer),
                                                     data(nullptr),
                                                     scale(0) {
     // PASS
@@ -398,8 +398,8 @@ namespace orc {
     }
   }
 
-  Decimal128ColumnPrinter::Decimal128ColumnPrinter(std::string& buffer
-                                                   ): ColumnPrinter(buffer),
+  Decimal128ColumnPrinter::Decimal128ColumnPrinter(std::string& _buffer
+                                                   ): ColumnPrinter(_buffer),
                                                       data(nullptr),
                                                       scale(0) {
      // PASS
@@ -419,8 +419,8 @@ namespace orc {
      }
    }
 
-  StringColumnPrinter::StringColumnPrinter(std::string& buffer
-                                           ): ColumnPrinter(buffer),
+  StringColumnPrinter::StringColumnPrinter(std::string& _buffer
+                                           ): ColumnPrinter(_buffer),
                                               start(nullptr),
                                               length(nullptr) {
     // PASS
@@ -470,9 +470,9 @@ namespace orc {
     }
   }
 
-  ListColumnPrinter::ListColumnPrinter(std::string& buffer,
+  ListColumnPrinter::ListColumnPrinter(std::string& _buffer,
                                        const Type& type
-                                       ): ColumnPrinter(buffer),
+                                       ): ColumnPrinter(_buffer),
                                           offsets(nullptr) {
     elementPrinter = createColumnPrinter(buffer, type.getSubtype(0));
   }
@@ -499,9 +499,9 @@ namespace orc {
     }
   }
 
-  MapColumnPrinter::MapColumnPrinter(std::string& buffer,
+  MapColumnPrinter::MapColumnPrinter(std::string& _buffer,
                                      const Type& type
-                                     ): ColumnPrinter(buffer),
+                                     ): ColumnPrinter(_buffer),
                                         offsets(nullptr) {
     keyPrinter = createColumnPrinter(buffer, type.getSubtype(0));
     elementPrinter = createColumnPrinter(buffer, type.getSubtype(1));
@@ -534,9 +534,9 @@ namespace orc {
     }
   }
 
-  UnionColumnPrinter::UnionColumnPrinter(std::string& buffer,
+  UnionColumnPrinter::UnionColumnPrinter(std::string& _buffer,
                                            const Type& type
-                                         ): ColumnPrinter(buffer),
+                                         ): ColumnPrinter(_buffer),
                                             tags(nullptr),
                                             offsets(nullptr) {
     for(unsigned int i=0; i < type.getSubtypeCount(); ++i) {
@@ -577,9 +577,9 @@ namespace orc {
     }
   }
 
-  StructColumnPrinter::StructColumnPrinter(std::string& buffer,
+  StructColumnPrinter::StructColumnPrinter(std::string& _buffer,
                                            const Type& type
-                                           ): ColumnPrinter(buffer) {
+                                           ): ColumnPrinter(_buffer) {
     for(unsigned int i=0; i < type.getSubtypeCount(); ++i) {
       fieldNames.push_back(type.getFieldName(i));
       fieldPrinter.push_back(createColumnPrinter(buffer,
@@ -621,8 +621,8 @@ namespace orc {
     }
   }
 
-  DateColumnPrinter::DateColumnPrinter(std::string& buffer
-                                       ): ColumnPrinter(buffer),
+  DateColumnPrinter::DateColumnPrinter(std::string& _buffer
+                                       ): ColumnPrinter(_buffer),
                                           data(nullptr) {
     // PASS
   }
@@ -647,8 +647,8 @@ namespace orc {
     data = dynamic_cast<const LongVectorBatch&>(batch).data.data();
   }
 
-  BooleanColumnPrinter::BooleanColumnPrinter(std::string& buffer
-                                             ): ColumnPrinter(buffer),
+  BooleanColumnPrinter::BooleanColumnPrinter(std::string& _buffer
+                                             ): ColumnPrinter(_buffer),
                                                 data(nullptr) {
     // PASS
   }
@@ -666,8 +666,8 @@ namespace orc {
     data = dynamic_cast<const LongVectorBatch&>(batch).data.data();
   }
 
-  BinaryColumnPrinter::BinaryColumnPrinter(std::string& buffer
-                                           ): ColumnPrinter(buffer),
+  BinaryColumnPrinter::BinaryColumnPrinter(std::string& _buffer
+                                           ): ColumnPrinter(_buffer),
                                               start(nullptr),
                                               length(nullptr) {
     // PASS
@@ -697,8 +697,8 @@ namespace orc {
     length = dynamic_cast<const StringVectorBatch&>(batch).length.data();
   }
 
-  TimestampColumnPrinter::TimestampColumnPrinter(std::string& buffer
-                                                 ): ColumnPrinter(buffer),
+  TimestampColumnPrinter::TimestampColumnPrinter(std::string& _buffer
+                                                 ): ColumnPrinter(_buffer),
                                                     seconds(nullptr),
                                                     nanoseconds(nullptr) {
     // PASS
diff --git a/c++/src/Vector.cc b/c++/src/Vector.cc
index 9e7e2d3..8c8e773 100644
--- a/c++/src/Vector.cc
+++ b/c++/src/Vector.cc
@@ -56,9 +56,9 @@ namespace orc {
     return false;
   }
 
-  LongVectorBatch::LongVectorBatch(uint64_t capacity, MemoryPool& pool
-                     ): ColumnVectorBatch(capacity, pool),
-                        data(pool, capacity) {
+  LongVectorBatch::LongVectorBatch(uint64_t _capacity, MemoryPool& pool
+                     ): ColumnVectorBatch(_capacity, pool),
+                        data(pool, _capacity) {
     // PASS
   }
 
@@ -84,9 +84,9 @@ namespace orc {
         static_cast<uint64_t>(data.capacity() * sizeof(int64_t));
   }
 
-  DoubleVectorBatch::DoubleVectorBatch(uint64_t capacity, MemoryPool& pool
-                   ): ColumnVectorBatch(capacity, pool),
-                      data(pool, capacity) {
+  DoubleVectorBatch::DoubleVectorBatch(uint64_t _capacity, MemoryPool& pool
+                   ): ColumnVectorBatch(_capacity, pool),
+                      data(pool, _capacity) {
     // PASS
   }
 
@@ -112,10 +112,10 @@ namespace orc {
           + static_cast<uint64_t>(data.capacity() * sizeof(double));
   }
 
-  StringVectorBatch::StringVectorBatch(uint64_t capacity, MemoryPool& pool
-               ): ColumnVectorBatch(capacity, pool),
-                  data(pool, capacity),
-                  length(pool, capacity) {
+  StringVectorBatch::StringVectorBatch(uint64_t _capacity, MemoryPool& pool
+               ): ColumnVectorBatch(_capacity, pool),
+                  data(pool, _capacity),
+                  length(pool, _capacity) {
     // PASS
   }
 
@@ -404,12 +404,12 @@ namespace orc {
     return value.toDecimalString(scale);
   }
 
-  TimestampVectorBatch::TimestampVectorBatch(uint64_t capacity,
+  TimestampVectorBatch::TimestampVectorBatch(uint64_t _capacity,
                                              MemoryPool& pool
-                                             ): ColumnVectorBatch(capacity,
+                                             ): ColumnVectorBatch(_capacity,
                                                                   pool),
-                                                data(pool, capacity),
-                                                nanoseconds(pool, capacity) {
+                                                data(pool, _capacity),
+                                                nanoseconds(pool, _capacity) {
     // PASS
   }
 
diff --git a/c++/test/TestColumnReader.cc b/c++/test/TestColumnReader.cc
index c67229a..9e1f356 100644
--- a/c++/test/TestColumnReader.cc
+++ b/c++/test/TestColumnReader.cc
@@ -32,6 +32,9 @@
 #ifdef __clang__
   DIAGNOSTIC_IGNORE("-Winconsistent-missing-override")
 #endif
+#ifdef __GNUC__
+  DIAGNOSTIC_IGNORE("-Wparentheses")
+#endif
 
 namespace orc {
 
diff --git a/cmake_modules/FindSnappy.cmake b/cmake_modules/FindSnappy.cmake
index 6cf64be..5aeb88e 100644
--- a/cmake_modules/FindSnappy.cmake
+++ b/cmake_modules/FindSnappy.cmake
@@ -30,7 +30,7 @@ find_path (SNAPPY_INCLUDE_DIR snappy.h HINTS
 
 find_library (SNAPPY_LIBRARIES NAMES snappy HINTS
   ${_snappy_path}
-  PATH_SUFFIXES "lib")
+  PATH_SUFFIXES "lib" "lib64")
 
 if (SNAPPY_INCLUDE_DIR AND SNAPPY_LIBRARIES)
   set (SNAPPY_FOUND TRUE)
diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake
index f8584c0..561fbc9 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -59,7 +59,7 @@ else ()
   set(SNAPPY_INCLUDE_DIR "${SNAPPY_HOME}/include")
   set(SNAPPY_STATIC_LIB "${SNAPPY_HOME}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}snappy${CMAKE_STATIC_LIBRARY_SUFFIX}")
   set(SNAPPY_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${SNAPPY_HOME}
-                        -DBUILD_SHARED_LIBS=OFF)
+                        -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_LIBDIR=lib)
 
   ExternalProject_Add (snappy_ep
     URL "https://github.com/google/snappy/archive/${SNAPPY_VERSION}.tar.gz"