Next: , Previous: , Up: Custom Macros   [Index]


12.3 Noise Macros

In CC Mode, noise macros are macros which expand to nothing, or compiler directives (such as GCC’s __attribute__) which play no part in the syntax of the C (etc.) language. Some noise macros are followed by arguments in parentheses (possibly optionally), others are not.

Noise macros can easily confuse CC Mode’s analysis of function headers, causing them to be mis-fontified, or even mis-indented. You can prevent this confusion by specifying the identifiers which constitute noise macros.

User Option: c-noise-macro-names

This variable is a list of names of noise macros which never have parenthesized arguments. Each element is a string, and must be a valid identifier. Alternatively, the variable may be a regular expression which matches the names of such macros. Such a noise macro is treated as whitespace by CC Mode. It must not also be in, or be matched by c-noise-macro-with-parens-names.

User Option: c-noise-macro-with-parens-names

This variable is a list of names of noise macros which optionally have arguments in parentheses. Each element of the list is a string, and must be a valid identifier. Alternatively, the variable may be a regular expression which matches the names of such macros. Such a noise macro must not also be in, or be matched by c-noise-macro-names. For performance reasons, such a noise macro, including any parenthesized arguments, is specially handled, but it is only handled when used in declaration contexts51.

The two compiler directives __attribute__ and __declspec have traditionally been handled specially in CC Mode; for example they are fontified with font-lock-keyword-face. You don’t need to include these directives in c-noise-macro-with-parens-names, but doing so is OK.

Function: c-make-noise-macro-regexps

Call this (non-interactive) function, which sets internal variables, on changing the value of c-noise-macro-names or c-noise-macro-with-parens-names after the major mode’s function has run. This function is called by CC Mode’s initialization code, after the mode hooks have run.


Footnotes

(51)

If this restriction causes your project difficulties, please get in touch with bug-cc-mode@gnu.org.


Next: , Previous: , Up: Custom Macros   [Index]