xfs
[Top] [All Lists]

xfsprogs compile warnings: _BSD_SOURCE is deprecated in glibc 2.20.

To: xfs@xxxxxxxxxxx
Subject: xfsprogs compile warnings: _BSD_SOURCE is deprecated in glibc 2.20.
From: Jan ÅulÃk <jtulak@xxxxxxxxxx>
Date: Tue, 28 Apr 2015 13:09:04 +0200
Delivered-to: xfs@xxxxxxxxxxx
In glibc 2.20, _BSD_SOURCE and _SVID_SOURCE were deprecated and should be
replaced with _DEFAULT_SOURCE. Currently, compiling xfsprogs on a system with
glibc in said or newer version (like current Fedora) produces tons of warnings
like this one:

In file included from /usr/include/stdio.h:27:0,
                  from ../include/xfs/platform_defs.h:24,
                 from ../include/xfs/libxfs.h:25,
                 from xfs_mkfs.c:19:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE 
are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

It can be fixed with the single line patch bellow, but I'm not sure if we can
remove the deprecated version because of compatiblity. Glibc 2.19, which added
_DEFAULT_SOURCE, was released in 2014, and I'm not sure how much it is
backported and how much xfsprogs are backported too. So, do we need a better
patch to take care of this and provide differend _SOURCE based on glibc
version, or this patch is enough?

Source: man 7 feature_test_macros
Here is a link in case you older version:
http://man7.org/linux/man-pages/man7/feature_test_macros.7.html


Signed-off-by: Jan ÅulÃk <jtulak@xxxxxxxxxx>
---
 include/builddefs.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/builddefs.in b/include/builddefs.in
index 944bcf6..6e6097a 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -109,7 +109,7 @@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
 #         -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
 
 ifeq ($(PKG_PLATFORM),linux)
-PCFLAGS = -D_GNU_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=500 
-D_FILE_OFFSET_BITS=64 $(GCCFLAGS)
+PCFLAGS = -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=500 
-D_FILE_OFFSET_BITS=64 $(GCCFLAGS)
 ifeq ($(HAVE_UMODE_T),yes)
 PCFLAGS += -DHAVE_UMODE_T
 endif
-- 
2.1.0

<Prev in Thread] Current Thread [Next in Thread>