v2: The GNU C Library 2.16 release plan

Roland McGrath roland@hack.frob.com
Thu Jun 14 16:57:00 GMT 2012


> > '-D_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 1) ? 2 : 0)'
> 
> mmm, i don't think that can work, can it ?  it'll expand _FORTIFY_SOURCE into 
> literally "((defined __OPTIMIZE__ && __OPTIMIZE__ > 1) ? 2 : 0)" since the 
> preprocessor isn't recursive.

What's wrong with that?  The test is:

	#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0

When _FORTIFY_SOURCE is evaluated it should work fine.
(Actually it should be > 0, not 1.)

This works as expected both with and without -DNOTDEF=1:

	#define TEST ((defined NOTDEF && NOTDEF > 0) ? 2 : 0)
	#if defined TEST && TEST > 0
	#warning set
	#else
	#warning not set
	#endif



More information about the Libc-alpha mailing list