This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix PR gdb/23835: Don't redefine _FORTIFY_SOURCE if it's already defined
On Tuesday, October 30 2018, Joel Brobecker wrote:
>> > Gentoo has a local GCC patch which always defines _FORTIFY_SOURCE=2.
>> > This causes a build problem when building GDB there, because
>> > "common/common-defs.h" also defines _FORTIFY_SOURCE=2:
>> >
>> > CXX gdb.o
>> > In file included from ../../gdb/defs.h:28:0,
>> > from ../../gdb/gdb.c:19:
>> > ../../gdb/common/common-defs.h:71:0: error: "_FORTIFY_SOURCE"
>> > redefined [-Werror]
>> > #define _FORTIFY_SOURCE 2
>> >
>> > <built-in>: note: this is the location of the previous definition
>> > cc1plus: all warnings being treated as errors
>> > make[2]: *** [Makefile:1619: gdb.o] Error 1
>> >
>> > Even though it is questionable whether Gentoo's approach is the
>> > correct one:
>> >
>> > https://jira.mongodb.org/browse/SERVER-29982
>> > https://bugs.gentoo.org/621036
>> >
>> > it is still possible for GDB to be a bit more robust here and make
>> > sure it just defines _FORTIFY_SOURCE if it hasn't been defined
>> > already. This patch does that.
>> >
>> > Tested by rebuilding and making sure the macro was defined.
>>
>> I think it makes sense, it also gives the user the possibility to override
>> it, if they don't like our value. Give it a few days to give others a
>> change to respond. If you don't hear anything in ~1 week, please go ahead
>> and push.
>
> Good point about allowing the user to override it.
>
> The patch looks OK to me too.
Thanks for the review, Joel.
Given that two global maintainers replied and approved the patch, I
assume it's OK if I go ahead and push it...?
Thanks,
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/