GNU bug report logs - #59435
29.0.50; tree-sitter fails to fontify or indent simple function

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Mon, 21 Nov 2022 06:11:01 UTC

Severity: normal

Found in version 29.0.50

To reply to this bug, email your comments to 59435 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Mon, 21 Nov 2022 06:11:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Po Lu <luangruo <at> yahoo.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 21 Nov 2022 06:11:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; tree-sitter fails to fontify or indent simple function
Date: Mon, 21 Nov 2022 14:09:43 +0800
c-ts-mode cannot fontify the following code:

ifsubmitbufl (tp)
{
  register	*kb1 = tp;
  extern	 tbase, i_len;
  register	 l = len;

again:
  
  highprio (); /* tbase is used by protoureg */
  iomap (&UBR, tbase += UBR_SIZ);
  UBR->addr_l = kb1;
  UBR->addr_m = kb1 >> 010;
  UBR->mode_l = 07777 &~ UBR_INST;
  UBR->mode_m = 0;
  UBR->long_l = l;
  UBR->long_m = l >> 010;

  iounmap ();
  tally_iostat (tbase);
  iospoke (UBR, P_LOCK);
  resetprio ();

  SWITCH (S_WAIT|S_HIGH|S_IMMED, 0700, again); /* this returns to
						  BR->senv[0], except
						  if CL_HI */
}

here, ifsubmitbufl, tbase, l and again are fontified as types.  They are
fontified correctly by CC Mode, as three identifiers and one label.

Trying to indent after "again:" results in text being indented to column
0.

In GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu) of 2022-11-21 built
 on trinity
Repository revision: c1a95056214d9bf18bc2c34e938205f1da916bba
Repository branch: feature/tree-sitter
Windowing system distributor 'The X.Org Foundation', version 11.0.12101099
System Description: Fedora Linux 37 (Workstation Edition)

Configured using:
 'configure --with-tree-sitter --with-x-toolkit=no --without-cairo
 --with-dumping=unexec'

Configured features:
ACL DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2
LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY OLDXMENU PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TREE_SITTER UNEXEC WEBP X11 XDBE XFT
XIM XINPUT2 XPM ZLIB




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Mon, 21 Nov 2022 09:46:02 GMT) Full text and rfc822 format available.

Message #8 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 59435 <at> debbugs.gnu.org
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent simple
 function
Date: Mon, 21 Nov 2022 01:45:06 -0800

> On Nov 20, 2022, at 10:09 PM, Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs <at> gnu.org> wrote:
> 
> 
> c-ts-mode cannot fontify the following code:
> 
> ifsubmitbufl (tp)
> {
>  register	*kb1 = tp;
>  extern	 tbase, i_len;
>  register	 l = len;
> 
> again:
> 
>  highprio (); /* tbase is used by protoureg */
>  iomap (&UBR, tbase += UBR_SIZ);
>  UBR->addr_l = kb1;
>  UBR->addr_m = kb1 >> 010;
>  UBR->mode_l = 07777 &~ UBR_INST;
>  UBR->mode_m = 0;
>  UBR->long_l = l;
>  UBR->long_m = l >> 010;
> 
>  iounmap ();
>  tally_iostat (tbase);
>  iospoke (UBR, P_LOCK);
>  resetprio ();
> 
>  SWITCH (S_WAIT|S_HIGH|S_IMMED, 0700, again); /* this returns to
> 						  BR->senv[0], except
> 						  if CL_HI */
> }
> 
> here, ifsubmitbufl, tbase, l and again are fontified as types.  They are
> fontified correctly by CC Mode, as three identifiers and one label.

Thanks, I fixe the label’s face. As for ifsubmitbufl, tbase, and l, I don’t really understand the syntax here, and I think neither does tree-sitter . In general tree-sitter struggles with nonstandard (in its book anyway) syntax. And there aren’t much we can do (except for maybe improve tree-sitter-c’s parser).

