From 9dc7a22eca870aa92aa689d895d8569bb8fbecdb Mon Sep 17 00:00:00 2001 From: Janne Grunau <janne-vlc@jannau.net> Date: Wed, 2 Jan 2019 12:54:49 +0100 Subject: [PATCH] build: avoid annoying _FORTIFY_SOURCE warnings (fixes #17341) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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@remlab.net> --- configure.ac | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d3df6e254e50..d41973712410 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>.]) -- GitLab