More C type errors by default for GCC 14

Florian Weimer
Fri May 12 20:43:17 GMT 2023

* Joseph Myers:

> On Fri, 12 May 2023, Florian Weimer wrote:
>> This sone seems to be a good candidate for additional errors, though:
>>   warned_here = pedwarn
>>     (loc, warn_return_type >= 0 ? OPT_Wreturn_type : 0,
>>      "%<return%> with no value, in function returning non-void");
>> It's a clear type volation that can lead to obscure bugs.  Maybe the
>> converse as well.
> This one is valid before C99 (the pedwarn is conditional on flag_isoc99, 
> otherwise it's a warning).

Ahh, I see now, this is required for making “return;” work in
functions returning an implied int type.  So it's tied to implicit-int
removal.  I'm going to add checking this to a future run.

> The converse is unconditionally invalid 
> (though the case where the returned expression from the function with void 
> return type itself has void type is valid in C++ and only a 
> pedwarn-if-pedantic for C; that case is a reasonable extension).



More information about the Gcc mailing list