[m-rev.] diff: fix bug #379: warnings about deprecated feature macros with glibc 2.20
Julien Fischer
jfischer at opturion.com
Thu Feb 19 01:34:34 AEDT 2015
Does anyone know why we need the C files generated by mkinit to define
_BSD_SOURCE?
--------------------------
Branches: 14.01, master
Fix bug #379: warnings about deprecated feature macros with glibc 2.20.
glibc version 2.20 will emit a warning if the macros _BSD_SOURCE or
_SVID_SOURCE are defined. (They have been deprecated in favour of the macro
_DEFAULT_SOURCE). The C files generated by mkinit define _BSD_SOURCE,
consequently causing a warning to be emitted by the preprocessor every time you
build an executable on systems with the affected version of glibc.
Also defining _DEFAULT_SOURCE will disable the warning.
util/mkinit.c:
Define _DEFAULT_SOURCE in order to suppress the warning described
above.
diff --git a/util/mkinit.c b/util/mkinit.c
index 0309215..92a21c2 100644
--- a/util/mkinit.c
+++ b/util/mkinit.c
@@ -318,8 +318,15 @@ static const char header1[] =
"**\n"
;
+/*
+** NOTE: _DEFAULT_SOURCE is defined in order to suppress a warning
+** about _BSD_SOURCE being deprecated in glibc 2.20. We keep the
+** definition of the deprecated macro about for compatibility with
+** older versions of glibc.
+*/
static const char header2[] =
"*/\n"
+ "#define _DEFAULT_SOURCE\n"
"#define _BSD_SOURCE\n"
"#include <stddef.h>\n"
"#ifdef MR_PROFILE_SBRK\n"
More information about the reviews
mailing list