[cfe-commits] patch: predefines available with -undef

Douglas Gregor dgregor at apple.com
Fri Jun 10 08:52:39 PDT 2011


On Jun 4, 2011, at 2:37 AM, Nick Lewycky wrote:

> This patch makes clang predefine some macros even when asked not to by the -undef flag. I found real-world code which passes -undef and then tests for these macros.
> 
> $ gcc -undef -dM -E -
> #define __STDC_HOSTED__ 1
> #define __STDC__ 1
> $ gcc -undef -dM -E -x assembler-with-cpp -
> #define __ASSEMBLER__ 1
> #define __STDC_HOSTED__ 1
> #define __STDC__ 1
> $ gcc-4.6 -undef -dM -E -x assembler-with-cpp - -ffreestanding
> #define __ASSEMBLER__ 1
> #define __STDC_HOSTED__ 0
> #define __STDC__ 1

LGTM!

	- Doug




More information about the cfe-commits mailing list