[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-06-20 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

--- Comment #9 from Martin Sebor  ---
Author: msebor
Date: Mon Jun 20 15:46:09 2016
New Revision: 237606

URL: https://gcc.gnu.org/viewcvs?rev=237606=gcc=rev
Log:
PR c/69507 - bogus warning: ISO C does not allow __alignof__ (expression)

gcc/testsuite/ChangeLog:
* gnu89-const-expr-1.c: Avoid diagnosing __alignof__ as not conforming.
* gnu90-const-expr-1.c: Same.
* gnu99-const-expr-1.c: Same.
* gnu99-static-1.c: Same.


Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/gnu89-const-expr-1.c
trunk/gcc/testsuite/gcc.dg/gnu90-const-expr-1.c
trunk/gcc/testsuite/gcc.dg/gnu99-const-expr-1.c
trunk/gcc/testsuite/gcc.dg/gnu99-static-1.c

[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-06-19 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

--- Comment #7 from Martin Sebor  ---
Author: msebor
Date: Sun Jun 19 16:11:40 2016
New Revision: 237582

URL: https://gcc.gnu.org/viewcvs?rev=237582=gcc=rev
Log:
PR c/69507 - bogus warning: ISO C does not allow ‘__alignof__ (expression)’



Added:
trunk/gcc/testsuite/gcc.dg/alignof.c

[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-06-19 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Martin Sebor  ---
Fixed via r237581.

[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-06-19 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

--- Comment #6 from Martin Sebor  ---
Author: msebor
Date: Sun Jun 19 16:10:04 2016
New Revision: 237581

URL: https://gcc.gnu.org/viewcvs?rev=237581=gcc=rev
Log:
PR c/69507 - bogus warning: ISO C does not allow ‘__alignof__ (expression)’

gcc/testsuite/ChangeLog:

PR c/69507
* gcc.dg/alignof.c: New test.

gcc/c/ChangeLog:

PR c/69507
* c-parser.c (c_parser_alignof_expression): Avoid diagnosing
__alignof__ (expression).


Modified:
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-parser.c
trunk/gcc/testsuite/ChangeLog

[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-05-27 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

--- Comment #5 from Martin Sebor  ---
Patch posted for review:
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg02216.html

[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-01-26 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

--- Comment #4 from Martin Sebor  ---
Created attachment 37483
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37483=edit
Proposed patch.

Attaching a proposed patch tested on x86_64-linux.  Since GCC is in stage 4
(regression fixes only) and this is no a regression it will probably have to
wait until after the 6.0 release.

[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-01-26 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

Martin Sebor  changed:

   What|Removed |Added

   Keywords||diagnostic
   Severity|normal  |minor

[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-01-26 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

--- Comment #1 from Andrew Pinski  ---
I don't think this is a bogus warning.  -pedantic turns off all of GCC
extensions including __attribute__ and asm support IIRC.

[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-01-26 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

--- Comment #2 from Martin Sebor  ---
The manual says this about -Wpedantic:

  -Wpedantic does not cause warning messages for use of the alternate keywords
whose names begin and end with '__'.

GCC accepts without a warning many extensions in pedantic mode, including
__attribute__((aligned)), __const__, and __inline__, all of which have
corresponding similar features in C, as well as __typeof__ which doesn't:

$ cat z.c && /home/msebor/build/gcc-trunk-git/gcc/xgcc
-B/home/msebor/build/gcc-trunk-git/gcc -S -Wall -Wextra -Wpedantic -std=c11 z.c
__const__ int a __attribute__ ((aligned));
__typeof__ (a) b;
__inline__ void f (void) { }

[Bug c/69507] bogus warning: ISO C does not allow ‘__alignof__ (expression)’

2016-01-26 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69507

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2016-01-27
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
 Ever confirmed|0   |1
  Known to fail||4.9.3, 5.1.0, 6.0

--- Comment #3 from Martin Sebor  ---
This seems like a simple matter of a missed conditional in the parser.  The
following change suppresses the warning.  Let me add a test and post it for
review.

Index: gcc/c/c-parser.c
===
--- gcc/c/c-parser.c(revision 232841)
+++ gcc/c/c-parser.c(working copy)
@@ -7019,9 +7019,10 @@ c_parser_alignof_expression (c_parser *p
   mark_exp_read (expr.value);
   c_inhibit_evaluation_warnings--;
   in_alignof--;
-  pedwarn (start_loc,
-  OPT_Wpedantic, "ISO C does not allow %<%E (expression)%>",
-  alignof_spelling);
+  if (is_c11_alignof)
+   pedwarn (start_loc,
+OPT_Wpedantic, "ISO C does not allow %<%E (expression)%>",
+alignof_spelling);
   ret.value = c_alignof_expr (start_loc, expr.value);
   ret.original_code = ERROR_MARK;
   ret.original_type = NULL;