Subject: bug#59435: 29.0.50; tree-sitter fails to fontify or indent simple function

From: Florian Weimer <[email-masked]>
Date: Wed, 07 Dec 2022 11:50:44 +0100

* Po Lu:

> Florian Weimer <[email-masked]> writes:
>
>> Some clarification:
>>
>> Implicit ints were removed from the language in 1999.  GCC 14 (to be
>> released in 2024) will likely no longer accept them by default, along
>> with implicit function declarations (also removed in 1999).  But you can
>> still get them back using -std=gnu89, and there are no plans to remove
>> that.
>
> What about -std=gnu99? Is there a way to get them back there?

It's odd to ask for a C99 mode explicitly and depend on a feature that
was removed from C99.  If you write C89 code, you should probably use
-std=gnu89.

On the other hand, the largest benefit will come from change the
default.  From that perspective, it won't be necessary to change the
-std=gnu99 behavior.

>> Old-style function definitions will finally be removed in C2X (which
>> will probably be called C23), but I've been told that it will be several
>> years (but probably not anything close to 25) until GCC switches to
>> -std=gnu23 (or whatever the year will be the year of the standard in the
>> end).  Function declarations which are not a prototype—void foo();—will
>> change meaning and denote a function with an empty parameter list, same
>> as today: foo(void);.
>
> No more:
>
>   int (*pFillSpans) ();
>
>   (*pFillSpans) (pDrawable, pGc, nInit, pptInit, pwidthInit, fSorted)
>
> ?

Right, it's an argument list mismatch.

> Will there be an option to get that back in gnu23?

I'm not the C frontend maintainer.  It seems unlikely that this is going
to be supported because it's one of the major C23 changes.

Before -std=gnu23 becomes the default, GCC will probably start warning
about calling ()-declared functions with extra arguments, to help with
porting to a future -std=gnu32-by-default change.  -Wstrict-prototypes
is not a good proxy for this because it will warn about ()-style
declarations even in contexts where C23 will align with what the
programmer intended (no arguments accepted).

Thanks,
Florian