GNU bug report logs - #61482
30.0.50; tree-sitter-c doesn't support _Generic

Previous Next

Package: emacs;

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

Date: Mon, 13 Feb 2023 15:34:01 UTC

Severity: normal

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 61482 <at> debbugs.gnu.org
Subject: bug#61482: 30.0.50; tree-sitter-c doesn't support _Generic
Date: Tue, 21 Feb 2023 00:56:40 -0800
Po Lu <luangruo <at> yahoo.com> writes:

> 2011 Standard C has a feature that works like `switch', except it
> switches upon the type of an expression at compile time.
>
> This does not seem to be supported at all with c-ts-mode:
>
> {
>   const char *typename = _Generic ((expr),
> 				   const char *:
> 				     "const char *",
> 				   int:
> 				     "int",
> 				   unsigned long:
> 				     "unsigned long",
> 				   default:
> 				     NULL);
> }
>
> here, none of the types are fontified (which fares worse than CC Mode),
> nor is _Generic fontified as a keyword.  Indenting anywhere inside the
> _Generic expression also results in nothing happening.

That’s the same as _Noreturn, tree-sitter-c doesn’t support it now. See
https://github.com/tree-sitter/tree-sitter-c/issues/124, I opened an
issue requesting for _Generic and _Noreturn. But I don’t really know
much about these features, please see if I described it correctly.

Yuan




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

Previous Next


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