[Bug c/80529] Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag

2019-02-19 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529

--- Comment #8 from Eric Gallager  ---
My previous arguments for having a flag for this have been in the positive
form, i.e., so that it can be enabled separately, but I'd also like to state it
in its negative form, i.e., so that one can do -std=c89 -pedantic
-Wno-c++-style-comment to get the rest of the C89 pedwarns without also getting
the warnings for C++ style comments.

[Bug c/80529] Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag

2017-08-19 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529

Manuel López-Ibáñez  changed:

   What|Removed |Added

 CC||manu at gcc dot gnu.org

--- Comment #7 from Manuel López-Ibáñez  ---
(In reply to Jonathan Wakely from comment #3)
> Because I'm not childish and realise that clang-tidy is a better tool than a
> compiler when you want to enforce style guides.

In fact, the effort and time spent on adding more and more warnings about style
would be better spent on creating a gcc-tidy tool. Even adding a flag for an
existing warning has a cost.

Having a gcc-tidy tool would benefit gcc by encouraging abstraction and
modularization, and benefit users by making easier to add any particular style
warnings.

[Bug c/80529] Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag

2017-08-18 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org

--- Comment #6 from Eric Gallager  ---
(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.

[Bug c/80529] Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag

2017-08-18 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529

Martin Sebor  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org

--- Comment #5 from Martin Sebor  ---
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).

[Bug c/80529] Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag

2017-04-26 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529

--- Comment #4 from Jonathan Wakely  ---
But in any case, I don't have any say over warnings for the C front-end. It's
just a personal opinion, not a GCC one.

[Bug c/80529] Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag

2017-04-26 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529

--- Comment #3 from Jonathan Wakely  ---
(In reply to Eric Gallager from comment #2)
> (In reply to Jonathan Wakely from comment #1)
> > IMHO warnings should not be enforcing in-house coding guidelines. Use
> > clang-tidy for that.
> 
> GCC already has several warnings added for that purpose. -Wtemplates,
> -Wmultiple-inheritance, -Wvirtual-inheritance, and -Wnamespaces are all
> documented as existing because:
> "Some coding rules disallow
> [templates|[multiple|virtual]inheritance|namespaces], and this may be used
> to enforce that rule."

Five wrongs don't make a right. I stand by my opinion.

> And then -Weffc++ is also documented as being a set of style guidelines.

The Effective C++ rules are about things that often cause bugs, not just
aesthetic style. And -Weffc++ is completely broken anyway (see numerous bugs).

> Also it seems odd that a GCC developer would recommend using a clang-based
> tool instead of GCC when clang is a competing project designed specifically
> to undermine GCC.

Because I'm not childish and realise that clang-tidy is a better tool than a
compiler when you want to enforce style guides.

[Bug c/80529] Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag

2017-04-26 Thread egall at gwmail dot gwu.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529

--- Comment #2 from Eric Gallager  ---
(In reply to Jonathan Wakely from comment #1)
> IMHO warnings should not be enforcing in-house coding guidelines. Use
> clang-tidy for that.

GCC already has several warnings added for that purpose. -Wtemplates,
-Wmultiple-inheritance, -Wvirtual-inheritance, and -Wnamespaces are all
documented as existing because:
"Some coding rules disallow
[templates|[multiple|virtual]inheritance|namespaces], and this may be used to
enforce that rule."
And then -Weffc++ is also documented as being a set of style guidelines.
Also it seems odd that a GCC developer would recommend using a clang-based tool
instead of GCC when clang is a competing project designed specifically to
undermine GCC.

[Bug c/80529] Split "C++ style comments are not allowed in ISO C90" pedwarn into its own warning flag

2017-04-26 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529

--- Comment #1 from Jonathan Wakely  ---
IMHO warnings should not be enforcing in-house coding guidelines. Use
clang-tidy for that.