From unknown Mon Aug 18 15:40:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 May 2019 22:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35768 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 35768@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs Received: via spool by submit@debbugs.gnu.org id=B.155804518124373 (code B ref -1); Thu, 16 May 2019 22:20:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 May 2019 22:19:41 +0000 Received: from localhost ([127.0.0.1]:56676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hROiy-0006L3-T8 for submit@debbugs.gnu.org; Thu, 16 May 2019 18:19:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46509) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hROiw-0006Ko-I5 for submit@debbugs.gnu.org; Thu, 16 May 2019 18:19:39 -0400 Received: from lists.gnu.org ([209.51.188.17]:43944) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hROiq-0005Yz-Lc for submit@debbugs.gnu.org; Thu, 16 May 2019 18:19:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hROio-0002Ar-OD for bug-gnu-emacs@gnu.org; Thu, 16 May 2019 18:19:32 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hROim-0005Rr-RP for bug-gnu-emacs@gnu.org; Thu, 16 May 2019 18:19:30 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]:38643) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hROil-0005Lc-0S for bug-gnu-emacs@gnu.org; Thu, 16 May 2019 18:19:27 -0400 Received: by mail-lf1-x136.google.com with SMTP id y19so3847388lfy.5 for ; Thu, 16 May 2019 15:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=OI0m12DgB+zxFosSQ2y6IOzaryJmIhWuY1YaJTIlmZU=; b=FLlhNp3Dh3/PRivdtvZJDfsa470SxbjCN8e8innSSrFvFiJGIVZFiTXMo45tyxs8sL UaJHo9e2f+uuxHPT79lTGnRyPFxsju+neYVNF9SIXlWnCWG7OX1o2i4cIdqqa7kPUMAK MgfxegBarq6R5tMgoK3YvEe94s4Fn2bpbHJ3in4v8Ary3LS4JXUPn266Scwt9uJKxeNC c+lqTpasd5zdFJoHHP6dypZLVuaLg+8gLAUTSaYKnTW6kAJnC/6QUUlzLIRBBAnpgsa9 +vFqj7g+V5GAKv7dis2bC8rjrvGB+fdSfK+vXAUj7egl6qLH+mtvqIFX+wrBj/Qbf6W+ u43Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=OI0m12DgB+zxFosSQ2y6IOzaryJmIhWuY1YaJTIlmZU=; b=e1TBqICCoVT7MfIeOZeo3Q9QDWdPMAuXSJ7IRmjr2zb/T0j8FzKe9qtogLb6MitHWR LQFUgQ8Ilh5lRfZBII8gDQPsup3GVtkoUd/yIHJ5PeomPUgU1Syc3MTUT/Iw64+L80Ao BUjbKkI+VWUCNuBgvxD804WjgNz6QR9vikh4kld5Whg+N97EApMGqVeMaJkV9MJFHqR4 eA0V449V4TMxjeLo5K04xnltbypxY7HMOUtEiDYgt5MKy3g+FKPp6LGaISFjtgQYNQGQ CTpnaegsnhCXwMfti83Vm2tjq3Z5XIOWxVPh0rAHZH2KHZpH6Yc/SvujtFlb/eCWTI+J w7ew== X-Gm-Message-State: APjAAAXm9wRk98KPnnwNCtUsf74UmfBjWHt8ttLeJ76hpSVNQkRNOtyw sLCB1qoOmDqsuQZJfm8jE72GJshAGuIpNXyd1AE4GIQh X-Google-Smtp-Source: APXvYqw3irIrTxHDR/VunqE7KTKbVmoFJBNdrF1RDP4RrxPoP7clpCYxmDSDCWWbm4/y0WhjejoRDATV6/JgW/NhCO8= X-Received: by 2002:ac2:4a6e:: with SMTP id q14mr7464981lfp.46.1558045161803; Thu, 16 May 2019 15:19:21 -0700 (PDT) MIME-Version: 1.0 From: Mauro Aranda Date: Thu, 16 May 2019 19:19:09 -0300 Message-ID: Content-Type: multipart/alternative; boundary="00000000000069d55c058908a845" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::136 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.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: -2.3 (--) --00000000000069d55c058908a845 Content-Type: text/plain; charset="UTF-8" Hello. I noticed CC-Mode sometimes doesn't identify correctly function names when a macro name is involved in the function definition. Try the following recipe to see the problem: 1) emacs -Q 2) C-x C-f test.c 3) Type the following function definitions: int DUMMY foo (void) { return 1; } DUMMY int bar (void) { return 0; } 4) Observe that: a) foo doesn't get fontified with font-lock-function-name-face, but DUMMY does. Consequently, C-c C-z inside foo echoes DUMMY as the function name, in the echo area. b) In bar, DUMMY gets font-lock-type-face, which I don't think is correct. bar gets font-lock-function-name-face and C-c C-z works as expected. --- Other problem is with fontification of the return type in the following: bool DUMMY baz_t (void) { return true; } bool baz_f (void) { return false; } Observe that bool doesn't get fontified in baz_t, but DUMMY does. When DUMMY is not present, bool gets fontified correctly (as in baz_f). If it helps, I found the problem in a source file with functions that have macros that declare some function attributes, like _GL_ATTRIBUTE_PURE. Best regards, Mauro. In GNU Emacs 27.0.50 (build 5, i686-pc-linux-gnu, GTK+ Version 3.18.9) of 2019-05-15 built on the-blackbeard Repository revision: 50b1ce0185cd7b5f8be124eb4a612fd56e4e0657 Repository branch: revert-buffer-with-fine-grain Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Ubuntu 16.04.6 LTS Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure CFLAGS=-O3' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS PDUMPER LCMS2 GMP Important settings: value of $LANG: en_US.utf8 value of $XMODIFIERS: locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-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 auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date 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 elec-pair mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic 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 charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 8 43995 8711) (symbols 24 5878 1) (strings 16 14997 2517) (string-bytes 1 501374) (vectors 8 8875) (vector-slots 4 114380 10618) (floats 8 18 13) (intervals 28 194 0) (buffers 564 11) (heap 1024 7599 790)) --00000000000069d55c058908a845 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello.

