]> granicus.if.org Git - clang/commit
Fix a parser bug where we let attributes interfere with our disambiguation
authorChris Lattner <sabre@nondot.org>
Mon, 20 Oct 2008 02:05:46 +0000 (02:05 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 20 Oct 2008 02:05:46 +0000 (02:05 +0000)
commit7399ee0aa6ffaeab0a8f83408b1c5127fb2bf5b8
tree8690603dacae261284a0c6517da29d6e5aa3104b
parent097e916b617bb4a069a03764024c310ed42a6424
Fix a parser bug where we let attributes interfere with our disambiguation
of whether a '(' was a grouping paren or the start of a function declarator.
This is PR2796.

Now we eat the attribute before deciding whether the paren is grouping or
not, then apply it to the resultant decl or to the first argument as needed.

One somewhat surprising aspect of this is that attributes interact with
implicit int in cases like this:

void a(x, y) // k&r style function
void b(__attribute__(()) x, y); // function with two implicit int arguments
void c(x, __attribute__(()) y); // error, can't have attr in identifier list.

Fun stuff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57790 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticKinds.def
include/clang/Parse/Parser.h
lib/Parse/ParseDecl.cpp
test/Parser/attributes.c