This file has become totally unreadable because it's littered with lots
of #if, and mixes unconditional and conditional declarations that have
been accumulating over time. Let's first reorganize it so that:
- externs are defined first
- isolated macros are defined second
- enums/structs are defined third, optionally with their macros and
inline functions if unconditional.
- then the conditional stuff.
A few types were made permanent as there's no point hiding them behind
ifdefs, except complicating a developer's life in another file.
Now most common stuff is quickly found and the more involved stuff remains
at the end.