aaron.ballman added inline comments.
================ Comment at: clang/lib/Lex/PPDirectives.cpp:621 + if (CondInfo.FoundElse) + Diag(Tok, diag::pp_err_elif_after_else) << (IsElifDef ? 1 : 2); + ---------------- erichkeane wrote: > As you know, I'm a giant fan of using enums for cases like this, so it would > be my preference to have something like that. Sadly it looks like it would > have to be file-level here instead of functionlevel like is most convenient. Given that all the diagnostics are in the same file, I suppose that's fine. ================ Comment at: clang/test/Preprocessor/elifdef.c:71 + +/* expected-error@+3 {{#elifdef after #else}} */ +#ifdef FOO ---------------- erichkeane wrote: > Are there any tests you could do to make sure this 'works'? That is: > > #define BAR > // expected-error@+3 {{"AN ERROR!"}} > #ifdef FOO > #elifdef BAR > #error "AN ERROR!" > #endif > > AND > > // no error expected here! > #ifdef FOO > #elifndef BAR > #error "AN ERROR!" > #endif > > And perhaps... > > // expected-error@+4 {{"AN ERROR AGAIN!"}} > #ifdef FOO > #elifdef BAR > #else > #error "AN ERROR AGAIN!" > #endif > > I think the first test is what's on lines 63-69, the third is what's on lines 43-47, but I'll add the second test because I don't think that's covered yet. Thanks for the suggestion! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D101192/new/ https://reviews.llvm.org/D101192 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits