Subject: bug#39409: CC Mode 5.33.1 (C/*l); Wrong fontification of "foo * sizeof"

From: Benjamin Moody <[email-masked]>
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