mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 15:33:39 +02:00
Fix usage of _GNU_SOURCE
_GNU_SOURCE must be defined before including any other (system) header, so defining it in glib-unix.h (and hoping no one has included anything else before that) is wrong. And the "#define _USE_GNU" workaround for this problem in gnetworkingprivate.h is even wronger (and still prone to failure anyway due to single-include guards). Fix this by defining _GNU_SOURCE in config.h when building against glibc. In theory this is bad because new releases of glibc may include symbols that conflict with glib symbols, which could then cause compile failures. However, most people only see new releases of glibc when they upgrade their distro, at which point they also generally get new releases of gcc, which have new warnings/errors to clean up anyway. https://bugzilla.gnome.org/show_bug.cgi?id=649201
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_SPLICE
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
/* Prologue {{{1 */
|
||||
#define _GNU_SOURCE
|
||||
#include "config.h"
|
||||
|
||||
#include <gstdio.h>
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#define _GNU_SOURCE
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_GRP_H
|
||||
|
@@ -40,38 +40,24 @@
|
||||
|
||||
#else /* !G_OS_WIN32 */
|
||||
|
||||
/* need this for struct ucred on Linux */
|
||||
#ifdef __linux__
|
||||
#define __USE_GNU
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#undef __USE_GNU
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
#if defined(HAVE_ARPA_NAMESER_COMPAT_H) && !defined(GETSHORT)
|
||||
#include <arpa/nameser_compat.h>
|
||||
#endif
|
||||
|
||||
#ifndef T_SRV
|
||||
#define T_SRV 33
|
||||
#endif
|
||||
|
||||
/* We're supposed to define _GNU_SOURCE to get EAI_NODATA, but that
|
||||
* won't actually work since <features.h> has already been included at
|
||||
* this point. So we define __USE_GNU instead.
|
||||
*/
|
||||
#define __USE_GNU
|
||||
#include <netdb.h>
|
||||
#undef __USE_GNU
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <resolv.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#ifndef T_SRV
|
||||
#define T_SRV 33
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_RESCONF
|
||||
#define _PATH_RESCONF "/etc/resolv.conf"
|
||||
#endif
|
||||
|
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
/* Prelude {{{1 */
|
||||
#define _GNU_SOURCE
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
@@ -37,8 +37,6 @@
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
#ifdef __linux__
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
@@ -31,8 +31,6 @@
|
||||
* <filename>gio-unix-2.0.pc</filename> pkg-config file when using it.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE /* for F_DUPFD_CLOEXEC */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@@ -20,8 +20,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
/* We want to build the fork-based version, not the threaded version. */
|
||||
#undef HAVE_PTHREAD
|
||||
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* Author: David Zeuthen <davidz@redhat.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
Reference in New Issue
Block a user