add warn_unused_result.

This commit is contained in:
christos 2018-11-24 13:10:20 +00:00
parent 201b0ce72c
commit 51c91e52e5
2 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: cgram.y,v 1.98 2018/09/03 15:16:33 christos Exp $ */
/* $NetBSD: cgram.y,v 1.99 2018/11/24 13:10:20 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.98 2018/09/03 15:16:33 christos Exp $");
__RCSID("$NetBSD: cgram.y,v 1.99 2018/11/24 13:10:20 christos Exp $");
#endif
#include <stdlib.h>
@ -234,6 +234,7 @@ anonymize(sym_t *s)
%token <y_type> T_AT_UNUSED
%token <y_type> T_AT_USED
%token <y_type> T_AT_VISIBILITY
%token <y_type> T_AT_WARN_UNUSED_RESULT
%token <y_type> T_AT_WEAK
%left T_COMMA
@ -561,6 +562,7 @@ type_attribute_spec:
| T_AT_UNUSED {
addused();
}
| T_AT_WARN_UNUSED_RESULT
| T_AT_WEAK
| T_AT_VISIBILITY T_LPARN constant T_RPARN
| T_QUAL {

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: scan.l,v 1.84 2018/10/07 14:20:01 christos Exp $ */
/* $NetBSD: scan.l,v 1.85 2018/11/24 13:10:20 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: scan.l,v 1.84 2018/10/07 14:20:01 christos Exp $");
__RCSID("$NetBSD: scan.l,v 1.85 2018/11/24 13:10:20 christos Exp $");
#endif
#include <stdlib.h>
@ -291,6 +291,7 @@ static struct kwtab {
{ "visibility", T_AT_VISIBILITY,0, 0, 0, 0,0,1,1,5 },
{ "void", T_TYPE, 0, VOID, 0, 0,0,0,0,1 },
{ "volatile", T_QUAL, 0, 0, VOLATILE, 1,0,0,0,7 },
{ "warn_unused_result", T_AT_WARN_UNUSED_RESULT, 0, 0, 0, 0,0,1,1,5 },
{ "weak", T_AT_WEAK, 0, 0, 0, 0,0,1,1,5 },
{ "while", T_WHILE, 0, 0, 0, 0,0,0,0,1 },
{ NULL, 0, 0, 0, 0, 0,0,0,0,0 }