> 
> Trying to indent after "again:" results in text being indented to column
> 0.

Seems to work fine here. I don’t see anything I changed recently that could affect this, either.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Mon, 21 Nov 2022 11:58:01 GMT) Full text and rfc822 format available.

Message #11 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 59435 <at> debbugs.gnu.org
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent
 simple function
Date: Mon, 21 Nov 2022 19:57:08 +0800
Yuan Fu <casouri <at> gmail.com> writes:

>> On Nov 20, 2022, at 10:09 PM, Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs <at> gnu.org> wrote:
>> 
>> 
>> c-ts-mode cannot fontify the following code:
>> 
>> ifsubmitbufl (tp)
>> {
>>  register	*kb1 = tp;
>>  extern	 tbase, i_len;
>>  register	 l = len;
>> 
>> again:
>> 
>>  highprio (); /* tbase is used by protoureg */
>>  iomap (&UBR, tbase += UBR_SIZ);
>>  UBR->addr_l = kb1;
>>  UBR->addr_m = kb1 >> 010;
>>  UBR->mode_l = 07777 &~ UBR_INST;
>>  UBR->mode_m = 0;
>>  UBR->long_l = l;
>>  UBR->long_m = l >> 010;
>> 
>>  iounmap ();
>>  tally_iostat (tbase);
>>  iospoke (UBR, P_LOCK);
>>  resetprio ();
>> 
>>  SWITCH (S_WAIT|S_HIGH|S_IMMED, 0700, again); /* this returns to
>> 						  BR->senv[0], except
>> 						  if CL_HI */
>> }
>> 
>> here, ifsubmitbufl, tbase, l and again are fontified as types.  They are
>> fontified correctly by CC Mode, as three identifiers and one label.
>
> Thanks, I fixe the label’s face.

Thanks.

> As for ifsubmitbufl, tbase, and l, I don’t really understand the
> syntax here, and I think neither does tree-sitter . In general
> tree-sitter struggles with nonstandard (in its book anyway) syntax.

Well, that code is 100% valid C.  "*kb1, tbase, i_len, l" are implicitly
int (which on that machine is 16 bits wide), and so is the value of
"ifsubmitbufl" and "tp".

> And there aren’t much we can do (except for maybe improve
> tree-sitter-c’s parser).

Would someone try that?

> Seems to work fine here. I don’t see anything I changed recently that
> could affect this, either.

Sorry, I think I meant "before".  Place point after "l = len;", then
press RET.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Mon, 21 Nov 2022 13:54:02 GMT) Full text and rfc822 format available.

Message #14 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Yuan Fu <casouri <at> gmail.com>, Po Lu <luangruo <at> yahoo.com>
Cc: 59435 <at> debbugs.gnu.org
Subject: Re: bug#59435: 29.0.50;
 tree-sitter fails to fontify or indent simple function
Date: Mon, 21 Nov 2022 05:52:55 -0800
Yuan Fu <casouri <at> gmail.com> writes:

> And there aren’t much we can do (except for maybe improve
> tree-sitter-c’s parser).

We should report these cases as bugs though, right?

IOW, I'm thinking that, going forward, perhaps in these cases it makes
sense for us to close bugs once there is a corresponding bug reported
against the relevant treesitter grammar.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Mon, 21 Nov 2022 13:54:03 GMT) Full text and rfc822 format available.

Message #17 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 59435 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50;
 tree-sitter fails to fontify or indent simple function
Date: Mon, 21 Nov 2022 15:53:44 +0200
> Cc: 59435 <at> debbugs.gnu.org
> Date: Mon, 21 Nov 2022 19:57:08 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> > As for ifsubmitbufl, tbase, and l, I don’t really understand the
> > syntax here, and I think neither does tree-sitter . In general
> > tree-sitter struggles with nonstandard (in its book anyway) syntax.
> 
> Well, that code is 100% valid C.

