diff options
author | nemet <nemet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-28 19:30:49 +0000 |
---|---|---|
committer | nemet <nemet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-28 19:30:49 +0000 |
commit | e3ab5fb6e9e642912816a5abb7be6abbfcd97030 (patch) | |
tree | 03d631e3469748cc661ebe96d5fa06e820f94e93 /gcc/c-typeck.c | |
parent | bd328ab4a282278c7d6ccfb71915e25d9e9dc033 (diff) | |
download | gcc-e3ab5fb6e9e642912816a5abb7be6abbfcd97030.tar.gz |
PR middle-end/18160
* c-typeck.c (c_mark_addressable): Issue error if address of a
register variable is taken. Use "%qD" to print DECL_NAME.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89772 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r-- | gcc/c-typeck.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 9e4f0fb1501..7d599bce05c 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2818,8 +2818,8 @@ c_mark_addressable (tree exp) case COMPONENT_REF: if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1))) { - error ("cannot take address of bit-field %qs", - IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (x, 1)))); + error + ("cannot take address of bit-field %qD", TREE_OPERAND (x, 1)); return false; } @@ -2846,24 +2846,19 @@ c_mark_addressable (tree exp) { if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) { - error ("global register variable %qs used in nested function", - IDENTIFIER_POINTER (DECL_NAME (x))); + error + ("global register variable %qD used in nested function", x); return false; } - pedwarn ("register variable %qs used in nested function", - IDENTIFIER_POINTER (DECL_NAME (x))); + pedwarn ("register variable %qD used in nested function", x); } else if (C_DECL_REGISTER (x)) { if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) - { - error ("address of global register variable %qs requested", - IDENTIFIER_POINTER (DECL_NAME (x))); - return false; - } - - pedwarn ("address of register variable %qs requested", - IDENTIFIER_POINTER (DECL_NAME (x))); + error ("address of global register variable %qD requested", x); + else + error ("address of register variable %qD requested", x); + return false; } /* drops in */ |