[all-commits] [llvm/llvm-project] 10be0a: [clang] Allow -Wno-error=X to downgrade -pedantic-...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Fri Apr 17 02:42:59 PDT 2026
Branch: refs/heads/release/22.x
Home: https://github.com/llvm/llvm-project
Commit: 10be0a2552059450b02e3a293e39cab034882ba6
https://github.com/llvm/llvm-project/commit/10be0a2552059450b02e3a293e39cab034882ba6
Author: Fangrui Song <i at maskray.me>
Date: 2026-04-17 (Fri, 17 Apr 2026)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Basic/DiagnosticIDs.cpp
M clang/test/Misc/diag-mapping.c
Log Message:
-----------
[clang] Allow -Wno-error=X to downgrade -pedantic-errors diagnostics to warnings (#184756)
While -Wno-long-long suppresses -pedantic-errors diagnostics in both GCC
and Clang, GCC -Wno-error=long-long emits warnings while Clang still
emits errors.
```
% echo 'long long x = 0;' | gcc -std=c89 -pedantic-errors -Wno-error=long-long -x c -fsyntax-only -
<stdin>:1:6: warning: ISO C90 does not support 'long long' [-Wlong-long]
% echo 'long long x = 0;' | clang -std=c89 -pedantic-errors -Wno-error=long-long -x c -fsyntax-only -
<stdin>:1:1: error: 'long long' is an extension when C99 mode is not enabled [-Werror,-Wlong-long]
1 | long long x = 0;
| ^
1 error generated.
```
The order of -pedantic-errors and -Wno-error=long-long does not matter.
Change Clang -Wno-error=long-long to match GCC behavior and be more
consistent with -Wno-long-long. setDiagnosticGroupWarningAsError() sets
HasNoWarningAsError but not IsUser, so the ExtBehavior upgrade would
re-promote to error. When HasNoWarningAsError is set, cap the
ExtBehavior upgrade at Warning.
```
% echo 'long long x = 0;' | myclang -std=c89 -pedantic-errors -Wno-error=long-long -x c -fsyntax-only -
<stdin>:1:1: warning: 'long long' is an extension when C99 mode is not enabled [-Wlong-long]
1 | long long x = 0;
| ^
1 warning generated.
```
Fixes https://github.com/llvm/llvm-project/issues/184250
(cherry picked from commit a195c719aa96c491ea52bbb8b9e496d2cd6c8445)
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