On Tue, 25 Jun 2019, 18:59 Xi Ruoyao wrote: > > On 2019-06-25 15:36 +0200, J.W. Jagersma wrote: > > Say I have a header which defines a type conditionally based on the > > __SSE__ macro: > > > > #ifdef __SSE__ > > struct X { ... }; > > #else > > struct X { ... }; > > #endif > > > > This header is included in multiple compilation units, some of which are > > compiled with -mgeneral-regs-only. I don't want any fpu/simd code there. > > Now this flag also undefines __SSE__, which I suppose makes sense, but > > it breaks the ABI between translation units. > > Is there some way to avoid generating fpu code without affecting > > preprocessor macros? > > How about just "pretend" to have __SSE__? > > cat > test.c << EOF > #ifndef __SSE__ > #error > #endif > int main(){} > EOF > > gcc test.c -mgeneral-regs-only -D__SSE__ Or use a different check to decide which definition of the struct to use. If you want the first version even when __SSE__ is not defined, then don't make it depend on __SSE__.