* Jakub Jelinek:

> On Fri, Oct 21, 2022 at 10:40:16AM +0200, Florian Weimer via Gcc wrote:
>> What should we do about these when they are not relevant to what's being
>> tested?  For example, gcc/testsuite/gcc.c-torture/execute/ieee/mzero6.c
>> has this:
>> 
>>   int main ()
>>   {
>>     if (__builtin_copysign (1.0, func (0.0 / -5.0, 10)) != -1.0)
>>       abort ();
>>     exit (0);
>>   }
>> 
>> but no include files, so abort and exit are implicitly declared.
>> 
>> Should we inject a header with -include with the most common
>> declarations (which includes at least abort and exit)?  Or add the
>> missing #include directives?  But the latter might not work for
>> freestanding targets.
>> 
>> Implicit ints and function declarations without prototypes are also
>> common (not just for main).
>> 
>> Other tests look like they might be intended to be built in C89 mode,
>> e.g.  gcc/testsuite/gcc.c-torture/compile/386.c, although it's not
>> immediately obvious to me what they test.
>
> I think these days we at least for abort tend to use __builtin_abort ();
> if we don't want to declare it (in other tests we declare it ourselves).
> exit we usually don't use at all, but sometimes we handle it similarly
> to abort.

So we would patch the tests?  I guess we can make sure we use “int main
(void)” etc. at the same time.

One thing we haven't discussed much so far is PR106416 (-Wint-conversion
should be an error, not a pedwarn).  I think I found the place in the
GCC sources to patch to turn this into an error, but I haven't tried it
yet to see what happens.  I assume the rule is the same for the other
historic stuff (accepted in C89 mode with a warning, error in C99 or
later language modes).

What's the expected default behavior for GCC 14 regarding old-style
function definitions (function definitions which do not have a
prototype)?  I assume if GCC 14 defaults to C2x mode, these no longer
valid constructs would be rejected by default?  Based on some earlier
experiments, the C2x changes for unnamed parameters is in fact
compatible with GCC's existing implementation of implicit ints and
old-syle function definitions: identifiers which denote a type are
already rejected today and not treated as a parameter of type int.

Thanks,
Florian

Reply via email to