Emacs, by default, does not indent pre-processor code. I know it has historical roots that are obsolete by now.
However, having a code with a lot of #ifdef unindente
You can simply tell Emacs to add an offset to the pre-processor lines.
point) in a pre-processor line Syntactic symbol to change:, cpp-macro, press Enter0)Then a TAB on each pre-processor line should indent it correctly. (or M-xindent-region ...).
To have the change set permanently, you can for instance add the required lines in your .emacs file.
An easy way to copy a previously entered command is c-x ESC ESC and use the arrow keys to find the (c-set-offset ...) Elisp command.
That should be
(c-set-offset (quote cpp-macro) 0 nil)