[PATCH] D134654: [clang] Detect header loops

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 30 10:11:25 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/test/Preprocessor/warn-loop-macro-1.h:3
+#define LOOP_MACRO_1
+// expected-warning at +1 {{#include cycle}}
+#include "warn-loop-macro-1.h"
----------------
aaron.ballman wrote:
> For example, as a user, I would look at this diagnostic and assume the compiler is wrong -- "There's no cycle there, the header guard macro protects me against it being a cycle." is not an unreasonable way to view this code.
I believe our 'include breadcrumbs notes' are printed differently: 

[ekeane1 at scsel-clx-24 build]$ ./bin/clang -cc1 c.cpp
In file included from c.cpp:1:
In file included from ./b.h:1:
./a.h:1:2: error: "FOO"
#error "FOO"
 ^
1 error generated.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134654/new/

https://reviews.llvm.org/D134654



More information about the cfe-commits mailing list