summaryrefslogtreecommitdiff
path: root/gcc/c-parse.in
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1993-12-24 12:37:56 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1993-12-24 12:37:56 +0000
commita2704301a845149640d042aaa4e1ecf1b85b487b (patch)
tree21205484087dfb838fbefa0891d68f76be98ea6f /gcc/c-parse.in
parent0a2b7e0225b181e464e3f393e550114ee91d887b (diff)
downloadgcc-a2704301a845149640d042aaa4e1ecf1b85b487b.tar.gz
(attrib): Allow expressions instead of constants.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6299 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r--gcc/c-parse.in22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 06fd36f21d9..f9874418827 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -1,5 +1,5 @@
/* YACC parser for C syntax and for Objective C. -*-c-*-
- Copyright (C) 1987, 1988, 1989, 1992 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -1072,8 +1072,13 @@ attrib
$$ = $1; }
| TYPE_QUAL
| IDENTIFIER '(' IDENTIFIER ')'
- { /* If not "mode (m)", then issue warning. */
- if (strcmp (IDENTIFIER_POINTER ($1), "mode") != 0)
+ { /* If not "mode (m)" or "aligned", then issue warning.
+ If "aligned", this will later produce an error in decl_attributes
+ since an identifier is not a valid constant, but we want to give
+ an error instead of a warning when the attribute name is
+ recognized but has an improper argument. */
+ if (strcmp (IDENTIFIER_POINTER ($1), "mode") != 0
+ && strcmp (IDENTIFIER_POINTER ($1), "aligned") != 0)
{
warning ("`%s' attribute directive ignored",
IDENTIFIER_POINTER ($1));
@@ -1081,10 +1086,9 @@ attrib
}
else
$$ = tree_cons ($1, $3, NULL_TREE); }
- | IDENTIFIER '(' CONSTANT ')'
+ | IDENTIFIER '(' expr_no_commas ')'
{ /* if not "aligned(n)", then issue warning */
- if (strcmp (IDENTIFIER_POINTER ($1), "aligned") != 0
- || TREE_CODE ($3) != INTEGER_CST)
+ if (strcmp (IDENTIFIER_POINTER ($1), "aligned") != 0)
{
warning ("`%s' attribute directive ignored",
IDENTIFIER_POINTER ($1));
@@ -1092,11 +1096,9 @@ attrib
}
else
$$ = tree_cons ($1, $3, NULL_TREE); }
- | IDENTIFIER '(' IDENTIFIER ',' CONSTANT ',' CONSTANT ')'
+ | IDENTIFIER '(' IDENTIFIER ',' expr_no_commas ',' expr_no_commas ')'
{ /* if not "format(...)", then issue warning */
- if (strcmp (IDENTIFIER_POINTER ($1), "format") != 0
- || TREE_CODE ($5) != INTEGER_CST
- || TREE_CODE ($7) != INTEGER_CST)
+ if (strcmp (IDENTIFIER_POINTER ($1), "format") != 0)
{
warning ("`%s' attribute directive ignored",
IDENTIFIER_POINTER ($1));