Module Name: src
Committed By: christos
Date: Thu Aug 19 08:59:22 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: cgram.y lex.c
Log Message:
Add returns_nonnull attribute
To generate a diff of this commit:
cvs rdiff -u -r1.355 -r1.356 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.62 -r1.63 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.355 src/usr.bin/xlint/lint1/cgram.y:1.356
--- src/usr.bin/xlint/lint1/cgram.y:1.355 Wed Aug 11 01:19:32 2021
+++ src/usr.bin/xlint/lint1/cgram.y Thu Aug 19 04:59:22 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.355 2021/08/11 05:19:32 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.356 2021/08/19 08:59:22 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.355 2021/08/11 05:19:32 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.356 2021/08/19 08:59:22 christos Exp $");
#endif
#include <limits.h>
@@ -248,6 +248,7 @@ anonymize(sym_t *s)
%token T_AT_PACKED
%token T_AT_PCS
%token T_AT_PURE
+%token T_AT_RETURNS_NONNULL
%token T_AT_RETURNS_TWICE
%token T_AT_SECTION
%token T_AT_SENTINEL
@@ -2076,6 +2077,7 @@ gcc_attribute_spec:
}
| T_AT_PCS T_LPAREN string T_RPAREN
| T_AT_PURE
+ | T_AT_RETURNS_NONNULL
| T_AT_RETURNS_TWICE
| T_AT_SECTION T_LPAREN string T_RPAREN
| T_AT_SENTINEL T_LPAREN constant_expr T_RPAREN
Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.62 src/usr.bin/xlint/lint1/lex.c:1.63
--- src/usr.bin/xlint/lint1/lex.c:1.62 Sun Aug 1 04:03:43 2021
+++ src/usr.bin/xlint/lint1/lex.c Thu Aug 19 04:59:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.62 2021/08/01 08:03:43 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.63 2021/08/19 08:59:22 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.62 2021/08/01 08:03:43 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.63 2021/08/19 08:59:22 christos Exp $");
#endif
#include <ctype.h>
@@ -204,6 +204,7 @@ static struct kwtab {
kwdef_sclass( "register", REG, 0,0,0,0,1),
kwdef_tqual( "restrict", RESTRICT, 0,1,0,0,5),
kwdef_keyword( "return", T_RETURN),
+ kwdef_gcc_attr( "returns_nonnull",T_AT_RETURNS_NONNULL),
kwdef_gcc_attr( "returns_twice",T_AT_RETURNS_TWICE),
kwdef_gcc_attr( "scanf", T_AT_FORMAT_SCANF),
kwdef_token( "section", T_AT_SECTION, 0,0,1,1,7),