diff options
author | Tom Tromey <tom@tromey.com> | 2018-08-10 09:03:47 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-08-13 10:02:00 -0600 |
commit | a97b53dda99526d7c2890aeb9637008790cbdfa9 (patch) | |
tree | c443d04035534d5c96bde4def060ae409a496a15 /gdb/common | |
parent | 98641896ad52915448c0dd1ab4b4bbe23148a582 (diff) | |
download | binutils-a97b53dda99526d7c2890aeb9637008790cbdfa9.zip binutils-a97b53dda99526d7c2890aeb9637008790cbdfa9.tar.gz binutils-a97b53dda99526d7c2890aeb9637008790cbdfa9.tar.bz2 |
Define _FORTIFY_SOURCE in common-defs.h
This defines _FORTIFY_SOURCE in common-defs.h. This seems like a
sensible safety measure, and also it may help avoid build problems
with -Wunused-result on distros that already define _FORTIFY_SOURCE by
default.
Tested by the buildbot.
gdb/ChangeLog
2018-08-13 Tom Tromey <tom@tromey.com>
* common/common-defs.h (_FORTIFY_SOURCE): Define.
Diffstat (limited to 'gdb/common')
-rw-r--r-- | gdb/common/common-defs.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h index 80f1ff4..58445b1 100644 --- a/gdb/common/common-defs.h +++ b/gdb/common/common-defs.h @@ -59,6 +59,18 @@ #define __STDC_LIMIT_MACROS 1 #define __STDC_FORMAT_MACROS 1 +/* Some distros enable _FORTIFY_SOURCE by default, which on occasion + has caused build failures with -Wunused-result when a patch is + developed on a distro that does not enable _FORTIFY_SOURCE. We + enable it here in order to try to catch these problems earlier; + plus this seems like a reasonable safety measure. The check for + optimization is required because _FORTIFY_SOURCE only works when + optimization is enabled. */ + +#if defined __OPTIMIZE__ && __OPTIMIZE__ > 0 +#define _FORTIFY_SOURCE 2 +#endif + #include <stdarg.h> #include <stdio.h> #include <stdlib.h> |