Module Name: src Committed By: christos Date: Fri Apr 30 19:46:24 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: cgram.y lex.c Log Message: - add nonstring attribute - allow attributes after labels (for unused) XXX: split the attributes into function, variable, etc attributes so that we don't accept all attributes in all places (only where they make sense) To generate a diff of this commit: cvs rdiff -u -r1.222 -r1.223 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.29 -r1.30 src/usr.bin/xlint/lint1/lex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.222 src/usr.bin/xlint/lint1/cgram.y:1.223 --- src/usr.bin/xlint/lint1/cgram.y:1.222 Thu Apr 29 13:11:30 2021 +++ src/usr.bin/xlint/lint1/cgram.y Fri Apr 30 15:46:24 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.222 2021/04/29 17:11:30 christos Exp $ */ +/* $NetBSD: cgram.y,v 1.223 2021/04/30 19:46:24 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.222 2021/04/29 17:11:30 christos Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.223 2021/04/30 19:46:24 christos Exp $"); #endif #include <limits.h> @@ -123,7 +123,7 @@ anonymize(sym_t *s) } %} -%expect 185 +%expect 189 %union { val_t *y_val; @@ -235,6 +235,7 @@ anonymize(sym_t *s) %token <y_type> T_AT_MODE %token <y_type> T_AT_NOINLINE %token <y_type> T_AT_NONNULL +%token <y_type> T_AT_NONSTRING %token <y_type> T_AT_NORETURN %token <y_type> T_AT_NOTHROW %token <y_type> T_AT_NO_INSTRUMENT_FUNCTION @@ -563,6 +564,7 @@ type_attribute_spec: | T_AT_SENTINEL | T_AT_FORMAT_ARG T_LPAREN constant_expr T_RPAREN | T_AT_NONNULL T_LPAREN constant_expr T_RPAREN + | T_AT_NONSTRING | T_AT_MODE T_LPAREN T_NAME T_RPAREN | T_AT_ALIAS T_LPAREN string T_RPAREN | T_AT_OPTIMIZE T_LPAREN string T_RPAREN @@ -1535,7 +1537,7 @@ statement: /* C99 6.8 */ ; labeled_statement: /* C99 6.8.1 */ - label statement + label opt_type_attribute statement ; label: Index: src/usr.bin/xlint/lint1/lex.c diff -u src/usr.bin/xlint/lint1/lex.c:1.29 src/usr.bin/xlint/lint1/lex.c:1.30 --- src/usr.bin/xlint/lint1/lex.c:1.29 Tue Apr 20 17:48:39 2021 +++ src/usr.bin/xlint/lint1/lex.c Fri Apr 30 15:46:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.29 2021/04/20 21:48:39 christos Exp $ */ +/* $NetBSD: lex.c,v 1.30 2021/04/30 19:46:24 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.29 2021/04/20 21:48:39 christos Exp $"); +__RCSID("$NetBSD: lex.c,v 1.30 2021/04/30 19:46:24 christos Exp $"); #endif #include <ctype.h> @@ -189,8 +189,8 @@ static struct kwtab { kwdef_token( "mode", T_AT_MODE, 0,0,1,1,5), kwdef_token( "no_instrument_function", T_AT_NO_INSTRUMENT_FUNCTION, 0,0,1,1,5), - kwdef_token( "nonnull", T_AT_NONNULL, 0,0,1,1,5), kwdef_token( "noinline", T_AT_NOINLINE, 0,0,1,1,5), + kwdef_token( "nonstring", T_AT_NONSTRING, 0,0,1,1,5), kwdef_token( "noreturn", T_AT_NORETURN, 0,0,1,1,5), kwdef_token( "nothrow", T_AT_NOTHROW, 0,0,1,1,5), kwdef_token( "optimize", T_AT_OPTIMIZE, 0,0,1,1,5),