I noticed CC-Mode sometimes= doesn't identify correctly function names
when a macro name is invo= lved in the function definition.=C2=A0 Try the
following recipe to see t= he problem:

1) emacs -Q
2) C-x C-f test.c
3) Type the followin= g function definitions:

int DUMMY
foo (void)
{
=C2=A0 retur= n 1;
}

DUMMY int
bar (void)
{
=C2=A0 return 0;
}
<= br>4) Observe that:
a) foo doesn't get fontified with font-lock-func= tion-name-face, but
DUMMY does.=C2=A0 Consequently, C-c C-z inside foo e= choes
DUMMY as the function name, in the echo area.
b) In bar, DUMMY = gets font-lock-type-face, which I don't
think is correct.=C2=A0 bar = gets font-lock-function-name-face and C-c C-z
works as expected.

= ---

Other problem is with fontification of the return type in the fo= llowing:

bool DUMMY
baz_t (void)
{
=C2=A0 return true;
}=

bool
baz_f (void)
{
=C2=A0 return false;
}

Obser= ve that bool doesn't get fontified in baz_t, but DUMMY does.=C2=A0 When=
DUMMY is not present, bool gets fontified correctly (as in baz_f).
<= br>
If it helps, I found the problem in a source file with functions tha= t
have macros that declare some function attributes, like
_GL_ATTRIBU= TE_PURE.

Best regards,
Mauro.



In GNU Emacs 27.0.50= (build 5, i686-pc-linux-gnu, GTK+ Version 3.18.9)
=C2=A0of 2019-05-15 b= uilt on the-blackbeard
Repository revision: 50b1ce0185cd7b5f8be124eb4a61= 2fd56e4e0657
Repository branch: revert-buffer-with-fine-grain
Windowi= ng system distributor 'The X.Org Foundation', version 11.0.11906000=
System Description: Ubuntu 16.04.6 LTS

Recent messages:
For i= nformation about GNU Emacs and the GNU system, type C-h C-a.

Configu= red using:
=C2=A0'configure CFLAGS=3D-O3'

Configured feat= ures:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY IN= OTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIBTOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS PDUMPER LCMS2 GMP

Imp= ortant settings:
=C2=A0 value of $LANG: en_US.utf8
=C2=A0 value of $X= MODIFIERS:
=C2=A0 locale-coding-system: utf-8-unix

Major mode: L= isp Interaction

Minor modes in effect:
=C2=A0 tooltip-mode: t
= =C2=A0 global-eldoc-mode: t
=C2=A0 eldoc-mode: t
=C2=A0 electric-inde= nt-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2= =A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-fo= nt-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t<= br>=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode: t
=C2= =A0 auto-compression-mode: t
=C2=A0 line-number-mode: t
=C2=A0 transi= ent-mark-mode: t

Load-path shadows:
None found.

Features:<= br>(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
byte= comp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
easy= menu mml-sec password-cache epa derived epg epg-config gnus-util
rmail r= mail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-enco= de mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib= sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
elec-= pair mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-= float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fo= ntset image regexp-opt fringe tabulated-list replace newcomment
text-mod= e elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isea= rch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu fon= t-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-la= ng vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932= hebrew greek romanian slovak czech european
ethiopic indian cyrillic ch= inese composite charscript charprop
case-table epa-hook jka-cmpr-hook he= lp simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button= faces cus-face macroexp files
text-properties overlay sha1 md5 base64 f= ormat env code-pages mule
custom widget hashtable-print-readable backquo= te threads dbusbind
inotify lcms2 dynamic-setting system-font-setting fo= nt-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-pr= ocess emacs)

Memory information:
((conses 8 43995 8711)
=C2=A0= (symbols 24 5878 1)
=C2=A0(strings 16 14997 2517)
=C2=A0(string-bytes= 1 501374)
=C2=A0(vectors 8 8875)
=C2=A0(vector-slots 4 114380 10618)=
=C2=A0(floats 8 18 13)
=C2=A0(intervals 28 194 0)
=C2=A0(buffers = 564 11)
=C2=A0(heap 1024 7599 790))

