From unknown Thu Jun 19 14:26:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63957: 29.0.91; c-ts-mode: incorrect fontification in alloc.c Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Jun 2023 05:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63957 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 63957@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16862038126985 (code B ref -1); Thu, 08 Jun 2023 05:57:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 Jun 2023 05:56:52 +0000 Received: from localhost ([127.0.0.1]:55477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q78df-0001ob-PY for submit@debbugs.gnu.org; Thu, 08 Jun 2023 01:56:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:35812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q78da-0001oQ-U7 for submit@debbugs.gnu.org; Thu, 08 Jun 2023 01:56:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q78da-0002hA-HX for bug-gnu-emacs@gnu.org; Thu, 08 Jun 2023 01:56:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q78da-0000sA-7h for bug-gnu-emacs@gnu.org; Thu, 08 Jun 2023 01:56:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Subject:To:From:Date:mime-version:in-reply-to: references; bh=wR1tBVRhVSaGCFOQtvEZH+3BWPWulJqhScxYK/1KJ2E=; b=aadtc54ZsKwkEw G4hmOTfr7q0eNEaG198YIO53HUTyqaTmtisacqce+xTiVY3Nb+1W2zzAO9hIFJYI/OnUlEV1lyrf2 lmL7L7ByduvxfPite7C6jxLxdQEYxwdcqkHOeVllHLFWDOnrikLyQeygoi2tyna4tEESRAiBKI0Mn 9aNjMr9KdiBj30b3wj7cD5SBa476hci6l0I0Mn3d3yEzeIPIvP55y+woSmGS++IrZIE/2bBwCwhWA guspN7435/4uxHIlfjrSzTSEaCSNgQ7Gxb8sskvOPwrMCtLY4u9P4RNPZutvgLBUELR8mY0A87x3y gXfTl8oCv0AVqCkeDvDA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q78dZ-0004iy-LW for bug-gnu-emacs@gnu.org; Thu, 08 Jun 2023 01:56:46 -0400 Date: Thu, 08 Jun 2023 08:56:51 +0300 Message-Id: <83mt1a33a4.fsf@gnu.org> From: Eli Zaretskii X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) To reproduce: emacs -Q C-x C-f src/alloc.c RET M-x c-ts-mode RET C-u 3184 M-g g Observe that several "else if" clauses in the following fragment are not fontified correctly: #ifdef HAVE_TREE_SITTER else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_TS_PARSER)) treesit_delete_parser (PSEUDOVEC_STRUCT (vector, Lisp_TS_Parser)); else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_TS_COMPILED_QUERY)) treesit_delete_query (PSEUDOVEC_STRUCT (vector, Lisp_TS_Query)); #endif #ifdef HAVE_MODULES else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_MODULE_FUNCTION)) { ATTRIBUTE_MAY_ALIAS struct Lisp_Module_Function *function = (struct Lisp_Module_Function *) vector; module_finalize_function (function); } #endif #ifdef HAVE_NATIVE_COMP else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_NATIVE_COMP_UNIT)) { struct Lisp_Native_Comp_Unit *cu = PSEUDOVEC_STRUCT (vector, Lisp_Native_Comp_Unit); unload_comp_unit (cu); } else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_SUBR)) { struct Lisp_Subr *subr = PSEUDOVEC_STRUCT (vector, Lisp_Subr); if (!NILP (subr->native_comp_u)) { /* FIXME Alternative and non invasive solution to this cast? */ xfree ((char *)subr->symbol_name); xfree (subr->native_c_name); } } #endif In this fragment, "else" has the font-lock-type-face, and "if" has the font-lock-function-name-face. I'm guessing this is caused by the #ifdef's there, but can this be fixed, please? FTR, I'm using the latest tree-sitter-c grammar library, built from the HEAD of their Git repository. In GNU Emacs 29.0.91 (build 42, i686-pc-mingw32) of 2023-06-06 built on HOME-C4E4A596F7 Repository revision: bcc222251e1a750a11e365f2faa641cc56c1169d Repository branch: emacs-29 Windowing system distributor 'Microsoft Corp.', version 5.1.2600 System Description: Microsoft Windows XP Service Pack 3 (v5.1.0.2600) Configured using: 'configure -C --prefix=/d/usr --with-wide-int --enable-checking=yes,glyphs 'CFLAGS=-O0 -gdwarf-4 -g3'' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB Important settings: value of $LANG: ENU locale-coding-system: cp1255 Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t 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 mail-extr emacsbug message 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 subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win 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 w32notify w32 lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 42750 9786) (symbols 48 6287 0) (strings 16 16570 3023) (string-bytes 1 399211) (vectors 16 9324) (vector-slots 8 147662 13516) (floats 8 23 27) (intervals 40 273 98) (buffers 888 10)) From unknown Thu Jun 19 14:26:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63957: 29.0.91; c-ts-mode: incorrect fontification in alloc.c Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Jun 2023 06:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63957 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill , Yuan Fu Cc: 63957@debbugs.gnu.org Received: via spool by 63957-submit@debbugs.gnu.org id=B63957.16862040567463 (code B ref 63957); Thu, 08 Jun 2023 06:01:02 +0000 Received: (at 63957) by debbugs.gnu.org; 8 Jun 2023 06:00:56 +0000 Received: from localhost ([127.0.0.1]:55483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q78hb-0001wJ-LR for submit@debbugs.gnu.org; Thu, 08 Jun 2023 02:00:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q78hZ-0001w7-K5 for 63957@debbugs.gnu.org; Thu, 08 Jun 2023 02:00:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q78hT-0001e8-AZ; Thu, 08 Jun 2023 02:00:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=07JB3nzeYpfTTeilGhv96BJ8Bvcm9onbrreY3u23i4g=; b=kGwgieGsG7VA vj36Gqm39CRzAFFRVj1zAwLC4FdJOSqQHy2pf3PReySQfhrG4KW13TaFY/D/u106+2YxWjYN1jSQz LOHPYVPbKvc2889+mfrTKDXjZ1scJhBY6rSIa+HTkk+geqfzLDkGOuFoT9IpfqXkFgIiIpcxWcdhs 9K4K/TGOVVskJiWG+KbCfIY8r7/WInQcOATrVU5IcsGCcDU2oZTMR4KJPZinKJec4IzFGf9ioJjoq DQBntt3lb/+pV7qhieU0tZkZYv0Y2T50WySZ7zhHeEWOMxbbINJsSkoa7SNEcy1Qvab3AlGQbp2u0 MWpJTpXKz6c1FHvin0deZA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q78hS-0007bW-2T; Thu, 08 Jun 2023 02:00:46 -0400 Date: Thu, 08 Jun 2023 09:00:52 +0300 Message-Id: <83legu333f.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <83mt1a33a4.fsf@gnu.org> (message from Eli Zaretskii on Thu, 08 Jun 2023 08:56:51 +0300) References: <83mt1a33a4.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 08 Jun 2023 08:56:51 +0300 > From: Eli Zaretskii > > > To reproduce: > > emacs -Q > C-x C-f src/alloc.c RET > M-x c-ts-mode RET > C-u 3184 M-g g > > Observe that several "else if" clauses in the following fragment are not > fontified correctly: Adding the relevant folks. Could you guys please look into this issue? From unknown Thu Jun 19 14:26:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63957: 29.0.91; c-ts-mode: incorrect fontification in alloc.c Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Jun 2023 07:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63957 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 63957@debbugs.gnu.org, Theodor Thornhill Received: via spool by 63957-submit@debbugs.gnu.org id=B63957.168620876415119 (code B ref 63957); Thu, 08 Jun 2023 07:20:01 +0000 Received: (at 63957) by debbugs.gnu.org; 8 Jun 2023 07:19:24 +0000 Received: from localhost ([127.0.0.1]:55550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q79vX-0003vn-Ui for submit@debbugs.gnu.org; Thu, 08 Jun 2023 03:19:24 -0400 Received: from mail-pg1-f182.google.com ([209.85.215.182]:57752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q79vV-0003vQ-O6 for 63957@debbugs.gnu.org; Thu, 08 Jun 2023 03:19:22 -0400 Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-543d90cc675so87785a12.3 for <63957@debbugs.gnu.org>; Thu, 08 Jun 2023 00:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686208756; x=1688800756; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Izr//FqT/uMmZbvl3XVHFnRugiwxxYJtpZMxrpgu4Ho=; b=LXwO/+VBgh75XK4z6+FfgMoX5qAn0Kksa9muNqv5bQ0l3jEjmKKbLrUk/DlM4mXa6N tecfpG5gAwbskIpB5b1ozCa3W9Vff/wbZ3W7eYaWeD+yHlM8bUotRm+pds8QW6KnQoX2 aO9MdxIv1VSbw7PDH+n1CmQ+sqf1Rbbcd1bxmCZnUFDZ+kQza7YUecpDt9doS6W1jTPT ZkgkydlFGtYXdJEfa3CcI4eVFKRwD8sOx5sZ67bjgAxskp94bqT6wISoNLC8/S4chhOp SuCmjAtpIfksPeLldvEP/0Sayt/qpweOl2SsSJrxPRL22MMXY8u5dMalHLUgUvGNdsQv aOWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686208756; x=1688800756; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Izr//FqT/uMmZbvl3XVHFnRugiwxxYJtpZMxrpgu4Ho=; b=SLIB08t16waug8Oa5MVuKFN3jw1wGB9nRDAgOaMAtGb8zLV/szPcGDczUC6LaATRbr B4IxXNdopw06wTmLpC7QswUILNWw2ehv9t1BKpAAvhVFlSdF1HY3RmdTz//K3prU14Kg PBZGfEERQnQy6lOCtD9s6vVbqiUt7xpnqRbl/JjBqlBshpyQFT/5xXIeogL5Ep5qAQpn mlrigFp1bC8UlXcJh8uITZzh5bdzWp47J4uF4Zuv6LroO3KjpoCyt3+sWdxq/0GA1mqy c/V7D2Ze/UaS7KmcKLJOp7pOas5WTelyOulUYOnorByNHdGmG2YmS2Zxj3PgdCSl+LsA CMeQ== X-Gm-Message-State: AC+VfDzgXSs8TBDUnqn9u4hE7e7E9dAoe/z28oy+N4dE3DZKg/wBVqgj 8K/kgdldXp7/Mskh6QAtTuM= X-Google-Smtp-Source: ACHHUZ4DU9qkg+IXPvtYNIx9vTjlkT/tlsuPfdE15am0oIeY9gGm4zRTtZ3YtmDzcZHPZ1RHJYvkIg== X-Received: by 2002:a17:90a:8913:b0:253:8a50:1bcb with SMTP id u19-20020a17090a891300b002538a501bcbmr3393119pjn.25.1686208755607; Thu, 08 Jun 2023 00:19:15 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id bv24-20020a17090af19800b00253239144c5sm604190pjb.42.2023.06.08.00.19.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2023 00:19:15 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) From: Yuan Fu In-Reply-To: <83legu333f.fsf@gnu.org> Date: Thu, 8 Jun 2023 00:19:04 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83mt1a33a4.fsf@gnu.org> <83legu333f.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Jun 7, 2023, at 11:00 PM, Eli Zaretskii wrote: >=20 >> Date: Thu, 08 Jun 2023 08:56:51 +0300 >> From: Eli Zaretskii >>=20 >>=20 >> To reproduce: >>=20 >> emacs -Q >> C-x C-f src/alloc.c RET >> M-x c-ts-mode RET >> C-u 3184 M-g g >>=20 >> Observe that several "else if" clauses in the following fragment are = not >> fontified correctly: >=20 > Adding the relevant folks. >=20 > Could you guys please look into this issue? Yep, I=E2=80=99ll look into it tomorrow. Yuan= From unknown Thu Jun 19 14:26:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63957: 29.0.91; c-ts-mode: incorrect fontification in alloc.c Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Jun 2023 06:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63957 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 63957@debbugs.gnu.org, Theodor Thornhill Received: via spool by 63957-submit@debbugs.gnu.org id=B63957.168637992728363 (code B ref 63957); Sat, 10 Jun 2023 06:53:02 +0000 Received: (at 63957) by debbugs.gnu.org; 10 Jun 2023 06:52:07 +0000 Received: from localhost ([127.0.0.1]:33141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7sSE-0007NP-U7 for submit@debbugs.gnu.org; Sat, 10 Jun 2023 02:52:07 -0400 Received: from mail-pj1-f51.google.com ([209.85.216.51]:46132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7sSC-0007Mv-OC for 63957@debbugs.gnu.org; Sat, 10 Jun 2023 02:52:05 -0400 Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-25bbaa393aaso42249a91.0 for <63957@debbugs.gnu.org>; Fri, 09 Jun 2023 23:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686379918; x=1688971918; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MgCOYObNWJT5Zih6Rsxpv6C1qIQ4ATfBxk1szFeTj4M=; b=ZKQYoJV9qBNdwnP+gACEk1IRunhlzLUllcOSLVBBN3iO+abmZWbQ7gB5YKpAlD3DF7 Bq+jTV7CFklxRiJc0r3U/+0qw2MYamcBk+93JwQ9xKbMoFefk33HKgN81tv6qERNo9vz XnP8z242sMQI4zrhVLLUB3XuNUnW+gd1ijAWFqmOlUU4VbC0VuWyR1xvhBcx8suqQ21p h649Pn9FT0xnOrDiiFPjeq8mtoi/4ldi3dyew5W3pp4jdvAnon3xIz1665BoRv1sqefZ n68MHDqAncL1s1uQz7Jl0F9qypdJZCM8dt8IhK20VHNtI7ZXkzsmpBoYDu8YMN15Y6bg zKmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686379918; x=1688971918; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MgCOYObNWJT5Zih6Rsxpv6C1qIQ4ATfBxk1szFeTj4M=; b=ihc3sdLK6aHxW90B1IGEDQkGWFZPR3QrREbU/m+y7p+0SyY/AowaBaVQXlHbBWd+Dm WuOwh/n0s5RSfTO7VZ+V9stRWPErUGIpQoP+6S0F9t89iXQkS+ig9cKG1jIIEhayY91f qkDbx0lWZBqzbsC2qiqvpabMWo8N2JOn7LDGw7AXdoYiRTkoIYf0TUTO7687t/le04VO lhIQo0Kl/2GxKUrotR2L3QBEuwQ3PYK4aj0pzX643rQvkeH8TwLpQzFbGTWbxf6o5RyT b7KCb7N4MIsClGIPY+PTmgh6lZsuziOpb6b+uKcaELDI8CgVsUel7afVFVnRwJGeWUMv 2o7w== X-Gm-Message-State: AC+VfDyr3UywLeRlkN4HYQo+I6ZlSO9vMe+rDEuiJK1Fcw5wCfVwaY+d DMXuHStpD2DFWClIaG5IBwQ= X-Google-Smtp-Source: ACHHUZ60muQni3v/EuYC9zZP8ERKWYV3UH9BBMJtxnFkSG9Yvrb3t28v3yCF4G7InHhSE56c84JTVw== X-Received: by 2002:a17:90a:ea8e:b0:258:ad45:936d with SMTP id h14-20020a17090aea8e00b00258ad45936dmr2974924pjz.19.1686379918425; Fri, 09 Jun 2023 23:51:58 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id c14-20020a17090a020e00b0023fcece8067sm4093364pjc.2.2023.06.09.23.51.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2023 23:51:58 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) From: Yuan Fu In-Reply-To: Date: Fri, 9 Jun 2023 23:51:46 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83mt1a33a4.fsf@gnu.org> <83legu333f.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Jun 8, 2023, at 12:19 AM, Yuan Fu wrote: >=20 >=20 >=20 >> On Jun 7, 2023, at 11:00 PM, Eli Zaretskii wrote: >>=20 >>> Date: Thu, 08 Jun 2023 08:56:51 +0300 >>> From: Eli Zaretskii >>>=20 >>>=20 >>> To reproduce: >>>=20 >>> emacs -Q >>> C-x C-f src/alloc.c RET >>> M-x c-ts-mode RET >>> C-u 3184 M-g g >>>=20 >>> Observe that several "else if" clauses in the following fragment are = not >>> fontified correctly: >>=20 >> Adding the relevant folks. >>=20 >> Could you guys please look into this issue? Ok, so this is one of such cases where the preproc directives severs the = code and the parser can=E2=80=99t recover very well. We can cover it = over by just fontifying =E2=80=9Celse if=E2=80=9D with keyword face, but = there are a million ways for the preproc directive to mess up the = parser, I don=E2=80=99t think we can cover every case. Yuan= From unknown Thu Jun 19 14:26:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63957: 29.0.91; c-ts-mode: incorrect fontification in alloc.c Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Jun 2023 08:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63957 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: 63957@debbugs.gnu.org, theo@thornhill.no Received: via spool by 63957-submit@debbugs.gnu.org id=B63957.16863846834562 (code B ref 63957); Sat, 10 Jun 2023 08:12:02 +0000 Received: (at 63957) by debbugs.gnu.org; 10 Jun 2023 08:11:23 +0000 Received: from localhost ([127.0.0.1]:33190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7tgx-0001BW-FA for submit@debbugs.gnu.org; Sat, 10 Jun 2023 04:11:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7tgv-0001BH-Nt for 63957@debbugs.gnu.org; Sat, 10 Jun 2023 04:11:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7tgp-000801-7y; Sat, 10 Jun 2023 04:11:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=3vXsN0S2rTAS5el0VxDobNYsqVAqJwLGD+f7ZZjArZM=; b=b/hQYNRM3+DlY6Ah14tK Pe1MFFkewTM7J1CDCSIfDAfyYwNDniy3XJxop/Di0wteJSLyMake8mdeyg+FZZURykGbVG8MHrSf/ rFvXV5Nm5Nd+a/U3LqkNfR5qfnkqRgGMDlu/ffu2n8DqkChSzKxzsHq6dWuHbtP56cxHPo07FkOc+ wTFyhA3L9xDsXPdept2Ut9wmHfF2UmqrUpfDkSak890TiIvXSDT+oQlN5zmO3CuZ/XETay8ZYgDPP t4J/cjnbXczsMci9IB8lwPS7QRAF0WyPJNzR97NLHjmG7uccSzwdYaF6ftKNQRxEqWDGRfAALjC/Y PowZtdRBYMut3g==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7tgo-000891-OJ; Sat, 10 Jun 2023 04:11:15 -0400 Date: Sat, 10 Jun 2023 11:11:24 +0300 Message-Id: <83zg57zqhf.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Yuan Fu on Fri, 9 Jun 2023 23:51:46 -0700) References: <83mt1a33a4.fsf@gnu.org> <83legu333f.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Fri, 9 Jun 2023 23:51:46 -0700 > Cc: Theodor Thornhill , > 63957@debbugs.gnu.org > > >>> emacs -Q > >>> C-x C-f src/alloc.c RET > >>> M-x c-ts-mode RET > >>> C-u 3184 M-g g > >>> > >>> Observe that several "else if" clauses in the following fragment are not > >>> fontified correctly: > >> > >> Adding the relevant folks. > >> > >> Could you guys please look into this issue? > > Ok, so this is one of such cases where the preproc directives severs the code and the parser can’t recover very well. We can cover it over by just fontifying “else if” with keyword face, but there are a million ways for the preproc directive to mess up the parser, I don’t think we can cover every case. Can you explain what is special in this particular case that is different from other preprocessor directives? I'd like to think if this case is important enough to try harder. Thanks. From unknown Thu Jun 19 14:26:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63957: 29.0.91; c-ts-mode: incorrect fontification in alloc.c Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Jun 2023 09:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63957 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 63957@debbugs.gnu.org, Theodor Thornhill Received: via spool by 63957-submit@debbugs.gnu.org id=B63957.16865614347030 (code B ref 63957); Mon, 12 Jun 2023 09:18:02 +0000 Received: (at 63957) by debbugs.gnu.org; 12 Jun 2023 09:17:14 +0000 Received: from localhost ([127.0.0.1]:38835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8dfl-0001pK-MU for submit@debbugs.gnu.org; Mon, 12 Jun 2023 05:17:13 -0400 Received: from mail-pl1-f173.google.com ([209.85.214.173]:60429) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8dfj-0001p5-L1 for 63957@debbugs.gnu.org; Mon, 12 Jun 2023 05:17:12 -0400 Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1b3c5389fa2so5839255ad.0 for <63957@debbugs.gnu.org>; Mon, 12 Jun 2023 02:17:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686561425; x=1689153425; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=s9zR1vMF7GIHCKkVjddFtt07Mn+fId4SgUhWF/RNktA=; b=YhOqafII/bIk29yB7d/0BnXSzoPnV7VY7/jg1t4JADTdQvHeDSJheqe6JgM/fkuVqw ndtEMprALCl98Na33zuuh78T5RcVRY8IkcISOXE0MmATNZQ8bTodF/A7g96tUDqNy4kb ggtBAMlxp14J5Ef4Rykdej1q3F1tWIWvUfGEmUsGLaO/FOGyB8wfe10jYans8GaUWtDe s6Kt7m/brs7vM2zRLrw1l/CzfItuK540c1MgxCyG+ps3nyKKBZPMupQMmEFXk63+kVeS 1rM2xhmlbvfJ0lGNfogsyEcVJhH87U0GpSqQBRdys2347HCAsV9WOQqFXBCvDMEErFNR KNLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686561425; x=1689153425; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s9zR1vMF7GIHCKkVjddFtt07Mn+fId4SgUhWF/RNktA=; b=TVu8pNIbIX4NbjrkqvE95RHV9Ey0/0OERn23GCqZOAF4mHHN1/gFRd83z6Rqj4z0WI DUs/PS7EuGWURM78xliBjGZM2lzTPuYdoMl9YTWiYyhv9goKB+jYpgiQkPaPB6ah+EVt v6nXfEoVuOYa3/RtiOO5/UbwwQcyctG4yNfvLYpAW/tdW8Qtciri3hGDGN4whHGMND1z BouBI8L2JfcDtEVvPfGJDLyndIi5ruDxhUqbYHivH6e7OkofUj3pPF83Dt2Xocdhm55+ DjH6ewW2tI46TWYWQhSFJl4y25VCDz/TDw/3WTyxUcgrMRwdO3jJBzChTfgb2UHM5uDK dqPw== X-Gm-Message-State: AC+VfDwkxYfpD9rpCcdSmOvdNNvGH73no0EKk9MiGY65uVPMBCybcbmW RN8ETEDg0LxASWLDZ+eMcwD6LKPhUOI= X-Google-Smtp-Source: ACHHUZ4tT3BcbLmg4S+4tSXMb9MdQLXq105oiAP2B14DkqfRlDuahLRmV1bSPioKOuIzDwTiQyuGeg== X-Received: by 2002:a17:903:2582:b0:1b2:43a2:f2d with SMTP id jb2-20020a170903258200b001b243a20f2dmr5022870plb.32.1686561425510; Mon, 12 Jun 2023 02:17:05 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id f13-20020a170902ce8d00b001b0358848b0sm1030078plg.161.2023.06.12.02.17.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2023 02:17:04 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) From: Yuan Fu In-Reply-To: <83zg57zqhf.fsf@gnu.org> Date: Mon, 12 Jun 2023 02:16:51 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <14362329-D74B-42C9-879D-CE61CA6969A6@gmail.com> References: <83mt1a33a4.fsf@gnu.org> <83legu333f.fsf@gnu.org> <83zg57zqhf.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>=20 >>>>> emacs -Q >>>>> C-x C-f src/alloc.c RET >>>>> M-x c-ts-mode RET >>>>> C-u 3184 M-g g >>>>>=20 >>>>> Observe that several "else if" clauses in the following fragment = are not >>>>> fontified correctly: >>>>=20 >>>> Adding the relevant folks. >>>>=20 >>>> Could you guys please look into this issue? >>=20 >> Ok, so this is one of such cases where the preproc directives severs = the code and the parser can=E2=80=99t recover very well. We can cover it = over by just fontifying =E2=80=9Celse if=E2=80=9D with keyword face, but = there are a million ways for the preproc directive to mess up the = parser, I don=E2=80=99t think we can cover every case. >=20 > Can you explain what is special in this particular case that is > different from other preprocessor directives? I'd like to think if > this case is important enough to try harder. I wouldn=E2=80=99t say that this case is special, actually the cases we = were able to more or less fix are special. The problem with preproc = directives is that they can appear anywhere and break whatever construct = they appear in. (Because tree-sitter-c parses preproc constructs as = top-level constructs, higher than anything else.) Say there=E2=80=99s a struct: struct A { int a; int b; } If we add preproc directives: struct A { #if A int a; #else =20 int b; } #endif Now the parser will parse the "struct A {=E2=80=9C individually; parse = =E2=80=9Cint a;=E2=80=9D individually; and parse =E2=80=9Cint b; }=E2=80=9D= individually. So in general, if a preproc directives butchers some construct, the = first part is usually fine (eg, the =E2=80=9Cstruct A {=E2=80=9C part), = but the rest often have problems. Like a dangling =E2=80=9Celse if {}=E2=80= =9D in if-else-if, or a dangling =E2=80=9Cxxx }=E2=80=9D in a function = definition, or maybe a =E2=80=9Cdefault: xxx }=E2=80=9D in a = switch-case. The Emacs-specific macros we were able to =E2=80=9Cfix=E2=80=9D all have = a specific pattern, so we can find them and expect them to have a = certain shape, but the breakage caused by preproc directives don=E2=80=99t= really have a pattern. I can=E2=80=99t think of a good way to handle = them. I=E2=80=99m not against fixing these case-by-case, if the cases becomes = too many and not scalable, we can give up. Yuan= From unknown Thu Jun 19 14:26:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63957: 29.0.91; c-ts-mode: incorrect fontification in alloc.c Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Jun 2023 12:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63957 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: 63957@debbugs.gnu.org, theo@thornhill.no Received: via spool by 63957-submit@debbugs.gnu.org id=B63957.16865734996578 (code B ref 63957); Mon, 12 Jun 2023 12:39:01 +0000 Received: (at 63957) by debbugs.gnu.org; 12 Jun 2023 12:38:19 +0000 Received: from localhost ([127.0.0.1]:39157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8goM-0001i2-W7 for submit@debbugs.gnu.org; Mon, 12 Jun 2023 08:38:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8goI-0001hh-TN for 63957@debbugs.gnu.org; Mon, 12 Jun 2023 08:38:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q8goC-0002kn-Um; Mon, 12 Jun 2023 08:38:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=vV9puZYvzcpEK8hMnvaT1jhS+OJPLeAo5mrQsH61mMg=; b=kVK/igUZzQb6Ex9qnnON ATv8jfqfb6BGwF5n1eEQdFelC8ItoYcGDQU496wXhdoChMwz8szKiVOE08VJPcbWq4WSNQBLMfzcd k4IZTu8NlwgUDNmkih4Zek9Y+OgJCHqqoS6KWfJv0B6WvFJO5KS6lx7YWmzeL+NS4/F0hQCc0Is7H 3YTHdhLXOV2nE1VFAq2/of0KquG4A4tOoOTbZkWet4u9/z5jgk3LqKJ9SRxQX3nc3/62zGUE5EAW7 168ml25Vbzi0m0X6k9rwdLWcY00hXuzVcR/lq37RjpMnkdLg1WVPkDZZnseIK4sidwz3CYOC1nW43 GTNPj1E3csQTGw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q8goC-00037j-7d; Mon, 12 Jun 2023 08:38:08 -0400 Date: Mon, 12 Jun 2023 15:38:22 +0300 Message-Id: <83h6rcyhxd.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <14362329-D74B-42C9-879D-CE61CA6969A6@gmail.com> (message from Yuan Fu on Mon, 12 Jun 2023 02:16:51 -0700) References: <83mt1a33a4.fsf@gnu.org> <83legu333f.fsf@gnu.org> <83zg57zqhf.fsf@gnu.org> <14362329-D74B-42C9-879D-CE61CA6969A6@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Mon, 12 Jun 2023 02:16:51 -0700 > Cc: Theodor Thornhill , > 63957@debbugs.gnu.org > > If we add preproc directives: > > struct A > { > #if A > int a; > #else > int b; > } > #endif > > Now the parser will parse the "struct A {“ individually; parse “int a;” individually; and parse “int b; }” individually. > > So in general, if a preproc directives butchers some construct, the first part is usually fine (eg, the “struct A {“ part), but the rest often have problems. Like a dangling “else if {}” in if-else-if, or a dangling “xxx }” in a function definition, or maybe a “default: xxx }” in a switch-case. Thanks.