Skip to content

Commit

Permalink
Fix and disable many warnings in particular in the LLVM area (tested …
Browse files Browse the repository at this point in the history
…with gcc 6.1 and AppleClang)
  • Loading branch information
peremato committed Aug 30, 2016
1 parent 8c75bb8 commit d26573a
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 31 deletions.
4 changes: 1 addition & 3 deletions bindings/pyroot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions bindings/r/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/rint/src/TRint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 22 additions & 8 deletions interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 "")
Expand Down Expand Up @@ -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})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions math/mathcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions math/rtools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions math/unuran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions proof/proofd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions tmva/pymva/src/MethodPyAdaBoost.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
* (http://tmva.sourceforge.net/LICENSE) *
* *
**********************************************************************************/
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <iomanip>
#include <fstream>

#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>

#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <iomanip>
#include <fstream>

#include "TMath.h"
#include "Riostream.h"
#include "TMatrix.h"
Expand Down
8 changes: 4 additions & 4 deletions tmva/pymva/src/MethodPyGTB.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* *
**********************************************************************************/

#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <iomanip>
#include <fstream>

#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>

#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <iomanip>
#include <fstream>

#include "TMath.h"
#include "Riostream.h"
#include "TMatrix.h"
Expand Down
8 changes: 4 additions & 4 deletions tmva/pymva/src/MethodPyRandomForest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
* (http://tmva.sourceforge.net/LICENSE) *
* *
**********************************************************************************/
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <iomanip>
#include <fstream>

#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>

#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <iomanip>
#include <fstream>

#include "TMath.h"
#include "Riostream.h"
#include "TMatrix.h"
Expand Down
5 changes: 1 addition & 4 deletions tmva/rmva/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ 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
${CMAKE_SOURCE_DIR}/tmva/rmva/inc/TMVA/MethodRSVM.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()


Expand Down

0 comments on commit d26573a

Please sign in to comment.