Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / cmake / HandleOpenMPOptions.cmake
blob4d6782a6f0cbe879ca63117b2d6ee8da44c4efdf
1 if (OPENMP_STANDALONE_BUILD)
2   # From HandleLLVMOptions.cmake
3   function(append_if condition value)
4     if (${condition})
5       foreach(variable ${ARGN})
6         set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
7       endforeach(variable)
8     endif()
9   endfunction()
10 endif()
12 # MSVC and clang-cl in compatibility mode map -Wall to -Weverything.
13 # TODO: LLVM adds /W4 instead, check if that works for the OpenMP runtimes.
14 if (NOT MSVC)
15   append_if(OPENMP_HAVE_WALL_FLAG "-Wall" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
16 endif()
17 if (OPENMP_ENABLE_WERROR)
18   append_if(OPENMP_HAVE_WERROR_FLAG "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
19 endif()
21 # Additional warnings that are not enabled by -Wall.
22 append_if(OPENMP_HAVE_WCAST_QUAL_FLAG "-Wcast-qual" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
23 append_if(OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG "-Wformat-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
24 append_if(OPENMP_HAVE_WIMPLICIT_FALLTHROUGH_FLAG "-Wimplicit-fallthrough" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
25 append_if(OPENMP_HAVE_WSIGN_COMPARE_FLAG "-Wsign-compare" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
27 # Warnings that we want to disable because they are too verbose or fragile.
29 # GCC silently accepts any -Wno-<foo> option, but warns about those options
30 # being unrecognized only if the compilation triggers other warnings to be
31 # printed. Therefore, check for whether the compiler supports options in the
32 # form -W<foo>, and if supported, add the corresponding -Wno-<foo> option.
34 append_if(OPENMP_HAVE_WENUM_CONSTEXPR_CONVERSION_FLAG "-Wno-enum-constexpr-conversion" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
35 append_if(OPENMP_HAVE_WEXTRA_FLAG "-Wno-extra" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
36 append_if(OPENMP_HAVE_WPEDANTIC_FLAG "-Wno-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
37 append_if(OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)