[Issue 9925] Fix some compilation issues around usage of #if and #ifdef