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++0x] avoid extra tentative parse in range-based for loops


On 01/13/2011 12:24 PM, Rodrigo Rivas wrote:
On Thu, Jan 13, 2011 at 10:04 AM, Paolo Bonzini<bonzini@gnu.org> wrote:
Then, what about adding somewhere?
TREE_USED (range_decl) = 1;
DECL_READ_P (range_decl) = 1;

Replying to an old message: does __attribute__ ((__unused__)) work in this context? Or also, "for (Work : { w(), w(), w() })" could be accepted as a GCC extension.

Actually, it does work! If I remove these two lines, then the code: for (int a __attribute__((unused)): { 1, 2, 3 }) { } gives no warning at all with -Wall.

Yeah, it's just a declaration. I was only concerned about the subtleties of the parser and whether it accepted attributes at all.


So, maybe that two lines are unnecessary after all.

Yes.


And the same goes for the nameless-variable extension.

It could still be useful to propose it to the committee, though Jason said it is late for C++0x.


Paolo


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