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.
You can prevent this 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-refor it to take effect. It should be set to one of these values:
- nil
- There are no macros with semicolons.
- a list of strings
- Each string is the name of a macro with a semicolon. Only valid
#definenames 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"))- a regular expression
- This matches each symbol which is a macro with a semicolon. It must not match any string which isn't a valid
#definename. For example:(setq c-macro-names-with-semicolon "\\<\\(CLEAN_UP_AND_RETURN\\|Q_[[:upper:]]+\\)\\>")