ken-matsui added a comment. After some investigations, some directives behave weirdly. I will continue investigating, but do you have any suggestions here?
================ 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 ---------------- aaron.ballman wrote: > Something is still not quite correct -- these should also be diagnosed as an > extension (it's the same feature just with flags). This didn't cause a warning on this test file, but another test file I created caused a warning. ``` // RUN: %clang_cc1 -std=c99 -fsyntax-only -verify -pedantic %s # 42 "foo" 1 3 // enter: expected-warning {{this style of line directive is a GNU extension}} ``` ================ Comment at: clang/test/Preprocessor/line-directive.c:61 # 192 "glomp.h" 3 // System header. typedef int y; // ok ---------------- aaron.ballman wrote: > This should also be diagnosed. This directive didn't cause a warning when marking both `# 192 "glomp.h"` and this. Marking only either directive works. Works: ``` ... # 192 "glomp.h" // not a system header.: expected-warning {{this style of line directive is a GNU extension}} typedef int x; // expected-note {{previous definition is here}} typedef int x; // expected-warning {{redefinition of typedef 'x' is a C11 feature}} # 192 "glomp.h" 3 // System header. ... ``` Works: ``` ... # 192 "glomp.h" // not a system header. typedef int x; // expected-note {{previous definition is here}} typedef int x; // expected-warning {{redefinition of typedef 'x' is a C11 feature}} # 192 "glomp.h" 3 // System header.: expected-warning {{this style of line directive is a GNU extension}} ... ``` Does NOT work: ``` ... # 192 "glomp.h" // not a system header.: expected-warning {{this style of line directive is a GNU extension}} typedef int x; // expected-note {{previous definition is here}} typedef int x; // expected-warning {{redefinition of typedef 'x' is a C11 feature}} # 192 "glomp.h" 3 // System header.: expected-warning {{this style of line directive is a GNU extension}} ... ``` ``` Command Output (stderr): -- error: 'warning' diagnostics expected but not seen: File /tmp/llvm/llvm-project/clang/test/Preprocessor/line-directive.c Line 191: this style of line directive is a GNU extension 1 error generated. ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits