GNU bug report logs - #59427
CC Mode 5.35.2 (C/*l); More bad fontification

Previous Next

Package: cc-mode;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Mon, 21 Nov 2022 02:33: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: Michael Welsh Duggan <mwd <at> md5i.com>
Cc: Po Lu <luangruo <at> yahoo.com>, 59427 <at> debbugs.gnu.org
Subject: bug#59427: CC Mode 5.35.2 (C/*l); More bad fontification
Date: Fri, 25 Nov 2022 10:05:59 +0000
Hello, Michael.

On Thu, Nov 24, 2022 at 22:20:42 -0500, Michael Welsh Duggan wrote:
> Alan Mackenzie <acm <at> muc.de> writes:

> > Hello, Po.

> > On Mon, Nov 21, 2022 at 10:32:26 +0800, Po Lu via CC-Mode-help wrote:
> >> Package: cc-mode

> >> Insert the following text in a c-mode buffer:

> >> static uint64_t
> >> ConfineTime (uint64_t time)
> >> {
> >>   uint32_t milliseconds;

> >>   /* Given a microsecond time, confine the millisecond part to
> >>      CARD32.  */
> >>   milliseconds = time / 1000;

> >>   return (milliseconds * (uint64_t) 1000
> >> 	  + time % 1000);
> >> }

> >> Notice how "milliseconds" is recognized as a type, and the uint64_t in
> >> the cast as an identifier.

> > Yes.  Here the "symmetric space" criterion for * was buggy.  That
> > criterion says if there is whitespace on neither side of the *, or both,
> > it is a multiplication sign.  Otherwise it is the indirection operator.

> > The bug was not taking the ( properly into account.  Please apply the
> > attached patch, which should fix this, and confirm it works OK.  Thanks!

> Oh dear.  My personal programming style uses a "type * name" spacing for
> pointers.  (More specifically, I put spaces on either side of "*", "&"
> or "&&" when used to form types.)  Is this going to cause me problems in
> the future?

Not if it hasn't done already.  The mechanism has been in place since
2017-03, a slight bug in it has just been corrected.  This criterion for
distinguishing a multiplication operator from an indirection operator is
only used as a last ditch, when everything else has failed to decide.  C
and C++ are not comfortable languages to parse with anything less than a
full compiler.

> -- 
> Michael Welsh Duggan
> (md5i <at> md5i.com)

-- 
Alan Mackenzie (Nuremberg, Germany).




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

Previous Next


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