Don't build code with _GNU_SOURCE, use _XOPEN_SOURCE=500 instead.

_GNU_SOURCE is only now for xbps_xasprintf() if vasprintf is found,
and only for <stdio.h>, it's unset immediately once the header is included.
This commit is contained in:
Juan RP 2011-01-25 13:00:23 +01:00
parent 64cd7cf0a4
commit be5ff1d934
9 changed files with 21 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2008-2010 Juan Romero Pardines.
* Copyright (c) 2008-2011 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,6 +27,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <signal.h>
#include <assert.h>

View File

@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include "defs.h"

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2008-2010 Juan Romero Pardines.
* Copyright (c) 2008-2011 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,6 +27,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <limits.h>
#include <libgen.h>

View File

@ -27,6 +27,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <ctype.h>
#include <assert.h>

5
configure vendored
View File

@ -184,9 +184,8 @@ fi
case "$OS" in
linux)
echo "CPPFLAGS += -D_XOPEN_SOURCE=600 -D_GNU_SOURCE" >>$CONFIG_MK
echo "CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" >> $CONFIG_MK
echo "CPPFLAGS += -D_LARGE_FILES" >> $CONFIG_MK
echo "CPPFLAGS += -D_XOPEN_SOURCE=500" >>$CONFIG_MK
echo "CPPFLAGS += -D_FILE_OFFSET_BITS=64" >> $CONFIG_MK
;;
*)
;;

View File

@ -14,6 +14,7 @@ LIBPROP_OBJS += portableproplib/prop_stack.o portableproplib/prop_string.o
LIBPROP_OBJS += portableproplib/prop_array_util.o portableproplib/prop_number.o
LIBPROP_OBJS += portableproplib/prop_dictionary_util.o
LIBPROP_OBJS += portableproplib/prop_data.o
LIBPROP_CPPFLAGS = -D_GNU_SOURCE
LIBPROP_CFLAGS = -Wno-old-style-definition -Wno-cast-qual -Wno-unused-parameter
ifdef USE_EXTERNAL_PROPLIB
@ -23,7 +24,7 @@ endif
# libfetch
LIBFETCH_OBJS = fetch/common.o fetch/fetch.o fetch/file.o
LIBFETCH_OBJS += fetch/ftp.o fetch/http.o
LIBFETCH_CPPFLAGS = -DFTP_COMBINE_CWDS -DNETBSD -DINET6 -DWITH_SSL
LIBFETCH_CPPFLAGS = -D_GNU_SOURCE -DFTP_COMBINE_CWDS -DNETBSD -DINET6 -DWITH_SSL
LIBFETCH_CFLAGS = -Wno-error -Wno-unused-macros -Wno-conversion
ifdef HAVE_VISIBILITY
LIBFETCH_SHLIBCFLAGS = -fvisibility=hidden
@ -66,7 +67,8 @@ $(LIBFETCH_OBJS): %.o: %.c $(LIBFETCH_INCS) $(LIBFETCH_GEN)
$(LIBPROP_OBJS): %.o: %.c
@printf " [CC]\t\t$@\n"
${SILENT}$(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPROP_CFLAGS) -c $< -o $@
${SILENT}$(CC) $(CPPFLAGS) $(LIBPROP_CPPFLAGS) \
$(CFLAGS) $(LIBPROP_CFLAGS) -c $< -o $@
$(OBJS): %.o: %.c
@printf " [CC]\t\t$@\n"

View File

@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <xbps_api.h>

View File

@ -33,6 +33,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <xbps_api.h>
#include "xbps_api_impl.h"

View File

@ -23,7 +23,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#ifdef HAVE_VASPRINTF
# define _GNU_SOURCE /* for vasprintf(3) */
# include <stdio.h>
# undef _GNU_SOURCE
#else
# include <stdio.h>
#endif
#include <stdbool.h>
#include <stdlib.h>
#include <stdarg.h>