================ @@ -3192,23 +3192,22 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) { DiagnosticsEngine &Diags = PP->getDiagnostics(); SourceLocation EndLoc = getSourceLocation(BufferEnd); - unsigned DiagID; + 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)) { + if (!Diags.isIgnored(diag::warn_cxx98_compat_no_newline_eof, EndLoc)) DiagID = diag::warn_cxx98_compat_no_newline_eof; - } else { - DiagID = diag::warn_no_newline_eof; - } } else { - DiagID = diag::ext_no_newline_eof; + // This is conforming in C2y, but is an extension in earlier language + // modes. + if (!LangOpts.C2y) + DiagID = diag::ext_no_newline_eof; ---------------- AaronBallman wrote:
Nope, WG14 has a list of such things and this paper isn't on the list: https://www.open-std.org/jtc1/sc22/wg14/www/previous.html https://github.com/llvm/llvm-project/pull/130180 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits