[Bug c/80529] Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 18 19:44:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #5)
> I also don't think that adding a pure style warning for // comments is in
> line with GCC philosophy. Quoting from the GCC manual:
>
> Warnings are diagnostic messages that report constructions that are not
> inherently erroneous but that are risky or suggest there may have been
> an error.
>
> Unlike with the traditional C-style comments, I don't know of any problems
> due to C++-style comments, so I don't think adding a warning option for them
> would be appropriate.
>
> Regarding the exceptions cited in comment #2, I believe those exist not so
> much to help enforce particular coding styles but rather to avoid relying on
> C++ features that, at the time they were made available in G++, either
> weren't universally supported or weren't implemented efficiently enough to
> be suitable for all projects (e.g., embedded code would avoid some of these
> C++ features to minimize code bloat).
Actually I guess a better comparison would be -Wdeclaration-after-statement,
which you can get as part of -std=c89 -pedantic, but which you can also get
separately for other standards. Remember, gcc already warns for // comments
with
-std=gnu89 -pedantic, so splitting it into a new option wouldn't be so much
adding a warning option as it would be enabling an existing warning option for
other standards.
More information about the Gcc-bugs
mailing list