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).

Reply via email to