From: Jakub Jelinek Date: Wed, 20 Aug 2008 15:50:23 +0000 (+0200) Subject: re PR c/37171 (Canonical spelling optimization dependency) X-Git-Tag: releases/gcc-4.4.0~3017 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5dc4a7f44c935041908f1f0b1c45e191d6d0a532;p=thirdparty%2Fgcc.git re PR c/37171 (Canonical spelling optimization dependency) PR c/37171 * c-parser.c (c_parser_attributes): For keywords use canonical spelling for attr_name. * gcc.dg/pr37171.c: New test. * g++.dg/ext/attrib34.C: New test. From-SVN: r139317 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a57217cd8ca7..446bf4faf452 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-08-20 Jakub Jelinek + + PR c/37171 + * c-parser.c (c_parser_attributes): For keywords use canonical + spelling for attr_name. + 2008-08-20 Manuel Lopez-Ibanez * value-prof.c (check_counter): Revert wrong call to error. diff --git a/gcc/c-parser.c b/gcc/c-parser.c index ccec66021076..e2b1303cddd6 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -2828,8 +2828,13 @@ c_parser_attributes (c_parser *parser) } if (!ok) break; + /* Accept __attribute__((__const)) as __attribute__((const)) + etc. */ + attr_name + = ridpointers[(int) c_parser_peek_token (parser)->keyword]; } - attr_name = c_parser_peek_token (parser)->value; + else + attr_name = c_parser_peek_token (parser)->value; c_parser_consume_token (parser); if (c_parser_next_token_is_not (parser, CPP_OPEN_PAREN)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6144a4cb78d2..bda7ff1766ce 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-20 Jakub Jelinek + + PR c/37171 + * gcc.dg/pr37171.c: New test. + 2008-08-20 Arnaud Charlet * gnat.dg/div_no_warning.adb: New test. diff --git a/gcc/testsuite/gcc.dg/pr37171.c b/gcc/testsuite/gcc.dg/pr37171.c new file mode 100644 index 000000000000..9be44dfaffd6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr37171.c @@ -0,0 +1,19 @@ +/* PR c/37171 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +unsigned int f1 (void) __attribute__((const)); +unsigned int f2 (void) __attribute__((__const)); +unsigned int f3 (void) __attribute__((__const__)); + +unsigned int f4 (void) +{ + return f1 () + f1 () + f1 () + f1 () + + f2 () + f2 () + f2 () + f2 () + + f3 () + f3 () + f3 () + f3 (); +} + +/* { dg-final { scan-tree-dump-times "= f1 \\(\\)" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "= f2 \\(\\)" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "= f3 \\(\\)" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */