rearrange ifdef blocks to prevent unused-variable warning