_BSD_SOURCE and _GNU_SOURCE

Alex Merry alex.merry at kde.org
Fri Nov 14 17:26:24 GMT 2014


On Friday 14 November 2014 17:36:10 Aleix Pol wrote:
> On Fri, Nov 14, 2014 at 4:23 PM, Milian Wolff <mail at milianw.de> wrote:
> > Hello all.
> > 
> > Since recently I get spammed by warnings such as this one:
> > 
> > /ssd/milian/projects/kde4/kdelibs/kdecore/network/klocalsocket_unix.cpp:22
> > :
> > /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"
> > 
> > Why do we defined _BSD_SOURCE or _GNU_SOURCE in FindKDE4Internal.cmake?
> 
> It's explained in kde-modules/KDECompilerSettings.cmake:
> 
>    # Enable everything in GNU libc.  Any code using non-portable features
>    # needs to perform feature tests, but this ensures that any such
> features
>    # will be found if they exist.
> 
> I agree it should be revisited or something, especially if those are
> deprecated now in favor of _DEFAULT_SOURCE.

Note that in extra-cmake-modules, we do NOT define _BSD_SOURCE, as noted in the 
paragraph below the one you pasted:

# NB: we do NOT define _BSD_SOURCE, as with GNU libc that requires linking
# against the -lbsd-compat library (it changes the behaviour of some
# functions).  This, however, means that strlcat and strlcpy are not
# provided by glibc.

However, it is defined in FindKDE4Internal.cmake from kdelibs 4.x in order to 
get strlcat and strlcpy. But doing so without linking against libbsd-compat is 
definitely not supported by the glibc developers.

Alex




More information about the kde-core-devel mailing list