diff options
| author | christos <christos@NetBSD.org> | 2021-09-17 20:17:30 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2021-09-17 20:17:30 +0000 |
| commit | 3cdf8754af7457fdf26fede69ee774ac62251ed3 (patch) | |
| tree | 624a00ee3d09ea46feaee57f8004f7df3d21d7bd | |
| parent | 63f8a1653e60cbec842f936ceb40e8f43d0d64d2 (diff) | |
remove the lint kludges
| -rw-r--r-- | usr.bin/xlint/lint1/cgram.y | 12 | ||||
| -rw-r--r-- | usr.bin/xlint/lint1/lex.c | 5 |
2 files changed, 13 insertions, 4 deletions
diff --git a/usr.bin/xlint/lint1/cgram.y b/usr.bin/xlint/lint1/cgram.y index 6c465122037..0812735e45b 100644 --- a/usr.bin/xlint/lint1/cgram.y +++ b/usr.bin/xlint/lint1/cgram.y @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.364 2021/09/14 19:44:40 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.365 2021/09/17 20:17:30 christos Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.364 2021/09/14 19:44:40 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.365 2021/09/17 20:17:30 christos Exp $"); #endif #include <limits.h> @@ -211,6 +211,7 @@ anonymize(sym_t *s) %token T_SWITCH %token T_SYMBOLRENAME %token T_WHILE +%token T_STATIC_ASSERT %token T_ATTRIBUTE %token T_AT_ALIAS @@ -761,6 +762,7 @@ declaration: /* C99 6.7 */ } | begin_type_declaration_specifiers end_type type_init_declarators T_SEMI + | static_assert_declaration ; begin_type_declaration_specifiers: /* see C99 6.7 */ @@ -993,6 +995,7 @@ struct_declaration: /* C99 6.7.2.1 */ $$ = NULL; } } + | static_assert_declaration | error T_SEMI { symtyp = FVFT; $$ = NULL; @@ -1567,6 +1570,11 @@ designator: /* C99 6.7.8 "Initialization" */ } ; +static_assert_declaration: + T_STATIC_ASSERT T_LPAREN constant_expr T_COMMA T_STRING T_RPAREN T_SEMI + | T_STATIC_ASSERT T_LPAREN constant_expr T_RPAREN T_SEMI + ; + range: constant_expr { $$.lo = to_int_constant($1, true); diff --git a/usr.bin/xlint/lint1/lex.c b/usr.bin/xlint/lint1/lex.c index 5852dc08ed6..6b7990f121f 100644 --- a/usr.bin/xlint/lint1/lex.c +++ b/usr.bin/xlint/lint1/lex.c @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.81 2021/09/05 16:03:55 rillig Exp $ */ +/* $NetBSD: lex.c,v 1.82 2021/09/17 20:17:30 christos Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: lex.c,v 1.81 2021/09/05 16:03:55 rillig Exp $"); +__RCSID("$NetBSD: lex.c,v 1.82 2021/09/17 20:17:30 christos Exp $"); #endif #include <ctype.h> @@ -217,6 +217,7 @@ static struct kwtab { kwdef_type( "signed", SIGNED, 1,0,0,0,3), kwdef_keyword( "sizeof", T_SIZEOF), kwdef_sclass( "static", STATIC, 0,0,0,0,1), + kwdef_keyword( "_Static_assert",T_STATIC_ASSERT), kwdef_gcc_attr( "strfmon", T_AT_FORMAT_STRFMON), kwdef_gcc_attr( "strftime", T_AT_FORMAT_STRFTIME), kwdef_gcc_attr( "string", T_AT_STRING), |
