One can either add a version of that attribute in a compiler specific ifdef in a header, or just live with the fact that some variables are unused depending on what defines are set. Or add ifdefs around the variable declaration (or move it into the block where it's used if possible - didn't check for this particular case).