[PATCH] D124534: Add a warning diagnostic for line directive of a gnu extension
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 27 11:43:40 PDT 2022
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.
Thank you for working on this new diagnostic!
================
Comment at: clang-tools-extra/test/clang-apply-replacements/Inputs/crlf/crlf.cpp:1
-
-// This file intentionally uses a CRLF newlines!
-
-void foo() {
- int *x = 0;
-}
+
+// This file intentionally uses a CRLF newlines!
----------------
I think this file (and the next one) are making unintended line ending changes and should be reverted.
================
Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:430
+def warn_pp_gnu_ext_line_directive : Warning<"style of line directive is a GNU extension">;
+
----------------
Tweaking for grammar, but mostly, this should be marked as an `Extension` rather than a `Warning` so that it's controlled only via `-pedantic` rather than another warning group.
================
Comment at: clang/test/Misc/warning-flags.c:21
-CHECK: Warnings without flags (67):
+CHECK: Warnings without flags (68):
----------------
Once you make the diagnostic an extension, the changes to this file can be reverted. (It's worth noting that two lines above we document that this list should not grow.)
================
Comment at: clang/test/Preprocessor/line-directive.c:31
+# 42 // expected-warning {{style of line directive is a GNU extension}}
# 42 "foo"
# 42 "foo" 2 // expected-error {{invalid line marker flag '2': cannot pop empty include stack}}
----------------
This should get the same diagnostic.
================
Comment at: clang/test/Preprocessor/line-directive.c:33
# 42 "foo" 2 // expected-error {{invalid line marker flag '2': cannot pop empty include stack}}
# 42 "foo" 1 3 // enter
# 42 "foo" 2 3 // exit
----------------
As should this form.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124534/new/
https://reviews.llvm.org/D124534
More information about the cfe-commits
mailing list