[Bug c/80529] New: Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag
egall at gwmail dot gwu.edu
gcc-bugzilla@gcc.gnu.org
Wed Apr 26 13:25:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529
Bug ID: 80529
Summary: Split "C++ style comments are not allowed in ISO C90"
pedwarn into its own warning flag
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: egall at gwmail dot gwu.edu
Target Milestone: ---
Given the following source:
$ cat gcctestcase01.c
// bad comment
int foo;
GCC errors on it with -std=c89 and -ansi, and warns on it with -std=gnu89
-pedantic, for example:
$ /usr/local/bin/gcc -std=gnu89 -pedantic -c gcctestcase01.c
gcctestcase01.c:1:1: warning: C++ style comments are not allowed in ISO C90
// bad comment
^
gcctestcase01.c:1:1: warning: (this will be reported only once per input file)
However, many C projects disallow C++ style comments not for compatibility with
C90, but for style reasons. It'd be nice to be able to get this warning when
using newer language standards for such projects that disallow C++ style
comments anyways, especially now that GCC defaults to -std=gnu11 (meaning that
just adding -pedantic isn't enough). I suggest calling it -Wc++-style-comment.
More information about the Gcc-bugs
mailing list