A bunch of defined(__GLIBC__) added. static-linking warning expanded
authorDenis Vlasenko <vda.linux@googlemail.com>
Mon, 18 Dec 2006 21:49:06 +0000 (21:49 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Mon, 18 Dec 2006 21:49:06 +0000 (21:49 -0000)
13 files changed:
applets/applets.c
archival/gzip.c
coreutils/tail.c
include/libbb.h
libbb/vdprintf.c
networking/ifconfig.c
networking/interface.c
networking/libiproute/ll_proto.c
networking/udhcp/clientpacket.c
networking/udhcp/clientsocket.c
networking/udhcp/packet.c
networking/udhcp/socket.c
shell/ash.c

index 23f9e4f924d98ee652a396613cc716e991ef6eb3..f8abb2767eaf48e2e393908db67caf471b9c01ed 100644 (file)
@@ -13,8 +13,6 @@
  */
 
 #include "busybox.h"
-#include <unistd.h>
-#include <string.h>
 #include <assert.h>
 
 /* 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
index 7124e9bd461d39037a9e1ade8da9540cd7d9a46a..5966c08e428b3a7e2973112ea1923a8f88e98f34 100644 (file)
@@ -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
index 4c3c3b901f5007994db2322160f00afbd501dc31..505a8fd6be1b0a8106e921a9bbf9679568e2bbe5 100644 (file)
  * 7) lseek attempted when count==0 even if arg was +0 (from top)
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
 #include "busybox.h"
 
 static const struct suffix_mult tail_suffixes[] = {
index fcd0dfa31a9e48463c4d53932f96d34be1b7a928..7dc7abd7f08e77a95e637e38adb9943fc864b387 100644 (file)
 #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 <libgen.h> in order to avoid
index ffcb7a444ebbbf61fc35bb7941f8ed30ae665950..ea2a9d4bf50edf9bd8c496c3b9a7a1406fe62882 100644 (file)
@@ -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];
index ae5b468cec974e0c3100af44ce488d80ef517d7e..242bd06387dd48c7ff099e1920957d6550b2295e 100644 (file)
@@ -29,7 +29,7 @@
 #include <net/if.h>
 #include <net/if_arp.h>
 #include <netinet/in.h>
-#if __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
+#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
 #include <netpacket/packet.h>
 #include <net/ethernet.h>
 #else
index dd455823bc404d9ad92d263446b777072549037a..1d194f38e4541185fb4a374f03237e47e451cb12 100644 (file)
@@ -741,7 +741,7 @@ static const struct hwtype loop_hwtype = {
 
 #include <net/if_arp.h>
 
-#if (__GLIBC__ >=2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
+#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
 #include <net/ethernet.h>
 #else
 #include <linux/if_ether.h>
index a3fe9d376ab79b2c734172c3f26bb470ff75ad50..20f26ca3fb9aca37d089663c52092b64afc88c21 100644 (file)
  */
 
 #include "libbb.h"
-#include <string.h>
 
 #include "rt_names.h"
 #include "utils.h"
 
-#if __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
+#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
 #include <net/ethernet.h>
 #else
 #include <linux/if_ether.h>
index 15cbda2f5c895f50f9ae7c500969a02d1dd4b444..69d7f2d38f2d7ea5fbb788251d1ab54d62dc3c3e 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <features.h>
-#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
+#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
 #include <netpacket/packet.h>
 #include <net/ethernet.h>
 #else
index 8520619686d2d49e28e500d1eb0c6e4c6f8ef9b4..b8803f04e684ac1b926a49323f3f5379b137c67a 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <features.h>
-#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
+#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
 #include <netpacket/packet.h>
 #include <net/ethernet.h>
 #else
index dec9d0ab3b5a1f1cb5946386a47b09214a5a39e3..25c55faab1c9d5f7a174bdac2fbd31f5a759ecef 100644 (file)
@@ -1,7 +1,7 @@
 /* vi: set sw=4 ts=4: */
 
 #include <netinet/in.h>
-#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
+#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
 #include <netpacket/packet.h>
 #include <net/ethernet.h>
 #else
index 2bae68f2763ed3b114ce4d6a70cde67e0a174037..9ea2002808317d0a64a7154be68e69a2ade416ab 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <net/if.h>
 #include <features.h>
-#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
+#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
 #include <netpacket/packet.h>
 #include <net/ethernet.h>
 #else
index 8ba4cb8a0c1fe87cad7ce7a3f180280c0ead634a..2f7cc868ae0d7aad4e694bc9633701e064a2dc80 100644 (file)
@@ -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
 
 
 /*