Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 Add attribute fallthrough
details: https://anonhg.NetBSD.org/src/rev/111339574484
branches: trunk
changeset: 961215:111339574484
user: christos <christos%NetBSD.org@localhost>
date: Mon Apr 12 15:55:26 2021 +0000
description:
Add attribute fallthrough
diffstat:
usr.bin/xlint/lint1/cgram.y | 12 +++++++++---
usr.bin/xlint/lint1/lex.c | 5 +++--
2 files changed, 12 insertions(+), 5 deletions(-)
diffs (81 lines):
diff -r 1b67fb264fec -r 111339574484 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Mon Apr 12 15:54:55 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Mon Apr 12 15:55:26 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.211 2021/04/02 12:16:50 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.212 2021/04/12 15:55:26 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.211 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.212 2021/04/12 15:55:26 christos Exp $");
#endif
#include <limits.h>
@@ -218,6 +218,7 @@
%token <y_type> T_AT_CONSTRUCTOR
%token <y_type> T_AT_DEPRECATED
%token <y_type> T_AT_DESTRUCTOR
+%token <y_type> T_AT_FALLTHROUGH
%token <y_type> T_AT_FORMAT
%token <y_type> T_AT_FORMAT_ARG
%token <y_type> T_AT_FORMAT_GNU_PRINTF
@@ -595,6 +596,9 @@
| T_AT_WARN_UNUSED_RESULT
| T_AT_WEAK
| T_AT_VISIBILITY T_LPAREN constant_expr T_RPAREN
+ | T_AT_FALLTHROUGH {
+ fallthru(1);
+ }
| T_QUAL {
if ($1 != CONST)
yyerror("Bad attribute");
@@ -1490,7 +1494,8 @@
;
non_expr_statement:
- labeled_statement
+ type_attribute T_SEMI
+ | labeled_statement
| compound_statement
| selection_statement
| iteration_statement
@@ -1498,6 +1503,7 @@
seen_fallthrough = false;
}
| asm_statement
+ ;
statement: /* C99 6.8 */
expr_statement
diff -r 1b67fb264fec -r 111339574484 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Mon Apr 12 15:54:55 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Mon Apr 12 15:55:26 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.26 2021/04/09 15:58:43 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.27 2021/04/12 15:55:26 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.26 2021/04/09 15:58:43 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.27 2021/04/12 15:55:26 christos Exp $");
#endif
#include <ctype.h>
@@ -169,6 +169,7 @@
kwdef_token( "enum", T_ENUM, 0,0,0,0,1),
kwdef_token( "extension", T_EXTENSION, 0,0,1,0,4),
kwdef_sclass( "extern", EXTERN, 0,0,0,0,1),
+ kwdef_token( "fallthrough", T_AT_FALLTHROUGH, 0,0,1,1,5),
kwdef_type( "float", FLOAT, 0,0,0,0,1),
kwdef_token( "for", T_FOR, 0,0,0,0,1),
kwdef_token( "format", T_AT_FORMAT, 0,0,1,1,5),
Home |
Main Index |
Thread Index |
Old Index