--00000000000069d55c058908a845-- From unknown Mon Aug 18 15:40:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 16 May 2019 23:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35768 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Mauro Aranda Cc: 35768@debbugs.gnu.org Received: via spool by 35768-submit@debbugs.gnu.org id=B35768.15580501851113 (code B ref 35768); Thu, 16 May 2019 23:44:01 +0000 Received: (at 35768) by debbugs.gnu.org; 16 May 2019 23:43:05 +0000 Received: from localhost ([127.0.0.1]:56747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRQ1g-0000Ht-QZ for submit@debbugs.gnu.org; Thu, 16 May 2019 19:43:05 -0400 Received: from mail-it1-f173.google.com ([209.85.166.173]:50236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRQ1f-0000HK-4a for 35768@debbugs.gnu.org; Thu, 16 May 2019 19:43:03 -0400 Received: by mail-it1-f173.google.com with SMTP id i10so9114072ite.0 for <35768@debbugs.gnu.org>; Thu, 16 May 2019 16:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=nbesGsOXZGn4BRBx9aFsTWLreP+A3Wl9pnfzn5m+XvI=; b=JcbEtxZlz/OrDS9ZxbGXLB7KwWAXtyXu4USu1CIi51nEnmnX6Q66IOOqVsI6BWE/ND cWD8KGPOOxBVHybazTXbsOwG0NW3+inng7DlG7un2jCb0GgvyT7DKVAbVCVUg19ns+1u J09wXIX61asr24Ez34dudxVr3WytwXuVf3ZIWDCYNXCiP9BNkbYLIW0z+A9om9WfC32l ffYhoD8vix6wjHLJiuxcXkskmV1vr7319AvkJdtb9Phd/8RKqEG+mvXetX1GIy9Xu3n9 6Uoie3vvTTWaNLqxcyq9Hew7RqQEIM6qce7YUzKXabBax+fsHf+LiwO5L6KckgXjPqNl u2HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=nbesGsOXZGn4BRBx9aFsTWLreP+A3Wl9pnfzn5m+XvI=; b=Zyygx2amTOr7a5lsT1Y04Cg3kpexhSoz+TDJc5+7f6qQuULQ6CLFhCSly6+rSs1G4w TzW7i+JuKerBND5GHQ18TLOaCKI+v/bsZTJ2sEuFqtM6njZohdjZ3sxq90Af4EVYC9Ns u0cgcz79snqGn+G8GOznCzoTOAkme1myX5hdUimgU8r6yM+i4WtWDBb31Wp+bEXMLkwZ R0cNG0OaUu0HD44vRaVaB2msWf2MYKIc0SyuNaiUHBl+TZ3z2+bZnC6VfEzLkHBdLzvI jiE5EOeXXr4JagctEj51/ae59ciG0gdhML1s1IMo5JxemaqhRapU9QmfScc4fojYsI6W dr+Q== X-Gm-Message-State: APjAAAXu4jWE8++usMW0x9t+bOt1fZtWTjj4SheI7ATzTZCdm3LUjlrq rGH8tGRkBhMD+/y4UMNPTAxtgQjM X-Google-Smtp-Source: APXvYqx/aT+LoDAaxj8eoaYqxzvpbYRgtBfZcQN7VEoT3oMS1TGj1SqfKeB9GzzXiNeOb2/bmmh5Kg== X-Received: by 2002:a24:47c2:: with SMTP id t185mr256824itb.97.1558050177336; Thu, 16 May 2019 16:42:57 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id e23sm2356966iob.43.2019.05.16.16.42.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 May 2019 16:42:56 -0700 (PDT) From: Noam Postavsky References: Date: Thu, 16 May 2019 19:42:55 -0400 In-Reply-To: (Mauro Aranda's message of "Thu, 16 May 2019 19:19:09 -0300") Message-ID: <87k1eqdkzk.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 (-) Mauro Aranda writes: > I noticed CC-Mode sometimes doesn't identify correctly function names > when a macro name is involved in the function definition. Try the > following recipe to see the problem: > > 1) emacs -Q > 2) C-x C-f test.c > 3) Type the following function definitions: > > int DUMMY > foo (void) > { > return 1; > } > > DUMMY int > bar (void) > { > return 0; > } > > 4) Observe that: > a) foo doesn't get fontified with font-lock-function-name-face, but > DUMMY does. Consequently, C-c C-z inside foo echoes > DUMMY as the function name, in the echo area. > b) In bar, DUMMY gets font-lock-type-face, which I don't > think is correct. bar gets font-lock-function-name-face and C-c C-z > works as expected. > > --- > > Other problem is with fontification of the return type in the following: > > bool DUMMY > baz_t (void) > { > return true; > } > > bool > baz_f (void) > { > return false; > } > > Observe that bool doesn't get fontified in baz_t, but DUMMY does. When > DUMMY is not present, bool gets fontified correctly (as in baz_f). > > > If it helps, I found the problem in a source file with functions that > have macros that declare some function attributes, like > _GL_ATTRIBUTE_PURE. Have you tried customizing c-noise-macro-names, as described in (ccmode) Noise Macros? From unknown Mon Aug 18 15:40:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Fri, 17 May 2019 12:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35768 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Noam Postavsky Cc: 35768@debbugs.gnu.org Received: via spool by 35768-submit@debbugs.gnu.org id=B35768.15580968333939 (code B ref 35768); Fri, 17 May 2019 12:41:01 +0000 Received: (at 35768) by debbugs.gnu.org; 17 May 2019 12:40:33 +0000 Received: from localhost ([127.0.0.1]:57721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRcA4-00011S-PI for submit@debbugs.gnu.org; Fri, 17 May 2019 08:40:33 -0400 Received: from mail-lj1-f177.google.com ([209.85.208.177]:45217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRcA1-00011A-MA for 35768@debbugs.gnu.org; Fri, 17 May 2019 08:40:31 -0400 Received: by mail-lj1-f177.google.com with SMTP id r76so6113368lja.12 for <35768@debbugs.gnu.org>; Fri, 17 May 2019 05:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uGdeod1Iv8fRHu5h6cKaLkcv3PZi19GYxpWJUnjQ9vg=; b=PK/iFoXMl345BNEFlI9IjIFLUc18ZUgMVmDBxyEUmzHAlA8ut6TtzyMr+3CsdRpJ3o slW3pwIDKBoWrweHUFfwIyge0jJVPJze2MhQNfE3b55AjdHG+Gjfitd29iv/RHuJ2u4X h05CVsNQStWeBPlq7d36Ago8sc+SITImldclylee0s3pKPbvbMMrp4pKUubYm7ZKnj3X qSOiDZeTCqFQmzUjY15qlJsV6K0Mk4Nkm6nfOOOhoO5i5GOkeh37CSdt1VHm71BFQNxE 1MicynihIV8vta3q2QlEsh0kxML2K9z59MoHilToyff9Z4k9lZcNJr7FZ+7LWGr1Gn6B KQdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uGdeod1Iv8fRHu5h6cKaLkcv3PZi19GYxpWJUnjQ9vg=; b=Q52Jyyz1FByFIXHypW9s1uBXQO5c1THDLLtuc28+HF9iB1K/gLYGkGMZ4hiaU7jAn6 71QbZLqZ6YjXRuXayKOL3dFoFX8oAllEfEBkEFJRrgFGCOF1G7dswk02fSDtUn9Rdtr3 KYCCmE16lOrnU1GSA0sS8YuJePc2+zijQ5CtQrY2VtFJ9mlMXbhc7HZA/DLO4EqiC3n+ s9t3U2a1DKBK8PXwC7/EmqkRPmC+0xBVJJv/VX2uPW+fU3xeys1DB3DMWGbxze37txPm VuFsRKtir876ggCJzqhV6vPQyoyFBYH4dFwAj+iu0DRhFOjfLmYO1EBWjQ8oaq1WNrYm mIBw== X-Gm-Message-State: APjAAAWIh+y8pIQVFkcCwdo662+xFYlRmGG4NjWLC2TLR4gASDKbFhda QUKVlOFI6LokgAMfhOI7TPGNYVGWx4+DaV0oC+E= X-Google-Smtp-Source: APXvYqwSRUUnRCgiRgrAnE0JhIF9WKS9mJhbbUN7GCsyceSXhWXpUvWt5NDERZiDMMYWSL0uY617qBRX/oCY+JpOuWU= X-Received: by 2002:a2e:b051:: with SMTP id d17mr16641502ljl.173.1558096822541; Fri, 17 May 2019 05:40:22 -0700 (PDT) MIME-Version: 1.0 References: <87k1eqdkzk.fsf@gmail.com> In-Reply-To: <87k1eqdkzk.fsf@gmail.com> From: Mauro Aranda Date: Fri, 17 May 2019 09:40:09 -0300 Message-ID: Content-Type: multipart/alternative; boundary="000000000000a2208e058914af43" 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 (-) --000000000000a2208e058914af43 Content-Type: text/plain; charset="UTF-8" > Have you tried customizing c-noise-macro-names, as described in (ccmode) Noise Macros? Hello Noam, thanks for your answer. I didn't know of c-noise-macro-names, thanks. If after step 1) I eval the following: (defun my-c-mode-hook () (setq c-noise-macro-names (append c-noise-macro-names '("DUMMY"))) (c-make-noise-macro-regexps)) (add-hook 'c-mode-hook 'my-c-mode-hook) And then follow the steps of my recipe, CC Mode works correctly. However, the following recipe exposes another problem, I think: 1) emacs -Q 2) Eval the following: (defun my-c-mode-hook () (setq c-noise-macro-with-parens-names (append c-noise-macro-with-parens-names '("DUMMY_1" "DUMMY_2"))) (c-make-noise-macro-regexps)) (add-hook 'c-mode-hook 'my-c-mode-hook) 3) C-x C-f test.c 4) Type the following (no need to type the #define lines, that's just for completion) #define DUMMY_1(params) #define DUMMY_2(params) int DUMMY_1 (1) DUMMY_2 (2) foo (void) { return 0; } 5) Observe that DUMMY_1 (1) is ignored as expected, but DUMMY_2 gets font-lock-type-face. I think that's not right. 6) To be sure that I customized c-noise-macro-with-parens-names correctly, I tried a regexp search with c-noise-macro-with-parens-name-re, from the beginning of the buffer: (re-search-forward c-noise-macro-with-parens-name-re) That gets four hits, as it should (2 for DUMMY_1 and 2 for DUMMY_2), meaning that it does find DUMMY_2 as a noise macro with parens. Is that a bug? Or is there something else I can use to help CC Mode not get confused? Best regards, Mauro. --000000000000a2208e058914af43 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> Have you tried customizing c-noise-m= acro-names, as described in (ccmode) Noise Macros?

Hello Noam, thank= s for your answer.

I didn't know of c-noise-macro-names, thanks.= =C2=A0 If after step 1) I eval
the following:
(defun my-c-mode-hook (= )
=C2=A0 (setq c-noise-macro-names (append c-noise-macro-names '(&qu= ot;DUMMY")))
=C2=A0 (c-make-noise-macro-regexps))
(add-hook '= ;c-mode-hook 'my-c-mode-hook)

And then follow the steps of my re= cipe, CC Mode works correctly.


However, the following recipe exp= oses another problem, I think:
1) emacs -Q
2) Eval the following:
= (defun my-c-mode-hook ()
=C2=A0 (setq c-noise-macro-with-parens-names (a= ppend c-noise-macro-with-parens-names
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 '("DUMMY_1" "DUMMY_2")))=C2=A0 (c-make-noise-macro-regexps))
(add-hook 'c-mode-hook 'm= y-c-mode-hook)

3) C-x C-f test.c
4) Type the following (no need t= o type the #define lines, that's just for completion)
#define DUMMY_= 1(params)
#define DUMMY_2(params)

int DUMMY_1 (1) DUMMY_2 (2)
= foo (void)
{
=C2=A0 return 0;
}

5) Observe that DUMMY_1 (1)= is ignored as expected, but DUMMY_2 gets
font-lock-type-face.=C2=A0 I t= hink that's not right.

6) To be sure that I customized c-noise-m= acro-with-parens-names correctly, I
tried a regexp search with c-noise-m= acro-with-parens-name-re, from the
beginning of the buffer:
(re-searc= h-forward c-noise-macro-with-parens-name-re)
That gets four hits, as it = should (2 for DUMMY_1 and 2 for DUMMY_2), meaning
that it does find DUMM= Y_2 as a noise macro with parens.

Is that a bug? Or is there somethi= ng else I can use to help CC Mode not get
confused?

Best regards,=
Mauro.
--000000000000a2208e058914af43-- From unknown Mon Aug 18 15:40:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 18 May 2019 12:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35768 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Mauro Aranda Cc: 35768@debbugs.gnu.org, Noam Postavsky Received: via spool by 35768-submit@debbugs.gnu.org id=B35768.155818419829128 (code B ref 35768); Sat, 18 May 2019 12:57:02 +0000 Received: (at 35768) by debbugs.gnu.org; 18 May 2019 12:56:38 +0000 Received: from localhost ([127.0.0.1]:60267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRytA-0007Zh-CM for submit@debbugs.gnu.org; Sat, 18 May 2019 08:56:38 -0400 Received: from colin.muc.de ([193.149.48.1]:18188 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hRyt8-0007ZW-9O for 35768@debbugs.gnu.org; Sat, 18 May 2019 08:56:35 -0400 Received: (qmail 70315 invoked by uid 3782); 18 May 2019 12:56:30 -0000 Received: from acm.muc.de (p2E5D5A2C.dip0.t-ipconnect.de [46.93.90.44]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 18 May 2019 14:56:28 +0200 Received: (qmail 6335 invoked by uid 1000); 18 May 2019 12:56:28 -0000 Date: Sat, 18 May 2019 12:56:28 +0000 Message-ID: <20190518125628.GA6231@ACM> References: <87k1eqdkzk.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de 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 (-) Hello, Mauro. On Fri, May 17, 2019 at 09:40:09 -0300, Mauro Aranda wrote: [ .... ] > However, the following recipe exposes another problem, I think: > 1) emacs -Q > 2) Eval the following: > (defun my-c-mode-hook () > (setq c-noise-macro-with-parens-names (append > c-noise-macro-with-parens-names > '("DUMMY_1" "DUMMY_2"))) > (c-make-noise-macro-regexps)) > (add-hook 'c-mode-hook 'my-c-mode-hook) > 3) C-x C-f test.c > 4) Type the following (no need to type the #define lines, that's just for > completion) > #define DUMMY_1(params) > #define DUMMY_2(params) > int DUMMY_1 (1) DUMMY_2 (2) > foo (void) > { > return 0; > } > 5) Observe that DUMMY_1 (1) is ignored as expected, but DUMMY_2 gets > font-lock-type-face. I think that's not right. It's not right, no. > 6) To be sure that I customized c-noise-macro-with-parens-names correctly, I > tried a regexp search with c-noise-macro-with-parens-name-re, from the > beginning of the buffer: > (re-search-forward c-noise-macro-with-parens-name-re) > That gets four hits, as it should (2 for DUMMY_1 and 2 for DUMMY_2), meaning > that it does find DUMMY_2 as a noise macro with parens. Just as a matter of interest, I also tried putting "DUMMY_3" into c-noise-macro-names, and inserting it in the middle of the pertinent line in your test file. > Is that a bug? Or is there something else I can use to help CC Mode not get > confused? It's a bug. I hope the following patch fixes it. Would you please apply this patch, try it out in your real code, and confirm it fixes the bug, or tell me what's still not working. Thanks! diff -r 43b8aba74b73 cc-engine.el --- a/cc-engine.el Wed May 15 08:45:55 2019 +0000 +++ b/cc-engine.el Sat May 18 12:45:53 2019 +0000 @@ -4500,6 +4500,30 @@ (goto-char pos)))))) (< (point) start))) +(defun c-end-of-token (&optional back-limit) + ;; Move to the end of the token we're just before or in the middle of. + ;; BACK-LIMIT may be used to bound the backward search; if given it's + ;; assumed to be at the boundary between two tokens. Return non-nil if the + ;; point is moved, nil otherwise. + ;; + ;; This function might do hidden buffer changes. + (let ((start (point))) + (cond ;; ((< (skip-syntax-backward "w_" (1- start)) 0) + ;; (skip-syntax-forward "w_")) + ((> (skip-syntax-forward "w_") 0)) + ((< (skip-syntax-backward ".()" back-limit) 0) + (while (< (point) start) + (if (looking-at c-nonsymbol-token-regexp) + (goto-char (match-end 0)) + ;; `c-nonsymbol-token-regexp' should always match since + ;; we've skipped backward over punctuation or paren + ;; syntax, but move forward in case it doesn't so that + ;; we don't leave point earlier than we started with. + (forward-char)))) + (t (if (looking-at c-nonsymbol-token-regexp) + (goto-char (match-end 0))))) + (> (point) start))) + (defun c-end-of-current-token (&optional back-limit) ;; Move to the end of the current token. Do not move if not in the ;; middle of one. BACK-LIMIT may be used to bound the backward @@ -5885,9 +5909,14 @@ ;; comment style has removed face properties from a construct, ;; and is relying on `c-font-lock-declarations' to add them ;; again. - (and (< (point) cfd-limit) - (looking-at c-doc-line-join-re) - (goto-char (match-end 0))))) + (cond + ((looking-at c-noise-macro-name-re) + (c-forward-noise-clause-not-macro-decl nil)) ; Returns t. + ((looking-at c-noise-macro-with-parens-name-re) + (c-forward-noise-clause-not-macro-decl t)) ; Always returns t. + ((and (< (point) cfd-limit) + (looking-at c-doc-line-join-re)) + (goto-char (match-end 0)))))) ;; Set the position to continue at. We can avoid going over ;; the comments skipped above a second time, but it's possible ;; that the comment skipping has taken us past `cfd-prop-match' @@ -5916,6 +5945,8 @@ ;; o The first token after the end of submatch 1 in ;; `c-decl-prefix-or-start-re' when that submatch matches. This ;; submatch is typically a (L or R) brace or paren, a ;, or a ,. + ;; As a special case, noise macros are skipped over and the next + ;; token regarded as the spot. ;; o The start of each `c-decl-prefix-or-start-re' match when ;; submatch 1 doesn't match. This is, for example, the keyword ;; "class" in Pike. @@ -7452,6 +7483,21 @@ (c-forward-syntactic-ws)) t) +(defun c-forward-noise-clause-not-macro-decl (maybe-parens) + ;; Point is at a noise macro identifier, which, when MAYBE-PARENS is + ;; non-nil, optionally takes paren arguments. Go forward over this name, + ;; and when there may be optional parens, any parenthesis expression which + ;; follows it, but DO NOT go over any macro declaration which may come + ;; between them. Always return t. + (c-end-of-token) + (when maybe-parens + (let ((here (point))) + (c-forward-comments) + (if (not (and (eq (char-after) ?\() + (c-go-list-forward))) + (goto-char here)))) + t) + (defun c-forward-keyword-clause (match) ;; Submatch MATCH in the current match data is assumed to surround a ;; token. If it's a keyword, move over it and any immediately @@ -9060,7 +9106,10 @@ ((and c-opt-cpp-prefix (looking-at c-noise-macro-with-parens-name-re)) (setq noise-start (point)) - (c-forward-noise-clause) + (while + (and + (c-forward-noise-clause) + (looking-at c-noise-macro-with-parens-name-re))) (setq kwd-clause-end (point)))) (when (setq found-type (c-forward-type t)) ; brace-block-too > Best regards, > Mauro. -- Alan Mackenzie (Nuremberg, Germany). From unknown Mon Aug 18 15:40:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 18 May 2019 13:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35768 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Alan Mackenzie Cc: 35768@debbugs.gnu.org, Noam Postavsky Received: via spool by 35768-submit@debbugs.gnu.org id=B35768.15581878192715 (code B ref 35768); Sat, 18 May 2019 13:57:01 +0000 Received: (at 35768) by debbugs.gnu.org; 18 May 2019 13:56:59 +0000 Received: from localhost ([127.0.0.1]:60991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRzpa-0000hj-RO for submit@debbugs.gnu.org; Sat, 18 May 2019 09:56:59 -0400 Received: from mail-lj1-f179.google.com ([209.85.208.179]:45101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRzpX-0000hR-A1 for 35768@debbugs.gnu.org; Sat, 18 May 2019 09:56:57 -0400 Received: by mail-lj1-f179.google.com with SMTP id r76so8633956lja.12 for <35768@debbugs.gnu.org>; Sat, 18 May 2019 06:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S9nz82XWPJqsEXqeZI8uptghwD3J3h6sMo2epvz2BnM=; b=Pf5T2dGObefrF5GaZ/ZWocYBbwbartV3d6ovoYMB09FlKqAFyCatmqOFLuvodBWNu5 ye79MTVoRmW+HXLv8Yz3rkEiOvd8vhveQKFQb0ZEEtAXp9jiqKseGkGqzHYZyMEpI+YR KaYu03in9Am5ZRXDzhy+WS/aj4ttHWCJ8wALh56sBD1nX4M52G279TCrhPNm7wNzuLuz wpObQYAUTmrxsomUIXgi7vsGbNz8O8jGhQ1wZsscA746XhgMHaSMDz1VKPA+vMaT/jsd JsVWPcmTVu2Bcr3SdMupyYrt0WkKxrYe4ZgtTzgIsxNBIA3vi8czFBXsPGBobL321dhU JZ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S9nz82XWPJqsEXqeZI8uptghwD3J3h6sMo2epvz2BnM=; b=SJcPYaI6IMbQ7fEDUv6pYwkuvGFtlcE83NeuiQBBn/RAyH4rbA+/m663DEX6qLHMLN GeH6VJWykHqpoN+VhdoN8mqIgrC32nfxbAHo//b5oKDRaYqMpD1uF4cxAXBXkxeuXAyf I/h0wyOeOCEgriHD02+2WcowUUfiAFnIiP9IytxElZxFwcTAiwSyL74WYi8IvgjmSyjv 5CRv7OX1OrX/76vZByERAL8ODxlyr1ESeKJMHc5twaxvgm49rCSoPv+fRnoO1TNHOWOr FjgFe/07p9/wzhyTdSgeGtgvdwJgw4SEzP2iegSu5JKCikMUg62VNbKD62aTph6FWo6u ypHA== X-Gm-Message-State: APjAAAV30LBxnjoPIystJXoM5eZd8TduT5j3JQNc+ngYRuYkjidNfd6U pSWApIEl+2DPJDX1N30+XjJ9Fcho8gyw0BBwsT4= X-Google-Smtp-Source: APXvYqzKeEKv1pggTL5pfZ0YJ6CjdaIkPM35VpQKBfI6YLLWFZemVrBzmOuRaForP/GFECQk/F8UCz2VlBHZc6gP25E= X-Received: by 2002:a2e:4c7:: with SMTP id a68mr13603695ljf.165.1558187809183; Sat, 18 May 2019 06:56:49 -0700 (PDT) MIME-Version: 1.0 References: <87k1eqdkzk.fsf@gmail.com> <20190518125628.GA6231@ACM> In-Reply-To: <20190518125628.GA6231@ACM> From: Mauro Aranda Date: Sat, 18 May 2019 10:56:35 -0300 Message-ID: Content-Type: multipart/alternative; boundary="000000000000dc1cc1058929de00" 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 (-) --000000000000dc1cc1058929de00 Content-Type: text/plain; charset="UTF-8" Alan Mackenzie writes: > Hello, Mauro. >> Is that a bug? Or is there something else I can use to help CC Mode not get >> confused? > > It's a bug. I hope the following patch fixes it. Would you please > apply this patch, try it out in your real code, and confirm it fixes the > bug, or tell me what's still not working. Thanks! Hello Alan. The patch works like a charm. Thank you! --000000000000dc1cc1058929de00 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Alan Mackenzie <acm@muc.de> writes:

> Hello, Mauro.

>>= ; Is that a bug? Or is there something else I can use to help CC Mode not g= et
>> confused?
>
> It's a bug.=C2=A0 I hope the f= ollowing patch fixes it.=C2=A0 Would you please
> apply this patch, t= ry it out in your real code, and confirm it fixes the
> bug, or tell = me what's still not working.=C2=A0 Thanks!

Hello Alan.

Th= e patch works like a charm.=C2=A0 Thank you!

=
--000000000000dc1cc1058929de00-- From unknown Mon Aug 18 15:40:55 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Mauro Aranda Subject: bug#35768: closed (Re: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names) Message-ID: References: <20190518152759.GB6231@ACM> X-Gnu-PR-Message: they-closed 35768 X-Gnu-PR-Package: emacs,cc-mode Reply-To: 35768@debbugs.gnu.org Date: Sat, 18 May 2019 15:29:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1558193342-11408-1" This is a multi-part message in MIME format... ------------=_1558193342-11408-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #35768: 27.0.50; CC-Mode problems with function definitions with macro names which was filed against the emacs,cc-mode package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 35768@debbugs.gnu.org. --=20 35768: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D35768 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1558193342-11408-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 35768-done) by debbugs.gnu.org; 18 May 2019 15:28:07 +0000 Received: from localhost ([127.0.0.1]:32804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hS1Fm-0002wm-UX for submit@debbugs.gnu.org; Sat, 18 May 2019 11:28:07 -0400 Received: from colin.muc.de ([193.149.48.1]:14163 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hS1Fk-0002wc-NN for 35768-done@debbugs.gnu.org; Sat, 18 May 2019 11:28:05 -0400 Received: (qmail 24432 invoked by uid 3782); 18 May 2019 15:28:00 -0000 Received: from acm.muc.de (p2E5D5A2C.dip0.t-ipconnect.de [46.93.90.44]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 18 May 2019 17:27:58 +0200 Received: (qmail 20233 invoked by uid 1000); 18 May 2019 15:27:59 -0000 Date: Sat, 18 May 2019 15:27:59 +0000 To: Mauro Aranda Subject: Re: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names Message-ID: <20190518152759.GB6231@ACM> References: <87k1eqdkzk.fsf@gmail.com> <20190518125628.GA6231@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35768-done Cc: 35768-done@debbugs.gnu.org, Noam Postavsky 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 (-) Hello again, Mauro. On Sat, May 18, 2019 at 10:56:35 -0300, Mauro Aranda wrote: > Alan Mackenzie writes: > > Hello, Mauro. > >> Is that a bug? Or is there something else I can use to help CC Mode not > >> get confused? > > It's a bug. I hope the following patch fixes it. Would you please > > apply this patch, try it out in your real code, and confirm it fixes > > the bug, or tell me what's still not working. Thanks! > Hello Alan. > The patch works like a charm. Thank you! Thank you. I've committed the patch, and I'm now closing the bug. -- Alan Mackenzie (Nuremberg, Germany). ------------=_1558193342-11408-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 16 May 2019 22:19:41 +0000 Received: from localhost ([127.0.0.1]:56676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hROiy-0006L3-T8 for submit@debbugs.gnu.org; Thu, 16 May 2019 18:19:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46509) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hROiw-0006Ko-I5 for submit@debbugs.gnu.org; Thu, 16 May 2019 18:19:39 -0400 Received: from lists.gnu.org ([209.51.188.17]:43944) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hROiq-0005Yz-Lc for submit@debbugs.gnu.org; Thu, 16 May 2019 18:19:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hROio-0002Ar-OD for bug-gnu-emacs@gnu.org; Thu, 16 May 2019 18:19:32 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hROim-0005Rr-RP for bug-gnu-emacs@gnu.org; Thu, 16 May 2019 18:19:30 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]:38643) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hROil-0005Lc-0S for bug-gnu-emacs@gnu.org; Thu, 16 May 2019 18:19:27 -0400 Received: by mail-lf1-x136.google.com with SMTP id y19so3847388lfy.5 for ; Thu, 16 May 2019 15:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=OI0m12DgB+zxFosSQ2y6IOzaryJmIhWuY1YaJTIlmZU=; b=FLlhNp3Dh3/PRivdtvZJDfsa470SxbjCN8e8innSSrFvFiJGIVZFiTXMo45tyxs8sL UaJHo9e2f+uuxHPT79lTGnRyPFxsju+neYVNF9SIXlWnCWG7OX1o2i4cIdqqa7kPUMAK MgfxegBarq6R5tMgoK3YvEe94s4Fn2bpbHJ3in4v8Ary3LS4JXUPn266Scwt9uJKxeNC c+lqTpasd5zdFJoHHP6dypZLVuaLg+8gLAUTSaYKnTW6kAJnC/6QUUlzLIRBBAnpgsa9 +vFqj7g+V5GAKv7dis2bC8rjrvGB+fdSfK+vXAUj7egl6qLH+mtvqIFX+wrBj/Qbf6W+ u43Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=OI0m12DgB+zxFosSQ2y6IOzaryJmIhWuY1YaJTIlmZU=; b=e1TBqICCoVT7MfIeOZeo3Q9QDWdPMAuXSJ7IRmjr2zb/T0j8FzKe9qtogLb6MitHWR LQFUgQ8Ilh5lRfZBII8gDQPsup3GVtkoUd/yIHJ5PeomPUgU1Syc3MTUT/Iw64+L80Ao BUjbKkI+VWUCNuBgvxD804WjgNz6QR9vikh4kld5Whg+N97EApMGqVeMaJkV9MJFHqR4 eA0V449V4TMxjeLo5K04xnltbypxY7HMOUtEiDYgt5MKy3g+FKPp6LGaISFjtgQYNQGQ CTpnaegsnhCXwMfti83Vm2tjq3Z5XIOWxVPh0rAHZH2KHZpH6Yc/SvujtFlb/eCWTI+J w7ew== X-Gm-Message-State: APjAAAXm9wRk98KPnnwNCtUsf74UmfBjWHt8ttLeJ76hpSVNQkRNOtyw sLCB1qoOmDqsuQZJfm8jE72GJshAGuIpNXyd1AE4GIQh X-Google-Smtp-Source: APXvYqw3irIrTxHDR/VunqE7KTKbVmoFJBNdrF1RDP4RrxPoP7clpCYxmDSDCWWbm4/y0WhjejoRDATV6/JgW/NhCO8= X-Received: by 2002:ac2:4a6e:: with SMTP id q14mr7464981lfp.46.1558045161803; Thu, 16 May 2019 15:19:21 -0700 (PDT) MIME-Version: 1.0 From: Mauro Aranda Date: Thu, 16 May 2019 19:19:09 -0300 Message-ID: Subject: 27.0.50; CC-Mode problems with function definitions with macro names To: bug-gnu-emacs Content-Type: multipart/alternative; boundary="00000000000069d55c058908a845" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::136 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit 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: -2.3 (--) --00000000000069d55c058908a845 Content-Type: text/plain; charset="UTF-8" Hello. I noticed CC-Mode sometimes doesn't identify correctly function names when a macro name is involved in the function definition. Try the following recipe to see the problem: 1) emacs -Q 2) C-x C-f test.c 3) Type the following function definitions: int DUMMY foo (void) { return 1; } DUMMY int bar (void) { return 0; } 4) Observe that: a) foo doesn't get fontified with font-lock-function-name-face, but DUMMY does. Consequently, C-c C-z inside foo echoes DUMMY as the function name, in the echo area. b) In bar, DUMMY gets font-lock-type-face, which I don't think is correct. bar gets font-lock-function-name-face and C-c C-z works as expected. --- Other problem is with fontification of the return type in the following: bool DUMMY baz_t (void) { return true; } bool baz_f (void) { return false; } Observe that bool doesn't get fontified in baz_t, but DUMMY does. When DUMMY is not present, bool gets fontified correctly (as in baz_f). If it helps, I found the problem in a source file with functions that have macros that declare some function attributes, like _GL_ATTRIBUTE_PURE. Best regards, Mauro. In GNU Emacs 27.0.50 (build 5, i686-pc-linux-gnu, GTK+ Version 3.18.9) of 2019-05-15 built on the-blackbeard Repository revision: 50b1ce0185cd7b5f8be124eb4a612fd56e4e0657 Repository branch: revert-buffer-with-fine-grain Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Ubuntu 16.04.6 LTS Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure CFLAGS=-O3' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS PDUMPER LCMS2 GMP Important settings: value of $LANG: en_US.utf8 value of $XMODIFIERS: locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-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 auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date 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 elec-pair mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic 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 charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 8 43995 8711) (symbols 24 5878 1) (strings 16 14997 2517) (string-bytes 1 501374) (vectors 8 8875) (vector-slots 4 114380 10618) (floats 8 18 13) (intervals 28 194 0) (buffers 564 11) (heap 1024 7599 790)) --00000000000069d55c058908a845 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello.

I noticed CC-Mode sometimes= doesn't identify correctly function names
when a macro name is invo= lved in the function definition.=C2=A0 Try the
following recipe to see t= he problem:

1) emacs -Q
2) C-x C-f test.c
3) Type the followin= g function definitions:

int DUMMY
foo (void)
{
=C2=A0 retur= n 1;
}

DUMMY int
bar (void)
{
=C2=A0 return 0;
}
<= br>4) Observe that:
a) foo doesn't get fontified with font-lock-func= tion-name-face, but
DUMMY does.=C2=A0 Consequently, C-c C-z inside foo e= choes
DUMMY as the function name, in the echo area.
b) In bar, DUMMY = gets font-lock-type-face, which I don't
think is correct.=C2=A0 bar = gets font-lock-function-name-face and C-c C-z
works as expected.

