[clang] [clang-tools-extra] Suppress pedantic diagnostic for a file not ending in EOL (PR #131794)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 18 06:16:01 PDT 2025
================
@@ -3194,18 +3194,12 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) {
SourceLocation EndLoc = getSourceLocation(BufferEnd);
unsigned DiagID = diag::warn_no_newline_eof;
- if (LangOpts.CPlusPlus11) {
- // C++11 [lex.phases] 2.2 p2
- // Prefer the C++98 pedantic compatibility warning over the generic,
- // non-extension, user-requested "missing newline at EOF" warning.
- if (!Diags.isIgnored(diag::warn_cxx98_compat_no_newline_eof, EndLoc))
- DiagID = diag::warn_cxx98_compat_no_newline_eof;
- } else {
- // This is conforming in C2y, but is an extension in earlier language
- // modes.
- if (!LangOpts.C2y)
- DiagID = diag::ext_no_newline_eof;
- }
+ // C++11 [lex.phases] 2.2 p2
+ // Prefer the C++98 pedantic compatibility warning over the generic,
+ // non-extension, user-requested "missing newline at EOF" warning.
+ if (LangOpts.CPlusPlus11 &&
----------------
erichkeane wrote:
It isn't clear what the status of this in C++98 actually is, right? I guess this is before WG21 was all crazy about everything-as-a-DR so we don't have much guidance here from them, but it feels DR-ish for both.
https://github.com/llvm/llvm-project/pull/131794
More information about the cfe-commits
mailing list