[Buildroot] [git commit branch/2021.02.x] package/mkpasswd: define _DEFAULT_SOURCE to suppress compiler warning

From: Peter Korsgaard <peter@korsgaard.com>
Date: 2021-12-12 22:54:53
Subsystem: the rest · Maintainer: Linus Torvalds

commit: https://git.buildroot.net/buildroot/commit/?id=928bfe6045a2fad38bb29d4549fb2401c91fce2b
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2021.02.x

We define _DEFAULT_SOURCE in mkpasswd.c to suppress a compiler warning.

In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from [...]/buildroot/output/arm64/build/host-mkpasswd/mkpasswd.c:24:
/usr/include/features.h:187:3:
  187 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~

As per GLIBC 2.20 release notes[1]:

    The _BSD_SOURCE and _SVID_SOURCE feature test macros are no longer
    supported; they now act the same as _DEFAULT_SOURCE (but generate a
    warning). Except for cases where _BSD_SOURCE enabled BSD interfaces
    that conflicted with POSIX (support for which was removed in 2.19),
    the interfaces those macros enabled remain available when compiling
    with _GNU_SOURCE defined, with _DEFAULT_SOURCE defined, or without
    any feature test macros defined.

[1] https://lwn.net/Articles/611162/

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <redacted>
(cherry picked from commit 9616ade22234ad3c8316b7450749a5b371a5c566)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 package/mkpasswd/mkpasswd.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/package/mkpasswd/mkpasswd.c b/package/mkpasswd/mkpasswd.c
index fd16230468..ae8594061c 100644
--- a/package/mkpasswd/mkpasswd.c
+++ b/package/mkpasswd/mkpasswd.c
@@ -18,6 +18,11 @@
 
 /* for crypt, snprintf and strcasecmp */
 #define _XOPEN_SOURCE
+/*
+ * _BSD_SOURCE is deprecated as of GLIBC 2.20; _DEFAULT_SOURCE should be used
+ * instead. (https://lwn.net/Articles/611162/)
+ */
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE
 
 /* System library */
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help