= ---

Other problem is with fontification of the return type in the fo= llowing:

bool DUMMY
baz_t (void)
{
=C2=A0 return true;
}=

bool
baz_f (void)
{
=C2=A0 return false;
}

Obser= ve that bool doesn't get fontified in baz_t, but DUMMY does.=C2=A0 When=
DUMMY is not present, bool gets fontified correctly (as in baz_f).
<= br>
If it helps, I found the problem in a source file with functions tha= t
have macros that declare some function attributes, like
_GL_ATTRIBU= TE_PURE.

Best regards,
Mauro.



In GNU Emacs 27.0.50= (build 5, i686-pc-linux-gnu, GTK+ Version 3.18.9)
=C2=A0of 2019-05-15 b= uilt on the-blackbeard
Repository revision: 50b1ce0185cd7b5f8be124eb4a61= 2fd56e4e0657
Repository branch: revert-buffer-with-fine-grain
Windowi= ng system distributor 'The X.Org Foundation', version 11.0.11906000=
System Description: Ubuntu 16.04.6 LTS

Recent messages:
For i= nformation about GNU Emacs and the GNU system, type C-h C-a.

Configu= red using:
=C2=A0'configure CFLAGS=3D-O3'

Configured feat= ures:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY IN= OTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIBTOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS PDUMPER LCMS2 GMP

