From 83e5d6f77237b64853c194b0ce592e77ef677c4d Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 18 Dec 2006 21:49:06 +0000 Subject: [PATCH] A bunch of defined(__GLIBC__) added. static-linking warning expanded --- applets/applets.c | 6 +++--- archival/gzip.c | 2 +- coreutils/tail.c | 7 ------- include/libbb.h | 2 +- libbb/vdprintf.c | 2 +- networking/ifconfig.c | 2 +- networking/interface.c | 2 +- networking/libiproute/ll_proto.c | 3 +-- networking/udhcp/clientpacket.c | 2 +- networking/udhcp/clientsocket.c | 2 +- networking/udhcp/packet.c | 2 +- networking/udhcp/socket.c | 2 +- shell/ash.c | 4 +--- 13 files changed, 14 insertions(+), 24 deletions(-) diff --git a/applets/applets.c b/applets/applets.c index 23f9e4f92..f8abb2767 100644 --- a/applets/applets.c +++ b/applets/applets.c @@ -13,8 +13,6 @@ */ #include "busybox.h" -#include -#include #include /* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */ @@ -22,7 +20,9 @@ #warning Static linking against glibc produces buggy executables #warning (glibc does not cope well with ld --gc-sections). #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 -#warning Note that glibc is utterly unsuitable for static linking anyway. +#warning Note that glibc is unsuitable for static linking anyway. +#warning If you still want to do it, remove -Wl,--gc-sections +#warning from top-level Makefile and remove this warning. #endif #if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE diff --git a/archival/gzip.c b/archival/gzip.c index 7124e9bd4..5966c08e4 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -1215,7 +1215,7 @@ int gzip_main(int argc, char **argv) path = xasprintf("%s.gz", argv[i]); /* Open output file */ -#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) && defined O_NOFOLLOW +#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && defined(O_NOFOLLOW) outFileNum = open(path, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW); #else diff --git a/coreutils/tail.c b/coreutils/tail.c index 4c3c3b901..505a8fd6b 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -24,13 +24,6 @@ * 7) lseek attempted when count==0 even if arg was +0 (from top) */ -#include -#include -#include -#include -#include -#include -#include #include "busybox.h" static const struct suffix_mult tail_suffixes[] = { diff --git a/include/libbb.h b/include/libbb.h index fcd0dfa31..7dc7abd7f 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -159,7 +159,7 @@ #endif -#if (__GLIBC__ < 2) +#if defined(__GLIBC__) && __GLIBC__ < 2 int vdprintf(int d, const char *format, va_list ap); #endif // This is declared here rather than #including in order to avoid diff --git a/libbb/vdprintf.c b/libbb/vdprintf.c index ffcb7a444..ea2a9d4bf 100644 --- a/libbb/vdprintf.c +++ b/libbb/vdprintf.c @@ -13,7 +13,7 @@ -#if (__GLIBC__ < 2) +#if defined(__GLIBC__) && __GLIBC__ < 2 int vdprintf(int d, const char *format, va_list ap) { char buf[BUF_SIZE]; diff --git a/networking/ifconfig.c b/networking/ifconfig.c index ae5b468ce..242bd0638 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -29,7 +29,7 @@ #include #include #include -#if __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 +#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 #include #include #else diff --git a/networking/interface.c b/networking/interface.c index dd455823b..1d194f38e 100644 --- a/networking/interface.c +++ b/networking/interface.c @@ -741,7 +741,7 @@ static const struct hwtype loop_hwtype = { #include -#if (__GLIBC__ >=2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) +#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) #include #else #include diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c index a3fe9d376..20f26ca3f 100644 --- a/networking/libiproute/ll_proto.c +++ b/networking/libiproute/ll_proto.c @@ -11,12 +11,11 @@ */ #include "libbb.h" -#include #include "rt_names.h" #include "utils.h" -#if __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 +#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 #include #else #include diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c index 15cbda2f5..69d7f2d38 100644 --- a/networking/udhcp/clientpacket.c +++ b/networking/udhcp/clientpacket.c @@ -9,7 +9,7 @@ */ #include -#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION +#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION #include #include #else diff --git a/networking/udhcp/clientsocket.c b/networking/udhcp/clientsocket.c index 852061968..b8803f04e 100644 --- a/networking/udhcp/clientsocket.c +++ b/networking/udhcp/clientsocket.c @@ -22,7 +22,7 @@ */ #include -#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) +#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) #include #include #else diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c index dec9d0ab3..25c55faab 100644 --- a/networking/udhcp/packet.c +++ b/networking/udhcp/packet.c @@ -1,7 +1,7 @@ /* vi: set sw=4 ts=4: */ #include -#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION +#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION #include #include #else diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c index 2bae68f27..9ea200280 100644 --- a/networking/udhcp/socket.c +++ b/networking/udhcp/socket.c @@ -25,7 +25,7 @@ #include #include -#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION +#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION #include #include #else diff --git a/shell/ash.c b/shell/ash.c index 8ba4cb8a0..2f7cc868a 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -12567,11 +12567,9 @@ letcmd(int argc, char **argv) #undef rflag -#ifdef __GLIBC__ -#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 1 +#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 1 typedef enum __rlimit_resource rlim_t; #endif -#endif /*