This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C,C++] integer constants in attribute arguments


On Mon, 3 Feb 2014, Jason Merrill wrote:

On 01/18/2014 05:33 PM, Marc Glisse wrote:
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.

OK, that makes sense. But why do we need to handle that specially? Isn't that an invalid argument whether or not it decays to a pointer?

The C version of default_conversion does not convert a function_decl to a pointer (that's done earlier, during parsing), it ICEs. As you can see for the one attribute that is C++-only, I don't have any protection before calling default_conversion, it is only for the C front-end (for which calling default_conversion is useless anyway, but that's how it is already done in a couple other attributes).

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]