[all-commits] [llvm/llvm-project] e546bb: [lldb] Fix detecting warning options for GCC

Martin Storsjö via All-commits all-commits at lists.llvm.org
Wed Apr 6 12:50:41 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e546bbfda0ab91cf78c096d8c035851cc7c3b9f3
      https://github.com/llvm/llvm-project/commit/e546bbfda0ab91cf78c096d8c035851cc7c3b9f3
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-04-06 (Wed, 06 Apr 2022)

  Changed paths:
    M lldb/cmake/modules/LLDBConfig.cmake

  Log Message:
  -----------
  [lldb] Fix detecting warning options for GCC

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 lldb source file that
produces build warnings with GCC:

    At global scope:
    cc1plus: warning: unrecognized command line option ‘-Wno-vla-extension’
    cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-register’

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)

Differential Revision: https://reviews.llvm.org/D123202


  Commit: ae2aa2d21b24a912314e618d1ceb8e036449b0b1
      https://github.com/llvm/llvm-project/commit/ae2aa2d21b24a912314e618d1ceb8e036449b0b1
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-04-06 (Wed, 06 Apr 2022)

  Changed paths:
    M lldb/source/Breakpoint/Breakpoint.cpp
    M lldb/source/Core/DebuggerEvents.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp

  Log Message:
  -----------
  [lldb] Silence GCC warnings about missing returns after fully covered switches. NFC.

This silences warnings like this:

lldb/source/Core/DebuggerEvents.cpp: In member function ‘llvm::StringRef lldb_private::DiagnosticEventData::GetPrefix() const’:
lldb/source/Core/DebuggerEvents.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type]
   55 | }

Differential Revision: https://reviews.llvm.org/D123203


  Commit: 6e38824221db2e0d77d334d424331b3cf1ac279a
      https://github.com/llvm/llvm-project/commit/6e38824221db2e0d77d334d424331b3cf1ac279a
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-04-06 (Wed, 06 Apr 2022)

  Changed paths:
    M lldb/source/Core/Debugger.cpp

  Log Message:
  -----------
  [lldb] Silence GCC/glibc warnings about ignoring the return value of write(). NFC.

This matches how another similar warning is silenced in
Host/posix/ProcessLauncherPosixFork.cpp.

Differential Revision: https://reviews.llvm.org/D123205


Compare: https://github.com/llvm/llvm-project/compare/ee5fda1ff868...6e38824221db


More information about the All-commits mailing list