diff options
| author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2019-08-15 13:11:50 +0000 |
|---|---|---|
| committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2019-08-15 13:11:50 +0000 |
| commit | dc23c832f4f7e5ae8204acfe800bdb611525c8bd (patch) | |
| tree | 108cbbeddd12c233f75eba243775b6261d9287e8 /openmp/runtime | |
| parent | ed804dad1e6849c5760dee451c5ce6459632d552 (diff) | |
| download | bcm5719-llvm-dc23c832f4f7e5ae8204acfe800bdb611525c8bd.tar.gz bcm5719-llvm-dc23c832f4f7e5ae8204acfe800bdb611525c8bd.zip | |
[OpenMP] Turn on -Wall compiler warnings by default
Instead, maintain a list of disabled options to still build libomp and
libomptarget without warnings. This includes -Wno-error and -Wno-pedantic
to silence warnings that LLVM enables when building in-tree.
I tested the following compilers:
* Clang 6.0, 7.0, 8.0
* GCC 4.8.5 (CentOS 7), GCC 6, 7, 8, 9
* Intel Compiler 16, 17, 18, 19
RFC thread on openmp-dev mailing list:
http://lists.llvm.org/pipermail/openmp-dev/2019-August/002668.html
Differential Revision: https://reviews.llvm.org/D65867
llvm-svn: 368999
Diffstat (limited to 'openmp/runtime')
| -rw-r--r-- | openmp/runtime/cmake/LibompHandleFlags.cmake | 42 | ||||
| -rw-r--r-- | openmp/runtime/cmake/config-ix.cmake | 39 |
2 files changed, 30 insertions, 51 deletions
diff --git a/openmp/runtime/cmake/LibompHandleFlags.cmake b/openmp/runtime/cmake/LibompHandleFlags.cmake index 3da7efa14e6..436cc2c9f2c 100644 --- a/openmp/runtime/cmake/LibompHandleFlags.cmake +++ b/openmp/runtime/cmake/LibompHandleFlags.cmake @@ -22,30 +22,24 @@ macro(libomp_setup_flags flags) 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 @@ function(libomp_get_c_and_cxxflags_common flags) 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() diff --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake index e0a5e685d08..d0cc27376d9 100644 --- a/openmp/runtime/cmake/config-ix.cmake +++ b/openmp/runtime/cmake/config-ix.cmake @@ -45,29 +45,24 @@ function(libomp_check_architecture_flag flag retval) 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 @@ if(WIN32) 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. |

