add more attributes

This commit is contained in:
christos 2014-04-21 21:52:24 +00:00
parent c8008139a7
commit e305f86ab5
2 changed files with 21 additions and 6 deletions

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: cgram.y,v 1.64 2014/04/21 18:57:20 christos Exp $ */
/* $NetBSD: cgram.y,v 1.65 2014/04/21 21:52: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.64 2014/04/21 18:57:20 christos Exp $");
__RCSID("$NetBSD: cgram.y,v 1.65 2014/04/21 21:52:24 christos Exp $");
#endif
#include <stdlib.h>
@ -200,8 +200,10 @@ static inline void RESTORE(const char *file, size_t line)
%token <y_type> T_AT_FORMAT_PRINTF
%token <y_type> T_AT_FORMAT_SCANF
%token <y_type> T_AT_FORMAT_STRFTIME
%token <y_type> T_AT_FORMAT_ARG
%token <y_type> T_AT_SENTINEL
%token <y_type> T_AT_RETURNS_TWICE
%token <y_type> T_AT_COLD
%left T_COMMA
%right T_ASSIGN T_OPASS
@ -485,8 +487,12 @@ type_attribute_format_type:
type_attribute_spec:
T_AT_DEPRECATED
| T_AT_ALIGNED T_LPARN constant T_RPARN
| T_AT_SENTINEL T_LPARN constant T_RPARN
| T_AT_FORMAT_ARG T_LPARN constant T_RPARN
| T_AT_MAY_ALIAS
| T_AT_NORETURN
| T_AT_COLD
| T_AT_RETURNS_TWICE
| T_AT_PACKED {
addpacked();
}

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: scan.l,v 1.58 2014/04/21 18:57:07 christos Exp $ */
/* $NetBSD: scan.l,v 1.59 2014/04/21 21:52: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: scan.l,v 1.58 2014/04/21 18:57:07 christos Exp $");
__RCSID("$NetBSD: scan.l,v 1.59 2014/04/21 21:52:24 christos Exp $");
#endif
#include <stdlib.h>
@ -203,6 +203,7 @@ static struct kwtab {
} kwtab[] = {
{ "__alignof__", T_ALIGNOF, 0, 0, 0, 0, 0, 0, 0 },
{ "__attribute__",T_ATTRIBUTE, 0, 0, 0, 0, 0, 1, 0 },
{ "__attribute",T_ATTRIBUTE, 0, 0, 0, 0, 0, 1, 0 },
{ "__packed__", T_AT_PACKED, 0, 0, 0, 0, 0, 1, 1 },
{ "packed", T_AT_PACKED, 0, 0, 0, 0, 0, 1, 1 },
{ "__aligned__",T_AT_ALIGNED, 0, 0, 0, 0, 0, 1, 1 },
@ -227,6 +228,14 @@ static struct kwtab {
{ "__pure__", T_AT_PURE, 0, 0, 0, 0, 0, 1, 1 },
{ "noreturn", T_AT_NORETURN, 0, 0, 0, 0, 0, 1, 1 },
{ "__noreturn__",T_AT_NORETURN, 0, 0, 0, 0, 0, 1, 1 },
{ "sentinel", T_AT_SENTINEL, 0, 0, 0, 0, 0, 1, 1 },
{ "__sentinel__",T_AT_SENTINEL, 0, 0, 0, 0, 0, 1, 1 },
{ "format_arg", T_AT_FORMAT_ARG,0, 0, 0, 0, 0, 1, 1 },
{ "__format_arg__", T_AT_FORMAT_ARG,0, 0, 0, 0, 0, 1, 1 },
{ "returns_twice", T_AT_RETURNS_TWICE,0,0, 0, 0, 0, 1, 1 },
{ "__returns_twice__", T_AT_RETURNS_TWICE,0,0, 0, 0, 0, 1, 1 },
{ "cold", T_AT_COLD, 0, 0, 0, 0, 0, 1, 1 },
{ "__cold__", T_AT_COLD, 0, 0, 0, 0, 0, 1, 1 },
{ "asm", T_ASM, 0, 0, 0, 0, 0, 1, 0 },
{ "__asm", T_ASM, 0, 0, 0, 0, 0, 0, 0 },
{ "__asm__", T_ASM, 0, 0, 0, 0, 0, 0, 0 },