[Openmp-commits] [openmp] r242604 - [cmake] Support enabling -Werror in the OpenMP runtime CMake build and

Chandler Carruth chandlerc at gmail.com
Fri Jul 17 20:16:17 PDT 2015


Hey Hans, Jonathan;

This seems like it might be a good candidate for merging into the release.

On Fri, Jul 17, 2015 at 8:14 PM Chandler Carruth <chandlerc at gmail.com>
wrote:

> Author: chandlerc
> Date: Fri Jul 17 22:14:02 2015
> New Revision: 242604
>
> URL: http://llvm.org/viewvc/llvm-project?rev=242604&view=rev
> Log:
> [cmake] Support enabling -Werror in the OpenMP runtime CMake build and
> clean up the build.
>
> This disables all of the Clang warnings that fire for me when building
> libomp.so on Linux with a recent Clang binary. Lots of these should
> probably be fixed, but I want to at least get the build warning-clean
> and make it easy to keep that way.
>
> I also switched a bunch of the warnings that are used both for C and C++
> compiles to check the flag with C compilation test.
>
> Differential Revision: http://reviews.llvm.org/D11253
>
> Modified:
>     openmp/trunk/runtime/CMakeLists.txt
>     openmp/trunk/runtime/cmake/LibompHandleFlags.cmake
>     openmp/trunk/runtime/cmake/config-ix.cmake
>
> Modified: openmp/trunk/runtime/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/CMakeLists.txt?rev=242604&r1=242603&r2=242604&view=diff
>
> ==============================================================================
> --- openmp/trunk/runtime/CMakeLists.txt (original)
> +++ openmp/trunk/runtime/CMakeLists.txt Fri Jul 17 22:14:02 2015
> @@ -41,6 +41,8 @@ if(${LIBOMP_STANDALONE_BUILD})
>    # Should assertions be enabled?  They are on by default.
>    set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL
>      "enable assertions?")
> +  set(LIBOMP_ENABLE_WERROR FALSE CACHE BOOL
> +    "Enable -Werror flags to turn warnings into errors for supporting
> compilers.")
>    # CMAKE_BUILD_TYPE was not defined, set default to Release
>    if(NOT CMAKE_BUILD_TYPE)
>      set(CMAKE_BUILD_TYPE Release)
> @@ -73,6 +75,7 @@ else() # Part of LLVM build
>    endif ()
>    set(LIBOMP_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
>    set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS})
> +  set(LIBOMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
>  endif()
>  libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le
> aarch64 mic)
>
>
> Modified: openmp/trunk/runtime/cmake/LibompHandleFlags.cmake
> URL:
> http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/cmake/LibompHandleFlags.cmake?rev=242604&r1=242603&r2=242604&view=diff
>
> ==============================================================================
> --- openmp/trunk/runtime/cmake/LibompHandleFlags.cmake (original)
> +++ openmp/trunk/runtime/cmake/LibompHandleFlags.cmake Fri Jul 17 22:14:02
> 2015
> @@ -28,10 +28,25 @@ function(libomp_get_c_and_cxxflags_commo
>    set(flags_local)
>    libomp_append(flags_local -std=c++11 LIBOMP_HAVE_STD_CPP11_FLAG)
>    libomp_append(flags_local -fno-exceptions
> LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG)
> -  libomp_append(flags_local -Wsign-compare LIBOMP_HAVE_WSIGN_COMPARE_FLAG)
> +  if(${LIBOMP_ENABLE_WERROR})
> +    libomp_append(flags_local -Werror LIBOMP_HAVE_WERROR_FLAG)
> +  endif()
> +  libomp_append(flags_local -Wno-sign-compare
> LIBOMP_HAVE_WNO_SIGN_COMPARE_FLAG)
> +  libomp_append(flags_local -Wno-unused-function
> LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG)
> +  libomp_append(flags_local -Wno-unused-local-typedef
> LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG)
>    libomp_append(flags_local -Wno-unused-value
> LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG)
> +  libomp_append(flags_local -Wno-unused-variable
> LIBOMP_HAVE_WNO_UNUSED_VARIABLE_FLAG)
>    libomp_append(flags_local -Wno-switch LIBOMP_HAVE_WNO_SWITCH_FLAG)
> +  libomp_append(flags_local -Wno-covered-switch-default
> LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG)
>    libomp_append(flags_local -Wno-deprecated-register
> LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG)
> +  libomp_append(flags_local -Wno-gnu-anonymous-struct
> LIBOMP_HAVE_WNO_GNU_ANONYMOUS_STRUCT_FLAG)
> +  libomp_append(flags_local -Wno-unknown-pragmas
> LIBOMP_HAVE_WNO_UNKNOWN_PRAGMAS_FLAG)
> +  libomp_append(flags_local -Wno-missing-field-initializers
> LIBOMP_HAVE_WNO_MISSING_FIELD_INITIALIZERS_FLAG)
> +  libomp_append(flags_local -Wno-missing-braces
> LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG)
> +  libomp_append(flags_local -Wno-comment LIBOMP_HAVE_WNO_COMMENT_FLAG)
> +  libomp_append(flags_local -Wno-self-assign
> LIBOMP_HAVE_WNO_SELF_ASSIGN_FLAG)
> +  libomp_append(flags_local -Wno-vla-extension
> LIBOMP_HAVE_WNO_VLA_EXTENSION_FLAG)
> +  libomp_append(flags_local -Wno-format-pedantic
> LIBOMP_HAVE_WNO_FORMAT_PEDANTIC_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)
>
> Modified: openmp/trunk/runtime/cmake/config-ix.cmake
> URL:
> http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/cmake/config-ix.cmake?rev=242604&r1=242603&r2=242604&view=diff
>
> ==============================================================================
> --- openmp/trunk/runtime/cmake/config-ix.cmake (original)
> +++ openmp/trunk/runtime/cmake/config-ix.cmake Fri Jul 17 22:14:02 2015
> @@ -48,12 +48,25 @@ endfunction()
>  check_cxx_compiler_flag(-std=c++11 LIBOMP_HAVE_STD_CPP11_FLAG)
>  check_cxx_compiler_flag(-fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG)
>  check_c_compiler_flag("-x c++" LIBOMP_HAVE_X_CPP_FLAG)
> -check_cxx_compiler_flag(-Wunused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG)
> -check_cxx_compiler_flag(-Wswitch LIBOMP_HAVE_WNO_SWITCH_FLAG)
> -check_cxx_compiler_flag(-Wdeprecated-register
> LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG)
> -check_cxx_compiler_flag(-Wsign-compare LIBOMP_HAVE_WSIGN_COMPARE_FLAG)
> -check_cxx_compiler_flag(-msse2 LIBOMP_HAVE_MSSE2_FLAG)
> -check_cxx_compiler_flag(-ftls-model=initial-exec
> LIBOMP_HAVE_FTLS_MODEL_FLAG)
> +check_c_compiler_flag(-Werror LIBOMP_HAVE_WERROR_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(-msse2 LIBOMP_HAVE_MSSE2_FLAG)
> +check_c_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)
>
>
> _______________________________________________
> Openmp-commits mailing list
> Openmp-commits at dcs-maillist2.engr.illinois.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/openmp-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20150718/95d78855/attachment.html>


More information about the Openmp-commits mailing list