aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.c
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2014-02-03 19:07:55 +0000
committerMarc Glisse <marc.glisse@inria.fr>2014-02-03 19:07:55 +0000
commit8a33924257bac06fb1b70bed2245aec1d325db9f (patch)
treeab881259a5ba57d9b1f3a45c2e5aedcfb8af1dd0 /gcc/c-family/c-common.c
parent34117cfbb3b04f85d6625d6086df999b274e9b0f (diff)
2014-02-03 Marc Glisse <marc.glisse@inria.fr>
PR c++/53017 PR c++/59211 gcc/c-family/ * c-common.c (handle_aligned_attribute, handle_alloc_size_attribute, handle_vector_size_attribute, handle_nonnull_attribute): Call default_conversion on the attribute argument. (handle_nonnull_attribute): Increment the argument number. gcc/cp/ * tree.c (handle_init_priority_attribute): Call default_conversion on the attribute argument. gcc/ * doc/extend.texi (Function Attributes): Typo. gcc/testsuite/ * c-c++-common/attributes-1.c: New testcase. * g++.dg/cpp0x/constexpr-attribute2.C: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@207436 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r--gcc/c-family/c-common.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 5ce1a3ef75a..fc12788171c 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -7526,10 +7526,18 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
tree decl = NULL_TREE;
tree *type = NULL;
int is_type = 0;
- tree align_expr = (args ? TREE_VALUE (args)
- : size_int (ATTRIBUTE_ALIGNED_VALUE / BITS_PER_UNIT));
+ tree align_expr;
int i;
+ if (args)
+ {
+ align_expr = TREE_VALUE (args);
+ if (align_expr && TREE_CODE (align_expr) != IDENTIFIER_NODE)
+ align_expr = default_conversion (align_expr);
+ }
+ else
+ align_expr = size_int (ATTRIBUTE_ALIGNED_VALUE / BITS_PER_UNIT);
+
if (DECL_P (*node))
{
decl = *node;
@@ -8023,6 +8031,9 @@ handle_alloc_size_attribute (tree *node, tree ARG_UNUSED (name), tree args,
for (; args; args = TREE_CHAIN (args))
{
tree position = TREE_VALUE (args);
+ if (position && TREE_CODE (position) != IDENTIFIER_NODE
+ && TREE_CODE (position) != FUNCTION_DECL)
+ position = default_conversion (position);
if (TREE_CODE (position) != INTEGER_CST
|| TREE_INT_CST_HIGH (position)
@@ -8467,6 +8478,8 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
*no_add_attrs = true;
size = TREE_VALUE (args);
+ if (size && TREE_CODE (size) != IDENTIFIER_NODE)
+ size = default_conversion (size);
if (!tree_fits_uhwi_p (size))
{
@@ -8560,11 +8573,16 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
/* Argument list specified. Verify that each argument number references
a pointer argument. */
- for (attr_arg_num = 1; args; args = TREE_CHAIN (args))
+ for (attr_arg_num = 1; args; attr_arg_num++, args = TREE_CHAIN (args))
{
unsigned HOST_WIDE_INT arg_num = 0, ck_num;
- if (!get_nonnull_operand (TREE_VALUE (args), &arg_num))
+ tree arg = TREE_VALUE (args);
+ if (arg && TREE_CODE (arg) != IDENTIFIER_NODE
+ && TREE_CODE (arg) != FUNCTION_DECL)
+ arg = default_conversion (arg);
+
+ if (!get_nonnull_operand (arg, &arg_num))
{
error ("nonnull argument has invalid operand number (argument %lu)",
(unsigned long) attr_arg_num);