https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118112

--- Comment #9 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
We do in fact track when () was interpreted as (void) for use by -Wtraditional,
but only in the c_arg_info, it doesn't get as far as the actual declarations
and types. If using this information in a way that propagates further in order
to get better diagnostics (which probably makes sense), make sure to update the
comment that says "only for use by -Wtraditional".

If you do track it as part of the type, you then need to deal with composite
types for it (a composite type should only have the "defined with ()" property
if all the types being composed have that property). And of course it should
*not* affect the standard "same type" property, int() and int(void) are exactly
the same type in C23 standard terms (so it's fine to redefine a structure
containing a function pointer, where one definition uses () and one uses
(void), for example).

(People wanting to diagnose non-prototype declarations in previous GCC versions
/ pre-C23 standards modes should use -Wstrict-prototypes. So it's mainly C23
mode that could do with improved diagnostics here.)

Reply via email to