[vlc-commits] build: avoid annoying _FORTIFY_SOURCE warnings (fixes #17341)

Janne Grunau git at videolan.org
Thu Jan 3 18:47:01 CET 2019


vlc | branch: master | Janne Grunau <janne-vlc at jannau.net> | Wed Jan  2 12:54:49 2019 +0100| [9dc7a22eca870aa92aa689d895d8569bb8fbecdb] | committer: Rémi Denis-Courmont

build: avoid annoying _FORTIFY_SOURCE warnings (fixes #17341)

fixed patch with the duplicate "#if defined ..." removed

Janne
---8<---
Some toolchains predefine _FORTIFY_SOURCE resulting in countless
_FORTIFY_SOURCE is redefined warnings. Using _FORTIFY_SOURCE without
compiler optimizations also generates warnings.
_FORTIFY_SOURCE is a reserved identifier in C99 ("All identifiers that
begin with an underscore and either an uppercase letter or another
underscore are always reserved for any use.") so the toolchain is
perfectly free to predefine it.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9dc7a22eca870aa92aa689d895d8569bb8fbecdb
---

 configure.ac | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index d3df6e254e..d419737124 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,7 +36,12 @@ dnl
 AC_PROG_CC
 AC_USE_SYSTEM_EXTENSIONS
 VLC_PROG_CC_C11
-AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to 2 to get glibc warnings.])
+AH_VERBATIM([FORTIFY_SOURCE],
+  [/* Enable compile-time and run-time bounds-checking, and some warnings,
+   without upsetting glibc 2.15+ or toolchains predefining _FORTIFY_SOURCE */
+#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
+# define _FORTIFY_SOURCE 2
+#endif])
 AC_DEFINE([_FILE_OFFSET_BITS], 64, [Define to 64 for large files support.])
 AC_DEFINE([__LIBVLC__],, [Define within the LibVLC source code tree.])
 AC_DEFINE([WIN32_LEAN_AND_MEAN],, [Define to limit the scope of <windows.h>.])



More information about the vlc-commits mailing list