[Bug c/37041] -Wc++-compat refinements
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 22 19:39:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37041
--- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #5)
> #ifdef __cplusplus
> extern "C" {
> #endif
>
> /* code that is C-only */
This is not what extern "C" means. The code still needs to be valid C++ and
this is why -Wc++-compat would be useful here. For example, this is not valid
C++ despite being valid C, and -Wc++-compat rightly warns you about it:
#ifdef __cplusplus
extern "C" {
#endif
/* code that is C-only */
int and(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
> 2. Make -Wc++-compat an "umbrella" warning flag like -Wall or -Wextra.
My guess is that if/when existing GCC developers have time to work on
-Wc++-compat, they will likely focus on fixing the missing warnings and
particularly invalid warnings, rather than figuring out how to refine
-Wc++-compat. But we always welcome new developers
(https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps).
More information about the Gcc-bugs
mailing list