Index: openmp/trunk/cmake/HandleOpenMPOptions.cmake =================================================================== --- openmp/trunk/cmake/HandleOpenMPOptions.cmake +++ openmp/trunk/cmake/HandleOpenMPOptions.cmake @@ -1,4 +1,4 @@ -if (${OPENMP_STANDALONE_BUILD}) +if (OPENMP_STANDALONE_BUILD) # From HandleLLVMOptions.cmake function(append_if condition value) if (${condition}) @@ -9,10 +9,25 @@ endfunction() endif() -if (${OPENMP_ENABLE_WERROR}) +# MSVC and clang-cl in compatibility mode map -Wall to -Weverything. +# TODO: LLVM adds /W4 instead, check if that works for the OpenMP runtimes. +if (NOT MSVC) + append_if(OPENMP_HAVE_WALL_FLAG "-Wall" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +endif() +if (OPENMP_ENABLE_WERROR) append_if(OPENMP_HAVE_WERROR_FLAG "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) endif() +# Additional warnings that are not enabled by -Wall. +append_if(OPENMP_HAVE_WCAST_QUAL_FLAG "-Wcast-qual" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +append_if(OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG "-Wformat-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +append_if(OPENMP_HAVE_WSIGN_COMPARE_FLAG "-Wsign-compare" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + +# Warnings that we want to disable because they are too verbose or fragile. +append_if(OPENMP_HAVE_WNO_EXTRA_FLAG "-Wno-extra" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +append_if(OPENMP_HAVE_WNO_PEDANTIC_FLAG "-Wno-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +append_if(OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + append_if(OPENMP_HAVE_STD_GNUPP11_FLAG "-std=gnu++11" CMAKE_CXX_FLAGS) if (NOT OPENMP_HAVE_STD_GNUPP11_FLAG) append_if(OPENMP_HAVE_STD_CPP11_FLAG "-std=c++11" CMAKE_CXX_FLAGS) Index: openmp/trunk/cmake/config-ix.cmake =================================================================== --- openmp/trunk/cmake/config-ix.cmake +++ openmp/trunk/cmake/config-ix.cmake @@ -1,7 +1,17 @@ -include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) -check_c_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG) +check_cxx_compiler_flag(-Wall OPENMP_HAVE_WALL_FLAG) +check_cxx_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG) + +# Additional warnings that are not enabled by -Wall. +check_cxx_compiler_flag(-Wcast-qual OPENMP_HAVE_WCAST_QUAL_FLAG) +check_cxx_compiler_flag(-Wformat-pedantic OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG) +check_cxx_compiler_flag(-Wsign-compare OPENMP_HAVE_WSIGN_COMPARE_FLAG) + +# Warnings that we want to disable because they are too verbose or fragile. +check_cxx_compiler_flag(-Wno-extra OPENMP_HAVE_WNO_EXTRA_FLAG) +check_cxx_compiler_flag(-Wno-pedantic OPENMP_HAVE_WNO_PEDANTIC_FLAG) +check_cxx_compiler_flag(-Wno-maybe-uninitialized OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG) check_cxx_compiler_flag(-std=gnu++11 OPENMP_HAVE_STD_GNUPP11_FLAG) check_cxx_compiler_flag(-std=c++11 OPENMP_HAVE_STD_CPP11_FLAG) Index: openmp/trunk/runtime/cmake/LibompHandleFlags.cmake =================================================================== --- openmp/trunk/runtime/cmake/LibompHandleFlags.cmake +++ openmp/trunk/runtime/cmake/LibompHandleFlags.cmake @@ -22,30 +22,24 @@ endif() endmacro() -# Gets flags common to both the C and C++ compiler -function(libomp_get_c_and_cxxflags_common flags) +# C++ compiler flags +function(libomp_get_cxxflags cxxflags) set(flags_local) libomp_append(flags_local -fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG) libomp_append(flags_local -fno-rtti LIBOMP_HAVE_FNO_RTTI_FLAG) - if(${OPENMP_STANDALONE_BUILD}) - libomp_append(flags_local -Wsign-compare LIBOMP_HAVE_WNO_SIGN_COMPARE_FLAG) - libomp_append(flags_local -Wunused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG) - libomp_append(flags_local -Wunused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG) - libomp_append(flags_local -Wunused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG) - libomp_append(flags_local -Wunused-variable LIBOMP_HAVE_WNO_UNUSED_VARIABLE_FLAG) - libomp_append(flags_local -Wdeprecated-register LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG) - libomp_append(flags_local -Wunknown-pragmas LIBOMP_HAVE_WNO_UNKNOWN_PRAGMAS_FLAG) - libomp_append(flags_local -Wcomment LIBOMP_HAVE_WNO_COMMENT_FLAG) - libomp_append(flags_local -Wself-assign LIBOMP_HAVE_WNO_SELF_ASSIGN_FLAG) - libomp_append(flags_local -Wformat-pedantic LIBOMP_HAVE_WNO_FORMAT_PEDANTIC_FLAG) - endif() - libomp_append(flags_local -Wno-switch LIBOMP_HAVE_WNO_SWITCH_FLAG) + libomp_append(flags_local -Wno-class-memaccess LIBOMP_HAVE_WNO_CLASS_MEMACCESS_FLAG) libomp_append(flags_local -Wno-covered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG) - libomp_append(flags_local -Wno-gnu-anonymous-struct LIBOMP_HAVE_WNO_GNU_ANONYMOUS_STRUCT_FLAG) - libomp_append(flags_local -Wno-missing-field-initializers LIBOMP_HAVE_WNO_MISSING_FIELD_INITIALIZERS_FLAG) + libomp_append(flags_local -Wno-frame-address LIBOMP_HAVE_WNO_FRAME_ADDRESS_FLAG) + libomp_append(flags_local -Wno-implicit-fallthrough LIBOMP_HAVE_WNO_IMPLICIT_FALLTHROUGH_FLAG) + libomp_append(flags_local -Wno-int-in-bool-context LIBOMP_HAVE_WNO_INT_IN_BOOL_CONTEXT_FLAG) libomp_append(flags_local -Wno-missing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG) - libomp_append(flags_local -Wno-vla-extension LIBOMP_HAVE_WNO_VLA_EXTENSION_FLAG) + libomp_append(flags_local -Wno-parentheses LIBOMP_HAVE_WNO_PARENTHESES_FLAG) + libomp_append(flags_local -Wno-strict-aliasing LIBOMP_HAVE_WNO_STRICT_ALIASING_FLAG) libomp_append(flags_local -Wstringop-overflow=0 LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG) + libomp_append(flags_local -Wno-stringop-truncation LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG) + libomp_append(flags_local -Wno-switch LIBOMP_HAVE_WNO_SWITCH_FLAG) + libomp_append(flags_local -Wno-uninitialized LIBOMP_HAVE_WNO_UNINITIALIZED_FLAG) + libomp_append(flags_local -Wno-unused-but-set-variable LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG) libomp_append(flags_local /GS LIBOMP_HAVE_GS_FLAG) libomp_append(flags_local /EHsc LIBOMP_HAVE_EHSC_FLAG) libomp_append(flags_local /Oy- LIBOMP_HAVE_OY__FLAG) @@ -71,17 +65,7 @@ libomp_append(flags_local -ftls-model=initial-exec LIBOMP_HAVE_FTLS_MODEL_FLAG) libomp_append(flags_local "-opt-streaming-stores never" LIBOMP_HAVE_OPT_STREAMING_STORES_FLAG) endif() - set(${flags} ${flags_local} PARENT_SCOPE) -endfunction() - -# C++ compiler flags -function(libomp_get_cxxflags cxxflags) - set(cxxflags_local) - libomp_get_c_and_cxxflags_common(cxxflags_local) - if(${OPENMP_STANDALONE_BUILD}) - libomp_append(cxxflags_local -Wcast-qual LIBOMP_HAVE_WCAST_QUAL_FLAG) - endif() - set(cxxflags_local ${cxxflags_local} ${LIBOMP_CXXFLAGS}) + set(cxxflags_local ${flags_local} ${LIBOMP_CXXFLAGS}) libomp_setup_flags(cxxflags_local) set(${cxxflags} ${cxxflags_local} PARENT_SCOPE) endfunction() Index: openmp/trunk/runtime/cmake/config-ix.cmake =================================================================== --- openmp/trunk/runtime/cmake/config-ix.cmake +++ openmp/trunk/runtime/cmake/config-ix.cmake @@ -45,29 +45,24 @@ set(${retval} ${${retval}} PARENT_SCOPE) endfunction() -# Checking C, CXX, Linker Flags +# Checking CXX, Linker Flags check_cxx_compiler_flag(-fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG) check_cxx_compiler_flag(-fno-rtti LIBOMP_HAVE_FNO_RTTI_FLAG) -check_cxx_compiler_flag(-Wcast-qual LIBOMP_HAVE_WCAST_QUAL_FLAG) -check_c_compiler_flag(-Wunused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG) -check_c_compiler_flag(-Wunused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG) -check_c_compiler_flag(-Wunused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG) -check_c_compiler_flag(-Wunused-variable LIBOMP_HAVE_WNO_UNUSED_VARIABLE_FLAG) -check_c_compiler_flag(-Wswitch LIBOMP_HAVE_WNO_SWITCH_FLAG) -check_c_compiler_flag(-Wcovered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG) -check_c_compiler_flag(-Wdeprecated-register LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG) -check_c_compiler_flag(-Wsign-compare LIBOMP_HAVE_WNO_SIGN_COMPARE_FLAG) -check_c_compiler_flag(-Wgnu-anonymous-struct LIBOMP_HAVE_WNO_GNU_ANONYMOUS_STRUCT_FLAG) -check_c_compiler_flag(-Wunknown-pragmas LIBOMP_HAVE_WNO_UNKNOWN_PRAGMAS_FLAG) -check_c_compiler_flag(-Wmissing-field-initializers LIBOMP_HAVE_WNO_MISSING_FIELD_INITIALIZERS_FLAG) -check_c_compiler_flag(-Wmissing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG) -check_c_compiler_flag(-Wcomment LIBOMP_HAVE_WNO_COMMENT_FLAG) -check_c_compiler_flag(-Wself-assign LIBOMP_HAVE_WNO_SELF_ASSIGN_FLAG) -check_c_compiler_flag(-Wvla-extension LIBOMP_HAVE_WNO_VLA_EXTENSION_FLAG) -check_c_compiler_flag(-Wformat-pedantic LIBOMP_HAVE_WNO_FORMAT_PEDANTIC_FLAG) -check_c_compiler_flag(-Wstringop-overflow=0 LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG) -check_c_compiler_flag(-msse2 LIBOMP_HAVE_MSSE2_FLAG) -check_c_compiler_flag(-ftls-model=initial-exec LIBOMP_HAVE_FTLS_MODEL_FLAG) +check_cxx_compiler_flag(-Wno-class-memaccess LIBOMP_HAVE_WNO_CLASS_MEMACCESS_FLAG) +check_cxx_compiler_flag(-Wno-covered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG) +check_cxx_compiler_flag(-Wno-frame-address LIBOMP_HAVE_WNO_FRAME_ADDRESS_FLAG) +check_cxx_compiler_flag(-Wno-implicit-fallthrough LIBOMP_HAVE_WNO_IMPLICIT_FALLTHROUGH_FLAG) +check_cxx_compiler_flag(-Wno-int-in-bool-context LIBOMP_HAVE_WNO_INT_IN_BOOL_CONTEXT_FLAG) +check_cxx_compiler_flag(-Wno-missing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG) +check_cxx_compiler_flag(-Wno-parentheses LIBOMP_HAVE_WNO_PARENTHESES_FLAG) +check_cxx_compiler_flag(-Wno-strict-aliasing LIBOMP_HAVE_WNO_STRICT_ALIASING_FLAG) +check_cxx_compiler_flag(-Wstringop-overflow=0 LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG) +check_cxx_compiler_flag(-Wno-stringop-truncation LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG) +check_cxx_compiler_flag(-Wno-switch LIBOMP_HAVE_WNO_SWITCH_FLAG) +check_cxx_compiler_flag(-Wno-uninitialized LIBOMP_HAVE_WNO_UNINITIALIZED_FLAG) +check_cxx_compiler_flag(-Wno-unused-but-set-variable LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG) +check_cxx_compiler_flag(-msse2 LIBOMP_HAVE_MSSE2_FLAG) +check_cxx_compiler_flag(-ftls-model=initial-exec LIBOMP_HAVE_FTLS_MODEL_FLAG) libomp_check_architecture_flag(-mmic LIBOMP_HAVE_MMIC_FLAG) libomp_check_architecture_flag(-m32 LIBOMP_HAVE_M32_FLAG) if(WIN32) @@ -79,7 +74,7 @@ check_cxx_compiler_flag(/arch:SSE2 LIBOMP_HAVE_ARCH_SSE2_FLAG) check_cxx_compiler_flag(/Qsafeseh LIBOMP_HAVE_QSAFESEH_FLAG) endif() - check_c_compiler_flag(-mrtm LIBOMP_HAVE_MRTM_FLAG) + check_cxx_compiler_flag(-mrtm LIBOMP_HAVE_MRTM_FLAG) # It is difficult to create a dummy masm assembly file # and then check the MASM assembler to see if these flags exist and work, # so we assume they do for Windows.