[all-commits] [llvm/llvm-project] 9a92f2: Make diagnostic pragma override -Werror=foo and De...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Jun 14 09:57:43 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a92f2f742347d9b31470349f3b777ecab580ac1
      https://github.com/llvm/llvm-project/commit/9a92f2f742347d9b31470349f3b777ecab580ac1
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-06-14 (Fri, 14 Jun 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/docs/UsersManual.rst
    M clang/lib/Basic/Diagnostic.cpp
    M clang/test/Modules/Inputs/implicit-built-Werror-using-W/convert.h
    M clang/test/Modules/implicit-built-Werror-using-W.cpp
    M clang/test/Preprocessor/pragma_diagnostic.c
    M clang/test/Sema/implicit-decl.c

  Log Message:
  -----------
  Make diagnostic pragma override -Werror=foo and DefaultError warnings

In GCC, `#pragma GCC diagnostic warning "-Wfoo"` overrides command-line
`-Werror=foo` and errors that can become warnings (pedwarn with
-pedantic-errors and permerror).

```
#pragma GCC diagnostic warning "-Wnarrowing"
int x = {4.2};
#pragma GCC diagnostic warning "-Wundef"
#if FOO
#endif

// gcc -c -Werror=undef -Werror=narrowing => two warnings
```

These diagnostics are similar to our Warning/ExtWarn/Extension
diagnostics with DefaultError. This patch ports the behavior to Clang.

Fix #93474

Pull Request: https://github.com/llvm/llvm-project/pull/93647



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list