diff options
| author | 2025-11-22 11:01:46 +0100 | |
|---|---|---|
| committer | 2025-11-22 12:26:29 +0100 | |
| commit | 4444c247ea8b906f511864bcfb3ce62ed9653ba3 (patch) | |
| tree | 5da1018b83f384927b0f02f486cfe4d34c13730e /c/c.c | |
| parent | c2f9d128ecd15c9f285426b4e7b9bc2cd3d53732 (diff) | |
c: move warning for extension keyword til after preprocessor
Diffstat (limited to 'c/c.c')
| -rw-r--r-- | c/c.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -9,8 +9,8 @@ static int lexc(struct comp *cm, struct token *tk) { - struct token tk2; - int t = lex(cm->lx, tk); + struct token tk2, tk_[1]; + int t = lex(cm->lx, tk ? tk : tk_); if (t == TKSTRLIT && peek(cm, &tk2) == TKSTRLIT && tk2.wide == tk->wide) { /* 5.1.1.2 Translation phase 6: concatenate adjacent string literal tokens */ static char buf[200]; @@ -44,6 +44,13 @@ lexc(struct comp *cm, struct token *tk) } vfree(&rest); } + if (in_range(t, TKWBEGIN_, TKWEND_) && (tk = tk ? tk : tk_)->extwarn) { + static struct bitset already[BSSIZE(TKWEND_-TKWBEGIN_+1)]; + if (!bstest(already, t-TKWBEGIN_)) { + bsset(already, t-TKWBEGIN_); + warn(&tk->span, "%'tk in %M is an extension", tk); + } + } return t; } #define lex(Cm,Tk) lexc(Cm,Tk) |