It's K&R C, which is used very rarely these days, and it sounds like the
next version of GCC will reject it, since C2x makes it invalid.

So I see no catastrophe that c-ts-mode doesn't support this.  You can always
opt not to use c-ts-mode if you need this style supported.  Of course, if
tree-sitter's parser is updated to add such support, we'll all be happier.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Wed, 23 Nov 2022 23:32:02 GMT) Full text and rfc822 format available.

Message #20 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 59435 <at> debbugs.gnu.org
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent 
 simple function
Date: Wed, 23 Nov 2022 15:31:28 -0800
Po Lu <luangruo <at> yahoo.com> writes:

> Yuan Fu <casouri <at> gmail.com> writes:
>
>>> On Nov 20, 2022, at 10:09 PM, Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs <at> gnu.org> wrote:
>>> 
>>> 
>>> c-ts-mode cannot fontify the following code:
>>> 
>>> ifsubmitbufl (tp)
>>> {
>>>  register	*kb1 = tp;
>>>  extern	 tbase, i_len;
>>>  register	 l = len;
>>> 
>>> again:
>>> 
>>>  highprio (); /* tbase is used by protoureg */
>>>  iomap (&UBR, tbase += UBR_SIZ);
>>>  UBR->addr_l = kb1;
>>>  UBR->addr_m = kb1 >> 010;
>>>  UBR->mode_l = 07777 &~ UBR_INST;
>>>  UBR->mode_m = 0;
>>>  UBR->long_l = l;
>>>  UBR->long_m = l >> 010;
>>> 
>>>  iounmap ();
>>>  tally_iostat (tbase);
>>>  iospoke (UBR, P_LOCK);
>>>  resetprio ();
>>> 
>>>  SWITCH (S_WAIT|S_HIGH|S_IMMED, 0700, again); /* this returns to
>>> 						  BR->senv[0], except
>>> 						  if CL_HI */
>>> }
>>> 
>>> here, ifsubmitbufl, tbase, l and again are fontified as types.  They are
>>> fontified correctly by CC Mode, as three identifiers and one label.
>>
>> Thanks, I fixe the label’s face.
>
> Thanks.
>
>> As for ifsubmitbufl, tbase, and l, I don’t really understand the
>> syntax here, and I think neither does tree-sitter . In general
>> tree-sitter struggles with nonstandard (in its book anyway) syntax.
>
> Well, that code is 100% valid C.  "*kb1, tbase, i_len, l" are implicitly
> int (which on that machine is 16 bits wide), and so is the value of
> "ifsubmitbufl" and "tp".
>
>> And there aren’t much we can do (except for maybe improve
>> tree-sitter-c’s parser).
>
> Would someone try that?
>
>> Seems to work fine here. I don’t see anything I changed recently that
>> could affect this, either.
>
> Sorry, I think I meant "before".  Place point after "l = len;", then
> press RET.

That seems to work too. It is indented as much as the previous line.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Thu, 24 Nov 2022 23:39:02 GMT) Full text and rfc822 format available.

Message #23 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 59435 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50;
 tree-sitter fails to fontify or indent simple function
Date: Thu, 24 Nov 2022 18:38:30 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > It's K&R C, which is used very rarely these days, and it sounds like the
  > next version of GCC will reject it, since C2x makes it invalid.

The GNU policy is to continue supporting old forms of syntax for many
years after the latest version of a language specification has
deprecated it.  Old programs are sometimes very important.  We should
refuse to aid the crusades to compel people to "upgrade".

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Fri, 25 Nov 2022 05:13:01 GMT) Full text and rfc822 format available.

Message #26 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Richard Stallman <rms <at> gnu.org>
Cc: 59435 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent
 simple function
Date: Fri, 25 Nov 2022 13:12:10 +0800
Richard Stallman <rms <at> gnu.org> writes:

