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

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 627c729  ARROW-7037: [C++ ] Compile error on the combination of 
protobuf >= 3.9 and clang
627c729 is described below

commit 627c72987925afdaa205222f3ad0fa69b6066236
Author: Kenta Murata <[email protected]>
AuthorDate: Thu Oct 31 16:10:00 2019 +0900

    ARROW-7037: [C++ ] Compile error on the combination of protobuf >= 3.9 and 
clang
    
    I encountered the following compile error on the combination of protobuf 
3.10.0 and clang (Xcode 11).
    
    ```
    [13/26] Building CXX object 
c++/src/CMakeFiles/orc.dir/wrap/orc-proto-wrapper.cc.o
    FAILED: c++/src/CMakeFiles/orc.dir/wrap/orc-proto-wrapper.cc.o
    
/Applications/Xcode_11.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
   -Ic++/include 
-I/Users/mrkn/src/github.com/apache/arrow/cpp/build.debug/orc_ep-prefix/src/orc_ep/c++/include
 
-I/Users/mrkn/src/github.com/apache/arrow/cpp/build.debug/orc_ep-prefix/src/orc_ep/c++/src
 -Ic++/src -isystem c++/libs/thirdparty/zlib_ep-install/include -isystem 
c++/libs/thirdparty/lz4_ep-install/include -Qunused-arguments 
-fcolor-diagnostics -ggdb -O0 -g -fPIC  -Wno-zero-as-null [...]
    In file included from 
/Users/mrkn/src/github.com/apache/arrow/cpp/build.debug/orc_ep-prefix/src/orc_ep/c++/src/wrap/orc-proto-wrapper.cc:44:
    c++/src/orc_proto.pb.cc:959:145: error: possible misuse of comma operator 
here [-Werror,-Wcomma]
    static bool dynamic_init_dummy_orc_5fproto_2eproto = (  
::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_orc_5fproto_2eproto),
 true);
                                                                                
                                                                    ^
    c++/src/orc_proto.pb.cc:959:57: note: cast expression to void to silence 
warning
    static bool dynamic_init_dummy_orc_5fproto_2eproto = (  
::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_orc_5fproto_2eproto),
 true);
                                                            
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                            static_cast<void>(  
                                                                    )
    1 error generated.
    ```
    
    I'd like to put `-Wno-comma` in `ORG_CMAKE_CXX_FLAGS` when the version of 
protobuf >= 3.9.
    
    This is the related issue on protobuf: 
https://github.com/protocolbuffers/protobuf/issues/6619
    
    Closes #5763 from mrkn/ARROW-7037 and squashes the following commits:
    
    6b87d5e42 <Kenta Murata> Prevent compile error due to -Wcomma on clang and 
protobuf >= 3.9
    
    Authored-by: Kenta Murata <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake 
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index b3fe46f..369827f 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -2304,6 +2304,9 @@ macro(build_orc)
       set(ORC_CMAKE_CXX_FLAGS " -Wno-zero-as-null-pointer-constant \
 -Wno-inconsistent-missing-destructor-override -Wno-error=undef ")
     endif()
+    if("${Protobuf_VERSION}" VERSION_GREATER_EQUAL "3.9.0")
+      set(ORC_CMAKE_CXX_FLAGS "${ORC_CMAKE_CXX_FLAGS} -Wno-comma ")
+    endif()
   endif()
 
   set(ORC_CMAKE_CXX_FLAGS "${EP_CXX_FLAGS} ${ORC_CMAKE_CXX_FLAGS}")

Reply via email to