Preprocessor macros in C, C++, and Objective C (introduced by
#define) have a syntax different from the main language—for
example, a macro declaration is not terminated by a semicolon, and if
it is more than a line long, line breaks in it must be escaped with
backslashes. CC Mode has some commands to manipulate these, see
Customizing Macro Backslashes.
Normally, the lines in a multi-line macro are indented relative to each other as though they were code. You can suppress this behavior by setting the following user option:
Enable syntactic analysis inside macros, which is the default. If this
nil, all lines inside macro definitions are analyzed as
Sometimes you may want to indent particular directives
#pragma) as though they were statements. To do this, see
Because a macro can expand into anything at all, near where one is invoked CC Mode can only indent and fontify code heuristically. Sometimes it gets it wrong. Usually you should try to design your macros so that they “look like ordinary code” when you invoke them. However, two situations are so common that CC Mode handles them specially: that is when certain macros needn’t (or mustn’t) be followed by a ‘;’, and when certain macros (or compiler directives) expand to nothing. You need to configure CC Mode to handle these macros properly, see Macros with semicolons and Noise Macros.