[Openmp-commits] [PATCH] D139922: [OpenMP] Fix detecting warning options for GCC

Martin Storsjö via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Dec 13 01:53:33 PST 2022


mstorsjo created this revision.
mstorsjo added reviewers: AndreyChurbanov, JonChesterfield, jdoerfert.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: OpenMP.

If testing for a warning option like -Wno-<foo> with GCC, GCC won't
print any diagnostic at all, leading to the options being accepted
incorrectly. However later, if compiling a file that actually prints
another warning, GCC will also print warnings about these -Wno-<foo>
options being unrecognized.

This avoids warning spam like this, for every OpenMP source file that
produces build warnings with GCC:

  cc1plus: warning: unrecognized command line option ‘-Wno-int-to-void-pointer-cast’
  cc1plus: warning: unrecognized command line option ‘-Wno-return-type-c-linkage’
  cc1plus: warning: unrecognized command line option ‘-Wno-covered-switch-default’
  cc1plus: warning: unrecognized command line option ‘-Wno-enum-constexpr-conversion’

This matches how such warning options are detected and added in
llvm/cmake/modules/HandleLLVMOptions.cmake, e.g. like this:

  check_cxx_compiler_flag("-Wclass-memaccess" CXX_SUPPORTS_CLASS_MEMACCESS_FLAG)
  append_if(CXX_SUPPORTS_CLASS_MEMACCESS_FLAG "-Wno-class-memaccess" CMAKE_CXX_FLAGS)

This also matches how LLDB warning options were restructured for
GCC compatibility in e546bbfda0ab91cf78c096d8c035851cc7c3b9f3 <https://reviews.llvm.org/rGe546bbfda0ab91cf78c096d8c035851cc7c3b9f3>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139922

Files:
  openmp/cmake/HandleOpenMPOptions.cmake
  openmp/cmake/config-ix.cmake
  openmp/runtime/cmake/LibompHandleFlags.cmake
  openmp/runtime/cmake/config-ix.cmake

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139922.482399.patch
Type: text/x-patch
Size: 8374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221213/63d739b6/attachment-0001.bin>


More information about the Openmp-commits mailing list