Subject: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names

From: Mauro Aranda <[email-masked]>
Date: Fri, 17 May 2019 09:40:09 -0300

> 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.