From d26573ac7c1c6871bd006d907a354f7800ce1adb Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Tue, 30 Aug 2016 16:44:01 +0200 Subject: [PATCH] Fix and disable many warnings in particular in the LLVM area (tested with gcc 6.1 and AppleClang) --- bindings/pyroot/CMakeLists.txt | 4 +-- bindings/r/CMakeLists.txt | 2 ++ core/rint/src/TRint.cxx | 2 +- interpreter/CMakeLists.txt | 30 ++++++++++++++----- .../RuntimeDyld/RuntimeDyld.cpp | 2 +- math/mathcore/CMakeLists.txt | 3 ++ math/rtools/CMakeLists.txt | 2 ++ math/unuran/CMakeLists.txt | 4 +-- proof/proofd/CMakeLists.txt | 2 ++ tmva/pymva/src/MethodPyAdaBoost.cxx | 8 ++--- tmva/pymva/src/MethodPyGTB.cxx | 8 ++--- tmva/pymva/src/MethodPyRandomForest.cxx | 8 ++--- tmva/rmva/CMakeLists.txt | 5 +--- 13 files changed, 49 insertions(+), 31 deletions(-) diff --git a/bindings/pyroot/CMakeLists.txt b/bindings/pyroot/CMakeLists.txt index a8b5c06db051b..eac3fa06b11d8 100644 --- a/bindings/pyroot/CMakeLists.txt +++ b/bindings/pyroot/CMakeLists.txt @@ -5,9 +5,7 @@ include_directories(${PYTHON_INCLUDE_DIRS}) ROOT_GENERATE_DICTIONARY(G__PyROOT *.h MODULE PyROOT LINKDEF LinkDef.h OPTIONS "-writeEmptyRootPCM") -if(GCC_MAJOR EQUAL 4) - add_definitions(-fno-strict-aliasing) -endif() +ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -fno-strict-aliasing) if(WIN32) set(ROOTULIBS -include:_G__cpp_setupG__Net diff --git a/bindings/r/CMakeLists.txt b/bindings/r/CMakeLists.txt index 5844d38f9dac2..f121c6cfe10cb 100644 --- a/bindings/r/CMakeLists.txt +++ b/bindings/r/CMakeLists.txt @@ -9,6 +9,8 @@ set(libname RInterface) include_directories(${R_INCLUDE_DIRS}) +ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -Wno-overloaded-virtual) + set(R_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRInterface.h ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRObject.h ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRFunctionExport.h diff --git a/core/rint/src/TRint.cxx b/core/rint/src/TRint.cxx index 9fe27c407e604..ce07730f62c14 100644 --- a/core/rint/src/TRint.cxx +++ b/core/rint/src/TRint.cxx @@ -554,7 +554,7 @@ char *TRint::GetPrompt() const char *TRint::SetPrompt(const char *newPrompt) { - TString op = fDefaultPrompt; + static TString op = fDefaultPrompt; if (newPrompt && strlen(newPrompt) <= 55) fDefaultPrompt = newPrompt; diff --git a/interpreter/CMakeLists.txt b/interpreter/CMakeLists.txt index 6170e3ab73859..0ab8f35353c6d 100644 --- a/interpreter/CMakeLists.txt +++ b/interpreter/CMakeLists.txt @@ -1,6 +1,6 @@ #---Define the way we want to build and what of llvm/clang/cling------------------------------------ -set(LLVM_ENABLE_WARNINGS ON CACHE BOOL "") +set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "") set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") set(LLVM_BUILD_TOOLS OFF CACHE BOOL "") @@ -34,14 +34,28 @@ endif() set(LLVM_TARGETS_TO_BUILD ${ROOT_CLING_TARGET} CACHE STRING "Semicolon-separated list of targets to build, or \"all\".") #---Protect against warnings clang/gcc would fire---------------------------------------------------- -set(INTERP_COMMON_ADDITIONAL_FLAGS "-Wno-comment -Wno-unused-parameter") -if(CMAKE_COMPILER_IS_GNUCXX) - set(INTERP_ADDITIONAL_FLAGS "${INTERP_COMMON_ADDITIONAL_FLAGS} -Wno-maybe-uninitialized -Wno-unused-but-set-variable -Wno-missing-field-initializers") -elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) - set(INTERP_ADDITIONAL_FLAGS "${INTERP_COMMON_ADDITIONAL_FLAGS} -Wno-conditional-uninitialized -Wno-parentheses-equality -Wno-unused-private-field") +ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-comment) +ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-missing-field-initializers) +if(${CMAKE_CXX_COMPILER_ID} MATCHES Clang) + ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-conditional-uninitialized) + ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-unused-private-field) + ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-unused-local-typedef) + ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-parentheses-equality) + ROOT_ADD_C_FLAG(INTERP_ADDITIONAL_C_FLAGS -Wno-parentheses-equality) endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${INTERP_ADDITIONAL_FLAGS}") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${INTERP_ADDITIONAL_FLAGS}") +if(APPLE) + ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-deprecated-declarations) +endif() +ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-overloaded-virtual) +ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-maybe-uninitialized) +ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-unused-parameter) +ROOT_ADD_C_FLAG(INTERP_ADDITIONAL_C_FLAGS -Wno-unused-parameter) +ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-unused-variable) +ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-unused-but-set-variable) +ROOT_ADD_CXX_FLAG(INTERP_ADDITIONAL_CXX_FLAGS -Wno-unused-function) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${INTERP_ADDITIONAL_CXX_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${INTERP_ADDITIONAL_C_FLAGS}") #---Do not transform warnings in errors------------------------------------------------------------- string(REPLACE "-Werror " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) diff --git a/interpreter/llvm/src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/interpreter/llvm/src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index ce4dd669c811c..ce4c45d3b3941 100644 --- a/interpreter/llvm/src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/interpreter/llvm/src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -617,7 +617,7 @@ Error RuntimeDyldImpl::emitWeakSymbols(const ObjectFile &Obj, uint64_t SectOffset; if (auto Err = getOffset(Sym, *SI, SectOffset)) - return std::move(Err); + return Err; bool IsCode = SI->isText(); unsigned SectionID; if (auto SectionIDOrErr = findOrEmitSection(Obj, *SI, IsCode,LocalSections)) diff --git a/math/mathcore/CMakeLists.txt b/math/mathcore/CMakeLists.txt index 89b930245443c..1accf6121382c 100644 --- a/math/mathcore/CMakeLists.txt +++ b/math/mathcore/CMakeLists.txt @@ -23,6 +23,9 @@ ROOT_GENERATE_DICTIONARY(G__MathCore TComplex.h TMath.h ${MATHCORE_HEADERS} Fi add_definitions(-DUSE_ROOT_ERROR ) ROOT_ADD_C_FLAG(_flags -Wno-strict-overflow) # Avoid what it seems a compiler false positive warning +ROOT_ADD_C_FLAG(_flags -Wno-maybe-uninitialized) # Avoid what it seems a compiler false positive warning +ROOT_ADD_C_FLAG(_flags -Wno-parentheses-equality) + set_source_files_properties(src/triangle.c COMPILE_FLAGS "${_flags}") ROOT_LINKER_LIBRARY(MathCore *.cxx *.c G__MathCore.cxx LIBRARIES ${CMAKE_THREAD_LIBS_INIT} DEPENDENCIES Core) diff --git a/math/rtools/CMakeLists.txt b/math/rtools/CMakeLists.txt index 1aae7ca9bd04c..b073a2e561de8 100644 --- a/math/rtools/CMakeLists.txt +++ b/math/rtools/CMakeLists.txt @@ -5,6 +5,8 @@ include_directories(${R_INCLUDE_DIRS}) +ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -Wno-overloaded-virtual) + ROOT_GENERATE_DICTIONARY(G__Rtools Math/RMinimizer.h MODULE Rtools LINKDEF LinkDef.h) ROOT_LINKER_LIBRARY(Rtools *.cxx G__Rtools.cxx LIBRARIES Core ${R_LIBRARIES} DEPENDENCIES MathCore RInterface) ROOT_INSTALL_HEADERS() diff --git a/math/unuran/CMakeLists.txt b/math/unuran/CMakeLists.txt index 18c1b48993416..7c884dc186281 100644 --- a/math/unuran/CMakeLists.txt +++ b/math/unuran/CMakeLists.txt @@ -50,8 +50,8 @@ endif() #---We need to disable some warnings------------------------------------------------------------------- string(REPLACE -Wall "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) - add_definitions(-Wno-parentheses-equality) +if(${CMAKE_CXX_COMPILER_ID} MATCHES Clang) + ROOT_ADD_C_FLAG(CMAKE_C_FLAGS -Wno-parentheses-equality) endif() include_directories(BEFORE ${UNR_UNTARDIR} ${UNR_UNTARDIR}/src ${UNR_UNTARDIR}/src/utils) diff --git a/proof/proofd/CMakeLists.txt b/proof/proofd/CMakeLists.txt index e5d24788eac6b..ec7c159f33bb3 100644 --- a/proof/proofd/CMakeLists.txt +++ b/proof/proofd/CMakeLists.txt @@ -11,6 +11,8 @@ add_definitions(${XROOTD_CFLAGS}) # Uncomment if not the case (G Ganis, 18/5/2016) # ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -Wno-undefined-bool-conversion) +ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -Wno-nonnull-compare) + if(WIN32) ROOT_LINKER_LIBRARY(XrdProofd XProofProtUtils.cxx LIBRARIES ${XROOTD_LIBRARIES}) else() diff --git a/tmva/pymva/src/MethodPyAdaBoost.cxx b/tmva/pymva/src/MethodPyAdaBoost.cxx index 15823310c128a..d341ab22299ae 100644 --- a/tmva/pymva/src/MethodPyAdaBoost.cxx +++ b/tmva/pymva/src/MethodPyAdaBoost.cxx @@ -16,14 +16,14 @@ * (http://tmva.sourceforge.net/LICENSE) * * * **********************************************************************************/ -#pragma GCC diagnostic ignored "-Wunused-parameter" -#include -#include - #include #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#include + #include "TMath.h" #include "Riostream.h" #include "TMatrix.h" diff --git a/tmva/pymva/src/MethodPyGTB.cxx b/tmva/pymva/src/MethodPyGTB.cxx index 026c88a7d361c..ecbf174ba2687 100644 --- a/tmva/pymva/src/MethodPyGTB.cxx +++ b/tmva/pymva/src/MethodPyGTB.cxx @@ -17,14 +17,14 @@ * * **********************************************************************************/ -#pragma GCC diagnostic ignored "-Wunused-parameter" -#include -#include - #include #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#include + #include "TMath.h" #include "Riostream.h" #include "TMatrix.h" diff --git a/tmva/pymva/src/MethodPyRandomForest.cxx b/tmva/pymva/src/MethodPyRandomForest.cxx index b36277901e663..27101083a678e 100644 --- a/tmva/pymva/src/MethodPyRandomForest.cxx +++ b/tmva/pymva/src/MethodPyRandomForest.cxx @@ -16,14 +16,14 @@ * (http://tmva.sourceforge.net/LICENSE) * * * **********************************************************************************/ -#pragma GCC diagnostic ignored "-Wunused-parameter" -#include -#include - #include #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#include + #include "TMath.h" #include "Riostream.h" #include "TMatrix.h" diff --git a/tmva/rmva/CMakeLists.txt b/tmva/rmva/CMakeLists.txt index 31dfb500b9a62..c95fcf3d9adad 100644 --- a/tmva/rmva/CMakeLists.txt +++ b/tmva/rmva/CMakeLists.txt @@ -9,7 +9,6 @@ set(libname RMVA) include_directories(${R_INCLUDE_DIRS}) - set(R_HEADERS ${CMAKE_SOURCE_DIR}/tmva/rmva/inc/TMVA/RMethodBase.h ${CMAKE_SOURCE_DIR}/tmva/rmva/inc/TMVA/MethodC50.h ${CMAKE_SOURCE_DIR}/tmva/rmva/inc/TMVA/MethodRSNNS.h @@ -17,12 +16,10 @@ set(R_HEADERS ${CMAKE_SOURCE_DIR}/tmva/rmva/inc/TMVA/RMethodBase.h ${CMAKE_SOURCE_DIR}/tmva/rmva/inc/TMVA/MethodRXGB.h ) +ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -Wno-overloaded-virtual) ROOT_GENERATE_DICTIONARY(G__RMVA ${R_HEADERS} MODULE ${libname} LINKDEF LinkDef.h) -# ROOT_GENERATE_ROOTMAP(RInterface LINKDEF LinkDef.h) - ROOT_LINKER_LIBRARY(RMVA *.cxx G__RMVA.cxx LIBRARIES ${R_LIBRARIES} DEPENDENCIES Core Matrix Thread RIO RInterface TMVA) - ROOT_INSTALL_HEADERS()