GNU bug report logs - #35768
27.0.50; CC-Mode problems with function definitions with macro names

Previous Next

Packages: emacs, cc-mode;

Reported by: Mauro Aranda <maurooaranda <at> gmail.com>

Date: Thu, 16 May 2019 22:20:01 UTC

Severity: normal

Found in version 27.0.50

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

Bug is archived. No further changes may be made.

Full log


Message #11 received at 35768 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 35768 <at> debbugs.gnu.org
Subject: Re: bug#35768: 27.0.50; CC-Mode problems with function definitions
 with macro names
Date: Fri, 17 May 2019 09:40:09 -0300
[Message part 1 (text/plain, inline)]
> 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.
[Message part 2 (text/html, inline)]

This bug report was last modified 6 years and 64 days ago.

Previous Next


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