GNU bug report logs - #62339
cc-mode fontifies variables incorrectly when const follows type

Previous Next

Package: emacs;

Reported by: Daniel Colascione <dancol <at> dancol.org>

Date: Tue, 21 Mar 2023 15:17:02 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 62339 <at> debbugs.gnu.org, acm <at> muc.de, Daniel Colascione <dancol <at> dancol.org>
Subject: bug#62339: cc-mode fontifies variables incorrectly when const follows type
Date: Wed, 22 Mar 2023 22:14:12 +0000
Hello, Eli and Daniel.

Thanks for the bug report!

On Wed, Mar 22, 2023 at 17:12:52 +0200, Eli Zaretskii wrote:
> > From: Daniel Colascione <dancol <at> dancol.org>
> > Cc: 62339 <at> debbugs.gnu.org
> > Date: Wed, 22 Mar 2023 10:19:55 -0400

> > This problem reproduces for me on latest master with emacs -Q:

> > ```
> > TEST(Foo, Bar) {
> >   NamedTemporaryDirectory const test_directory;
> > }
> > ```

> Thanks.  What I see with Emacs built from master is that
> test_directory in the above example gets font-lock-type-face in
> c++-mode (but not in c-mode).  With Emacs built from emacs-29, both
> modes produce correct fontification.

> Alan, can you please look into this?

I think this is caused by a faulty fix of bug #59267, where "typeless" C
declarations like

    const foo;

, which are implicit int, were not being recognised.

In the current test case, in C Mode, NamedTemporaryDirectory ought to be
getting fontified as a type, but isn't.  In C++ Mode, test_directory
gets spuriously fontified as a type, as already noted.

Seeing as how the current bug affects only the master branch, not the
emacs-29 branch, I think I'm going to take a bit of time to fix this bug
in the hope of fixing it properly this time.

-- 
Alan Mackenzie (Nuremberg, Germany).




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

Previous Next


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