diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-12-03 00:27:55 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-12-03 00:27:55 +0000 |
commit | 1c6cd252eaeaeedbd87c69d5843ae9550b20ee91 (patch) | |
tree | faf71d00f151426fb577354f266f17fcf8ec09fb /usr.bin/xlint/lint1/scan.l | |
parent | b6d67a9b2dd73b1e8e23240c4212871b40b3d4fc (diff) |
Lint can now parse every variation of gcc's __attribute__ that I could find
either in our tree or in the gcc docs. See regression test 11 for examples
of this. Right now, our cdefs.h actually defines __attribute__(x) to blank
when lint runs. We can change this whenever we choose.
Diffstat (limited to 'usr.bin/xlint/lint1/scan.l')
-rw-r--r-- | usr.bin/xlint/lint1/scan.l | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/xlint/lint1/scan.l b/usr.bin/xlint/lint1/scan.l index 406b8cc1985..3b0ee0ed0b7 100644 --- a/usr.bin/xlint/lint1/scan.l +++ b/usr.bin/xlint/lint1/scan.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: scan.l,v 1.18 2005/12/02 18:03:09 cloder Exp $ */ +/* $OpenBSD: scan.l,v 1.19 2005/12/03 00:27:54 cloder Exp $ */ /* $NetBSD: scan.l,v 1.8 1995/10/23 13:38:51 jpo Exp $ */ /* @@ -34,7 +34,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: scan.l,v 1.18 2005/12/02 18:03:09 cloder Exp $"; +static char rcsid[] = "$OpenBSD: scan.l,v 1.19 2005/12/03 00:27:54 cloder Exp $"; #endif #include <stdlib.h> @@ -184,6 +184,7 @@ static struct kwtab { scl_t kw_scl; /* storage class if kw_token T_SCLASS */ tspec_t kw_tspec; /* type spec. if kw_token T_TYPE or T_SOU */ tqual_t kw_tqual; /* type qual. if kw_token T_QUAL */ + attr_t kw_attr; /* attribute spec. if kw_token T_ATTR */ }; u_int kw_stdc : 1; /* STDC keyword */ u_int kw_gcc : 1; /* GCC keyword */ @@ -191,6 +192,7 @@ static struct kwtab { { "asm", T_ASM, { 0 }, 0, 1 }, { "__asm", T_ASM, { 0 }, 0, 0 }, { "__asm__", T_ASM, { 0 }, 0, 0 }, + { "__attribute", T_ATTRIBUTE, { 0 }, 0, 0 }, { "__attribute__", T_ATTRIBUTE, { 0 }, 0, 0 }, { "auto", T_SCLASS, { AUTO }, 0, 0 }, { "break", T_BREAK, { 0 }, 0, 0 }, @@ -216,6 +218,7 @@ static struct kwtab { { "int", T_TYPE, { INT }, 0, 0 }, { "__lint_equal__", T_LEQUAL, { 0 }, 0, 0 }, { "long", T_TYPE, { LONG }, 0, 0 }, + { "__noreturn__", T_ATTR, { NORETURN }, 0, 1 }, { "register", T_SCLASS, { REG }, 0, 0 }, { "__restrict", T_QUAL, { RESTRICT }, 0, 0 }, { "__restrict__", T_QUAL, { RESTRICT }, 0, 0 }, @@ -285,6 +288,8 @@ initscan(void) sym->s_scl = kw->kw_scl; } else if (kw->kw_token == T_QUAL) { sym->s_tqual = kw->kw_tqual; + } else if (kw->kw_token == T_ATTR) { + sym->s_attr = kw->kw_attr; } h = hash(sym->s_name); if ((sym->s_link = symtab[h]) != NULL) @@ -437,6 +442,8 @@ keyw(sym_t *sym) yylval.y_tspec = sym->s_tspec; } else if (t == T_QUAL) { yylval.y_tqual = sym->s_tqual; + } else if (t == T_ATTR) { + yylval.y_attr = sym->s_attr; } return (t); } |