> The GNU policy is to continue supporting old forms of syntax for many
> years after the latest version of a language specification has
> deprecated it.  Old programs are sometimes very important.  We should
> refuse to aid the crusades to compel people to "upgrade".

Well, it seems that one such crusade is already taking place.  The
crusade will even affect software like Autoconf, especially the
countless configure scripts that have already been generated and are
being included with software:

  https://gcc.gnu.org/pipermail/gcc/2022-November/239883.html
  https://lwn.net/Articles/913505/

Looking at the comments in the latter article, you can see that the
crusade has already been demonstrated to break many pieces of software:
SDL, zsh, just to name a few.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Fri, 25 Nov 2022 06:39:01 GMT) Full text and rfc822 format available.

Message #29 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Richard Stallman <rms <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, 59435 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent simple
 function
Date: Thu, 24 Nov 2022 22:38:30 -0800

> On Nov 24, 2022, at 3:38 PM, Richard Stallman <rms <at> gnu.org> wrote:
> 
> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> 
>> It's K&R C, which is used very rarely these days, and it sounds like the
>> next version of GCC will reject it, since C2x makes it invalid.
> 
> The GNU policy is to continue supporting old forms of syntax for many
> years after the latest version of a language specification has
> deprecated it.  Old programs are sometimes very important.  We should
> refuse to aid the crusades to compel people to "upgrade”.

If I can support them,I definitely would. It’s just that they’ll have a lower priority when I decide where to put my limited resources on. And we are definitely not actively removing any support.

Yuan






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Fri, 25 Nov 2022 07:46:02 GMT) Full text and rfc822 format available.

Message #32 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org
Cc: luangruo <at> yahoo.com, 59435 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50;
 tree-sitter fails to fontify or indent simple function
Date: Fri, 25 Nov 2022 09:45:26 +0200
> From: Richard Stallman <rms <at> gnu.org>
> Cc: luangruo <at> yahoo.com, 59435 <at> debbugs.gnu.org, casouri <at> gmail.com
> Date: Thu, 24 Nov 2022 18:38:30 -0500
> 
>   > It's K&R C, which is used very rarely these days, and it sounds like the
>   > next version of GCC will reject it, since C2x makes it invalid.
> 
> The GNU policy is to continue supporting old forms of syntax for many
> years after the latest version of a language specification has
> deprecated it.  Old programs are sometimes very important.  We should
> refuse to aid the crusades to compel people to "upgrade".

My point was that such code is extremely rare nowadays (or at least is
extremely rarely _edited_), and thus failure to fontify and/or indent it
correctly isn't a catastrophe IMO.  Unless you disagree with that opinion,
what you say is a tangent for this discussion (although I agree with what
you say regardless).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Mon, 28 Nov 2022 21:38:01 GMT) Full text and rfc822 format available.

Message #35 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 59435 <at> debbugs.gnu.org, eliz <at> gnu.org, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50;
 tree-sitter fails to fontify or indent simple function
Date: Mon, 28 Nov 2022 16:37:45 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

I will look at those articles.
Is there any option to tell GCC to accept older syntax?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Mon, 28 Nov 2022 21:38:02 GMT) Full text and rfc822 format available.

Message #38 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 59435 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50;
 tree-sitter fails to fontify or indent simple function
Date: Mon, 28 Nov 2022 16:37:46 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > My point was that such code is extremely rare nowadays (or at least is
  > extremely rarely _edited_), and thus failure to fontify and/or indent it
  > correctly isn't a catastrophe IMO.

I agree with you on that point.

But it's a good thing it led to informing about that "crusade".
I'll talk with people about it off this list.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Tue, 29 Nov 2022 00:47:01 GMT) Full text and rfc822 format available.

Message #41 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Richard Stallman <rms <at> gnu.org>
Cc: 59435 <at> debbugs.gnu.org, eliz <at> gnu.org, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent
 simple function
