GNU bug report logs - #39409
CC Mode 5.33.1 (C/*l); Wrong fontification of "foo * sizeof"

Previous Next

Package: cc-mode;

Reported by: Benjamin Moody <benjaminmoody <at> gmail.com>

Date: Mon, 3 Feb 2020 23:03:02 UTC

Severity: normal

Fixed in version 27.0.60

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: Benjamin Moody <benjamin.moody <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 39409 <at> debbugs.gnu.org
Subject: bug#39409: CC Mode 5.33.1 (C/*l); Wrong fontification of "foo * sizeof"
Date: Wed, 5 Feb 2020 23:57:13 +0000
Hi,

Thank you for all your work on CC Mode.  And yeah, I know C syntax can
get pretty hairy. :)

The curious thing is, though, this issue doesn't seem to occur with
"foo * bar(baz)".  What I'm seeing seems to happen specifically when
the "function" is actually a keyword (like sizeof), and the expression
is enclosed in parentheses:

void foo()
{
  xxx(xxx * xxx(xxx));          /* correct */
  xxx(ttt * sizeof(xxx));       /* wrong */

  xxx(xxx, xxx * xxx(xxx));     /* correct */
  xxx(xxx, ttt * sizeof(xxx));  /* wrong */

  ttt * fff(xxx);               /* ambiguous, but logical */
  xxx * sizeof(xxx);            /* correct */

  (xxx * xxx(xxx));             /* correct */
  (ttt * sizeof(xxx));          /* wrong */

  xxx = xxx * xxx(xxx);         /* correct */
  xxx = xxx * sizeof(xxx);      /* correct */

  xxx = (ttt * fff(xxx));       /* wrong (I think) */
  xxx = (xxx * sizeof(xxx));    /* correct */
}

(In these examples, 'xxx' uses the default face, 'ttt' uses
font-lock-type-face, 'fff' uses font-lock-function-name-face, and of
course 'sizeof' uses font-lock-keyword-face.)

I tried the standalone version (cc-mode-5.34.tar.gz) and it appears to
give the same results as above.

Benjamin




This bug report was last modified 5 years and 161 days ago.

Previous Next


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