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

To reply to this bug, email your comments to 64567 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#64567; Package emacs. (Tue, 11 Jul 2023 00:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to yang.yingchao <at> qq.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 11 Jul 2023 00:48:02 GMT) Full text and rfc822 format available.

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

From: Yang Yingchao <yang.yingchao <at> qq.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 29.0.92; c-ts-mode fails to parse syslogger.c of postgres source
Date: Tue, 11 Jul 2023 08:30:51 +0800
[Message part 1 (text/plain, inline)]
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()`.



In GNU Emacs 29.0.92 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-07-11 built on tbook
Repository revision: 419b4d44914701cedf308df58c3e5789715c87e7
Repository branch: HEAD
System Description: Gentoo Linux

Configured using:
 'configure 'CFLAGS=-O2 -march=native -pipe -g' LDFLAGS= --with-xml2
 --with-json --with-modules --without-pop --without-imagemagick
 --with-native-compilation --with-pgtk --with-xft --with-harfbuzz
 --with-tree-sitter --without-x --without-ns'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK
PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: zh_CN.UTF8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix

Major mode: C/*

Minor modes in effect:
  treesit-explore-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort emacsbug mail-extr message sendmail mailcap yank-media puny
dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg
rfc6068 epg-config gnus-util text-property-search time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
c-ts-mode c-ts-common treesit vc-git diff-mode easy-mmode vc-dispatcher
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs comp comp-cstr warnings icons subr-x rx cl-seq cl-macs
gv cl-extra help-mode cl-loaddefs cl-lib bytecomp byte-compile
china-util rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win
pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 456295 34678)
 (symbols 48 9761 0)
 (strings 32 44677 2133)
 (string-bytes 1 1728443)
 (vectors 16 41351)
 (vector-slots 8 598570 44421)
 (floats 8 58 41)
 (intervals 56 38142 182)
 (buffers 984 14))

Merged 64567 64568. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 11 Jul 2023 11:35:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64567; Package emacs. (Tue, 11 Jul 2023 11:59:02 GMT) Full text and rfc822 format available.

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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64567; Package emacs. (Wed, 12 Jul 2023 01:07:01 GMT) Full text and rfc822 format available.

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

From: Yang Yingchao <yang.yingchao <at> qq.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64567 <at> debbugs.gnu.org, Yuan Fu <casouri <at> gmail.com>,
 Theodor Thornhill <theo <at> thornhill.no>
Subject: Re: bug#64567: 29.0.92; c-ts-mode fails to parse syslogger.c of
 postgres source
Date: Wed, 12 Jul 2023 09:05:37 +0800
[Message part 1 (text/plain, inline)]
Sure, thanks.

On Tue, Jul 11 2023, Eli Zaretskii <eliz <at> gnu.org> wrote:

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



Regards,

-- *Yang Yingchao*

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.