Ping
http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01168.html
(conversation starts at
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg03822.html )
On Sat, 18 Jan 2014, Marc Glisse wrote:
On Thu, 2 Jan 2014, Jason Merrill wrote:
On 11/30/2013 05:41 AM, Marc Glisse wrote:
for some reason one of the attributes can see a FUNCTION_DECL where others
see an IDENTIFIER_NODE, I didn't try to understand why and just added that
check to the code.
Please do check.
In the C front-end (at least), the grammar says:
attrib:
empty
any-word
any-word ( identifier )
any-word ( identifier , nonempty-expr-list )
any-word ( expr-list )
So when we have: __attribute__((nonnull(bar,bar)))
the parser will keep bar as an identifier for the first argument, but parse
the second one as an expr-list and thus find the associated function_decl. So
this can happen anytime an attribute has several arguments, and I added the
same check to nonnull that I had for alloc_size (and fixed the argument
numbering while I was there).
+ if (size && size != error_mark_node && TREE_CODE (size) !=
IDENTIFIER_NODE)
Why is the error_mark_node check needed here and not in the other places?
Don't know, I removed it for now. If it is needed, someone will eventually
provide a testcase in bugzilla.
Bootstrap and testsuite on x86_64-linux-gnu with
--enable-languages=c,c++,objc,obj-c++.
2014-01-19 Marc Glisse <marc.gli...@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): Likewise.
gcc/
* doc/extend.texi (Function Attributes): Typo.
gcc/testsuite/
* c-c++-common/attributes-1.c: New testcase.
* g++.dg/cpp0x/constexpr-attribute2.C: Likewise.
--
Marc Glisse