[PATCH] stdlib: tests: don't double-define _FORTIFY_SOURCE

Siddhesh Poyarekar siddhesh@gotplt.org
Wed Aug 10 14:29:20 GMT 2022


On 2022-08-08 18:30, Sam James wrote:
> This is a fair point, although I now see we've actually got libc_cv_predef_fortify_source
> which sets CPPUNDEFS for exactly this sort of problem anyway.
> 
> I don't see the warning with gcc-11 + -Werror + F_S=3 on a test program. I can build some
> older GCCs as I should probably keep them around anyway though.

Interesting, because you should have seen the warning about 
_FORTIFY_SOURCE=3 not being supported; I'm surprised that it doesn't 
fail due to that warning.

>> Alternatively, some magic here to determine the maximum fortification level wouldn't hurt, but I won't gate your patch on that :)  I can work on that bit.
> 
> I started looking at that and I'm not sure there's a point. includes/features.h downgrades us appropriately. I think we can unconditionally
> set F_S=3 if I'm right about GCC not caring, as all the logic is on the glibc side, right?

It's the warning I'm thinking about avoiding.

> 
> We can always split this into two if you want:
> 1. The original commit (I can convert it to use libc_cv_predef_fortify_source's result) & backport it to 2.36

Sounds good to me.

> 2. Another to crank to =3 and don't backport it in case I'm missing something.
> 

Thanks,
Sid


More information about the Libc-alpha mailing list