Imp= ortant settings:
=C2=A0 value of $LANG: en_US.utf8
=C2=A0 value of $X= MODIFIERS:
=C2=A0 locale-coding-system: utf-8-unix

Major mode: L= isp Interaction

Minor modes in effect:
=C2=A0 tooltip-mode: t
= =C2=A0 global-eldoc-mode: t
=C2=A0 eldoc-mode: t
=C2=A0 electric-inde= nt-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2= =A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-fo= nt-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t<= br>=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode: t
=C2= =A0 auto-compression-mode: t
=C2=A0 line-number-mode: t
=C2=A0 transi= ent-mark-mode: t

Load-path shadows:
None found.

Features:<= br>(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
byte= comp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
easy= menu mml-sec password-cache epa derived epg epg-config gnus-util
rmail r= mail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-enco= de mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib= sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
elec-= pair mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-= float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fo= ntset image regexp-opt fringe tabulated-list replace newcomment
text-mod= e elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isea= rch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu fon= t-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-la= ng vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932= hebrew greek romanian slovak czech european
ethiopic indian cyrillic ch= inese composite charscript charprop
case-table epa-hook jka-cmpr-hook he= lp simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button= faces cus-face macroexp files
text-properties overlay sha1 md5 base64 f= ormat env code-pages mule
custom widget hashtable-print-readable backquo= te threads dbusbind
inotify lcms2 dynamic-setting system-font-setting fo= nt-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-pr= ocess emacs)

Memory information:
((conses 8 43995 8711)
=C2=A0= (symbols 24 5878 1)
=C2=A0(strings 16 14997 2517)
=C2=A0(string-bytes= 1 501374)
=C2=A0(vectors 8 8875)
=C2=A0(vector-slots 4 114380 10618)=
=C2=A0(floats 8 18 13)
=C2=A0(intervals 28 194 0)
=C2=A0(buffers = 564 11)
=C2=A0(heap 1024 7599 790))

--00000000000069d55c058908a845-- ------------=_1558193342-11408-1--