summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-23 08:53:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-23 08:53:38 +0000
commitf54c63e14f2411f22311340e2670fda1054f694e (patch)
tree5839094f5aa978bb87e57db26be23eb8632365b3
parent6a45a0cd4eeb4980b559bb6568c7f5803464962e (diff)
support __attribute__
-rw-r--r--usr.bin/xlint/lint1/cgram.y18
-rw-r--r--usr.bin/xlint/lint1/scan.l5
2 files changed, 14 insertions, 9 deletions
diff --git a/usr.bin/xlint/lint1/cgram.y b/usr.bin/xlint/lint1/cgram.y
index 83e81ccb118..61a98296e2c 100644
--- a/usr.bin/xlint/lint1/cgram.y
+++ b/usr.bin/xlint/lint1/cgram.y
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: cgram.y,v 1.5 2003/11/08 19:17:29 jmc Exp $ */
+/* $OpenBSD: cgram.y,v 1.6 2005/11/23 08:53:37 deraadt Exp $ */
/* $NetBSD: cgram.y,v 1.8 1995/10/02 17:31:35 jpo Exp $ */
/*
@@ -34,7 +34,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: cgram.y,v 1.5 2003/11/08 19:17:29 jmc Exp $";
+static char rcsid[] = "$OpenBSD: cgram.y,v 1.6 2005/11/23 08:53:37 deraadt Exp $";
#endif
#include <stdlib.h>
@@ -130,6 +130,7 @@ static void ignuptorp(void);
%token T_BREAK
%token T_RETURN
%token T_ASM
+%token T_ATTRIBUTE
%left T_COMMA
%right T_ASSIGN T_OPASS
@@ -277,7 +278,7 @@ data_def:
warning(2);
}
}
- | declspecs deftyp type_init_decls T_SEMI
+ | declspecs deftyp type_init_decls opt_attribute_spec T_SEMI
| error T_SEMI {
globclup();
}
@@ -312,6 +313,11 @@ func_def:
}
;
+opt_attribute_spec:
+ /* empty */
+ | T_ATTRIBUTE T_LPARN T_LPARN read_until_rparn T_RPARN
+ ;
+
func_decl:
clrtyp deftyp notype_decl {
$$ = $3;
@@ -758,7 +764,7 @@ type_init_decls:
;
notype_init_decl:
- notype_decl opt_asm_spec {
+ notype_decl opt_attribute_spec opt_asm_spec {
idecl($1, 0);
chksz($1);
}
@@ -1054,9 +1060,7 @@ parameter_declaration:
opt_asm_spec:
/* empty */
- | T_ASM T_LPARN T_STRING T_RPARN {
- freeyyv(&$3, T_STRING);
- }
+ | T_ASM T_LPARN read_until_rparn
;
initializer:
diff --git a/usr.bin/xlint/lint1/scan.l b/usr.bin/xlint/lint1/scan.l
index b50a9ee502d..856a3c45178 100644
--- a/usr.bin/xlint/lint1/scan.l
+++ b/usr.bin/xlint/lint1/scan.l
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: scan.l,v 1.7 2005/11/20 17:42:49 deraadt Exp $ */
+/* $OpenBSD: scan.l,v 1.8 2005/11/23 08:53:37 deraadt 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.7 2005/11/20 17:42:49 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: scan.l,v 1.8 2005/11/23 08:53:37 deraadt Exp $";
#endif
#include <stdlib.h>
@@ -191,6 +191,7 @@ static struct kwtab {
{ "asm", T_ASM, 0, 0, 0, 0, 1 },
{ "__asm", T_ASM, 0, 0, 0, 0, 0 },
{ "__asm__", T_ASM, 0, 0, 0, 0, 0 },
+ { "__attribute__", T_ATTRIBUTE, 0, 0, 0, 0, 0 },
{ "auto", T_SCLASS, AUTO, 0, 0, 0, 0 },
{ "break", T_BREAK, 0, 0, 0, 0, 0 },
{ "case", T_CASE, 0, 0, 0, 0, 0 },