This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: v2: The GNU C Library 2.16 release plan


On Thursday 14 June 2012 12:56:56 Roland McGrath wrote:
> > > '-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

i don't recall exactly how i tested it before, but this seems to work:
cpp_define (pfile,
	"_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)");

so i'll look at rolling that out
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]