Add returns_nonnull attribute

This commit is contained in:
christos 2021-08-19 08:59:22 +00:00
parent 472678eee7
commit 63c7e539ee
2 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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),