diff --git a/CMake/VTKmCompilerFlags.cmake b/CMake/VTKmCompilerFlags.cmake index 007fd7d44..bc4e7948d 100644 --- a/CMake/VTKmCompilerFlags.cmake +++ b/CMake/VTKmCompilerFlags.cmake @@ -98,8 +98,11 @@ elseif(VTKM_COMPILER_IS_ICC) target_compile_options(vtkm_developer_flags INTERFACE $<$:-wd1478 -wd13379>) elseif(VTKM_COMPILER_IS_GNU OR VTKM_COMPILER_IS_CLANG) - set(cxx_flags -Wall -Wcast-align -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -fno-common) - set(cuda_flags -Xcompiler=-Wall,-Wno-unknown-pragmas,-Wno-unused-local-typedefs,-Wno-unused-local-typedefs,-Wno-unused-function,-Wcast-align,-Wchar-subscripts,-Wpointer-arith,-Wformat,-Wformat-security,-Wshadow,-Wunused-parameter,-fno-common) + set(cxx_flags -Wall -Wcast-align -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused -fno-common) + set(cuda_flags -Xcompiler=-Wall,-Wno-unknown-pragmas,-Wno-unused-local-typedefs,-Wno-unused-local-typedefs,-Wno-unused-function,-Wcast-align,-Wchar-subscripts,-Wpointer-arith,-Wformat,-Wformat-security,-Wshadow,-Wunused,-fno-common) + + #Only add float-conversion warnings for gcc as the integer warnigns in GCC + #include the implicit casting of all types smaller than int to ints. if (VTKM_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.99) list(APPEND cxx_flags -Wfloat-conversion) set(cuda_flags "${cuda_flags},-Wfloat-conversion") @@ -108,6 +111,15 @@ elseif(VTKM_COMPILER_IS_GNU OR VTKM_COMPILER_IS_CLANG) set(cuda_flags "${cuda_flags},-Wconversion") endif() + #Add in the -Wodr warning for GCC versions 5.2+ + if (VTKM_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.1) + list(APPEND cxx_flags -Wodr) + set(cuda_flags "${cuda_flags},-Wodr") + elseif (VTKM_COMPILER_IS_CLANG) + list(APPEND cxx_flags -Wodr) + set(cuda_flags "${cuda_flags},-Wodr") + endif() + #GCC 5, 6 don't properly handle strict-overflow suppression through pragma's. #Instead of suppressing around the location of the strict-overflow you #have to suppress around the entry point, or in vtk-m case the worklet @@ -118,6 +130,7 @@ elseif(VTKM_COMPILER_IS_GNU OR VTKM_COMPILER_IS_CLANG) (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.99) ) list(APPEND cxx_flags -Wno-strict-overflow) endif() + target_compile_options(vtkm_developer_flags INTERFACE $<$:${cxx_flags}>) if(TARGET vtkm::cuda) target_compile_options(vtkm_developer_flags INTERFACE $<$:${cuda_flags}>)