Date: Tue, 29 Nov 2022 08:46:15 +0800
Richard Stallman <rms <at> gnu.org> writes:

> Is there any option to tell GCC to accept older syntax?

Yes.  But Autoconf does not know about those options, so generated
configure scripts that use the old syntax in tests will not work right.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Sun, 04 Dec 2022 23:13:02 GMT) Full text and rfc822 format available.

Message #44 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 59435 <at> debbugs.gnu.org, eliz <at> gnu.org, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent
 simple function
Date: Sun, 04 Dec 2022 18:12:24 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Yes.  But Autoconf does not know about those options, so generated
  > configure scripts that use the old syntax in tests will not work right.

In principle it should not be hard to fix Autoconf to do this, but it does
not have a real maintainer to do it.

Would anyone like to do easy things on Autoconf now?


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Mon, 05 Dec 2022 01:16:01 GMT) Full text and rfc822 format available.

Message #47 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Richard Stallman <rms <at> gnu.org>
Cc: 59435 <at> debbugs.gnu.org, eliz <at> gnu.org, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent
 simple function
Date: Mon, 05 Dec 2022 09:15:07 +0800
Richard Stallman <rms <at> gnu.org> writes:

> In principle it should not be hard to fix Autoconf to do this, but it does
> not have a real maintainer to do it.
>
> Would anyone like to do easy things on Autoconf now?

Does anyone have a list of those easy things?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Tue, 06 Dec 2022 21:09:02 GMT) Full text and rfc822 format available.

Message #50 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Florian Weimer <fweimer <at> redhat.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, 59435 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent
 simple function
Date: Tue, 06 Dec 2022 22:08:14 +0100
* Eli Zaretskii:

>> Cc: 59435 <at> debbugs.gnu.org
>> Date: Mon, 21 Nov 2022 19:57:08 +0800
>> From:  Po Lu via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> > As for ifsubmitbufl, tbase, and l, I don’t really understand the
>> > syntax here, and I think neither does tree-sitter . In general
>> > tree-sitter struggles with nonstandard (in its book anyway) syntax.
>> 
>> Well, that code is 100% valid C.
>
> It's K&R C, which is used very rarely these days, and it sounds like the
> next version of GCC will reject it, since C2x makes it invalid.

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.

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

Old-style function declarations are still in C18, and so are function
declarations without a prototype.

Thanks,
Florian





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Wed, 07 Dec 2022 01:03:01 GMT) Full text and rfc822 format available.

Message #53 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Florian Weimer <fweimer <at> redhat.com>
Cc: 59435 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent
 simple function
Date: Wed, 07 Dec 2022 09:02:23 +0800
Florian Weimer <fweimer <at> redhat.com> 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?

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

?

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

> Old-style function declarations are still in C18, and so are function
> declarations without a prototype.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Wed, 07 Dec 2022 10:52:02 GMT) Full text and rfc822 format available.

Message #56 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Florian Weimer <fweimer <at> redhat.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 59435 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent
 simple function
Date: Wed, 07 Dec 2022 11:50:44 +0100
* Po Lu:

> Florian Weimer <fweimer <at> redhat.com> 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59435; Package emacs. (Wed, 07 Dec 2022 11:03:02 GMT) Full text and rfc822 format available.

Message #59 received at 59435 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Florian Weimer <fweimer <at> redhat.com>
Cc: 59435 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, casouri <at> gmail.com
Subject: Re: bug#59435: 29.0.50; tree-sitter fails to fontify or indent
 simple function
Date: Wed, 07 Dec 2022 19:01:55 +0800
Florian Weimer <fweimer <at> redhat.com> writes:

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

Well, it may not have been in C99, but it was in "GNU99".  The code I
have in mind (not the one that started this bug report) is written that
way, and with -Wno-implicit-int...

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

Thanks for clarifying.

> Right, it's an argument list mismatch.

Thanks.

> 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 for explaining.




This bug report was last modified 2 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.