GNU bug report logs - #64567
29.0.92; c-ts-mode fails to parse syslogger.c of postgres source

Previous Next

Package: emacs;

Reported by: yang.yingchao <at> qq.com

Date: Tue, 11 Jul 2023 00:48:02 UTC

Severity: normal

Merged with 64568

Found in version 29.0.92

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: yang.yingchao <at> qq.com, Yuan Fu <casouri <at> gmail.com>,
 Theodor Thornhill <theo <at> thornhill.no>
Cc: 64567 <at> debbugs.gnu.org
Subject: Re: bug#64567: 29.0.92;
 c-ts-mode fails to parse syslogger.c of postgres source
Date: Tue, 11 Jul 2023 14:58:01 +0300
> Date: Tue, 11 Jul 2023 08:30:51 +0800
> From:  Yang Yingchao via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 1. get source file from
> <https://github.com/postgres/postgres/blob/master/src/backend/postmaster/syslogger.c>
> 1. open it, and move to line 567, then we can see function
> `SysLogger_Start(void)` is not highlighted properly.
> 
> `treesit-explore-mode` shows some error too:
> 
> ```
> (ERROR type: (primitive_type)
>  (function_declarator declarator: (identifier)
>   parameters:
>    (parameter_list (
>     (parameter_declaration type: (primitive_type))
>     )))
> 
> ```
> 
> And when cusor is inside this function, and `treesit-beginning-of-defun`
> will move cusor to `SysLoggerMain()` which is actully the function
> before `SysLogger_Start()`.

It's because of this:


  #ifdef EXEC_BACKEND
	  switch ((sysloggerPid = syslogger_forkexec()))
  #else
	  switch ((sysloggerPid = fork_process()))
  #endif

The 2 'switch' statements inside preprocessor conditions cause the
parser to fail.  I'm not sure we can do anything with this, except
report this to the developers of the tree-sitter C grammar, but I CC
Yuan and Theo just in case they have some ideas.




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

Previous Next


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