[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 10 10:07:26 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/test/Preprocessor/line-directive-system-headers.c:1-2
+// RUN: %clang_cc1 -std=c99 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -std=c99 -fsyntax-only -pedantic -verify=system -Wsystem-headers %s
+
----------------
There's nothing specific to C99 that I can see in the test, so I think these can be dropped.


================
Comment at: clang/test/Preprocessor/line-directive-system-headers.c:19-21
+# 42 "foo" 2 3 4
+// expected-error at -1 {{invalid line marker flag '2': cannot pop empty include stack}}
+// system-error at -2 {{invalid line marker flag '2': cannot pop empty include stack}}
----------------
Might as well make this consistent with the other parts of the test and use `@#6` instead of `@-1`. Same applies elsewhere.


================
Comment at: clang/test/Preprocessor/line-directive-system-headers.c:40-50
+// no expected warning.
+// system-warning@#8 {{this style of line directive is a GNU extension}}
+typedef int y;
+// no expected warning.
+// system-note at -2 {{previous definition is here}}
+typedef int y;
+// no expected warning.
----------------
Let's change "no expected warning" into "Warnings silenced when -Wsystem-headers isn't passed." so it sounds less like "we don't expect the warning directly below this comment to happen".


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