Macros which needn’t (or mustn’t) be followed by a semicolon when you
invoke them, macros with semicolons, are very common. These can
cause CC Mode to parse the next line wrongly as a
statement-cont (see Function Symbols) and thus mis-indent
it. At the top level, a macro invocation before a defun start can
cause, for example,
c-beginning-of-defun (C-M-a) not to
find the correct start of the current function.
You can prevent these by specifying which macros have semicolons. It doesn’t matter whether or not such a macro has a parameter list:
This buffer-local variable specifies which macros have semicolons.
After setting its value, you need to call
c-make-macro-with-semi-re for it to take effect. It should be
set to one of these values:
There are no macros with semicolons.
Each string is the name of a macro with a semicolon. Only valid
#define names are allowed here. For example, to set the
default value, you could write the following into your .emacs:
(setq c-macro-names-with-semicolon '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS"))
This matches each symbol which is a macro with a semicolon. It must
not match any string which isn’t a valid
#define name. For
(setq c-macro-names-with-semicolon "\\<\\(CLEAN_UP_AND_RETURN\\|Q_[[:upper:]]+\\)\\>")
Call this (non-interactive) function, which sets internal variables,
each time you change the value of
after the major mode function has run. It takes no arguments, and its
return value has no meaning. This function is called by CC Mode’s
initialization code, after the mode hooks have run.