author | Tanguy Pruvot <tanguy.pruvot@gmail.com> | 2014-07-31 03:51:18 (GMT) |
---|---|---|
committer | Tanguy Pruvot <tanguy.pruvot@gmail.com> | 2014-08-01 15:57:42 (GMT) |
commit | 1071f3eba24b629a3ddee740d39344f8cd1aec19 (patch) | |
tree | a7ca965f55486c1a7c039f3f070dc0a197ffa3f2 | |
parent | 477b2eba8cf27cb73073a3100830164e3912d130 (diff) | |
download | busybox-1071f3eba24b629a3ddee740d39344f8cd1aec19.zip busybox-1071f3eba24b629a3ddee740d39344f8cd1aec19.tar.gz busybox-1071f3eba24b629a3ddee740d39344f8cd1aec19.tar.bz2 |
Fix remaining bionic warnings
Tested on arm and x86 (kitkat),
aosp/master has some other ones
Also update the readme and android.h
Change-Id: I170b16f2e091b99f971fb518bf0106c0e92adfdd
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | android/librpc/bindresvport.c | 1 | ||||
-rw-r--r-- | android/librpc/rpc_dtablesize.c | 4 | ||||
-rw-r--r-- | archival/libarchive/unxz/xz_config.h | 4 | ||||
-rw-r--r-- | archival/unzip.c | 2 | ||||
-rw-r--r-- | busybox-full.config | 2 | ||||
-rw-r--r-- | editors/awk.c | 6 | ||||
-rw-r--r-- | include/android.h | 5 | ||||
-rw-r--r-- | include/libbb.h | 5 | ||||
-rw-r--r-- | libbb/inode_hash.c | 2 | ||||
-rw-r--r-- | libbb/pw_encrypt_des.c | 2 | ||||
-rw-r--r-- | libbb/pw_encrypt_sha.c | 4 | ||||
-rw-r--r-- | libbb/rtc.c | 2 | ||||
-rw-r--r-- | miscutils/less.c | 4 | ||||
-rw-r--r-- | networking/libiproute/iplink.c | 8 | ||||
-rw-r--r-- | networking/libiproute/libnetlink.c | 2 | ||||
-rw-r--r-- | networking/ping.c | 4 | ||||
-rw-r--r-- | procps/smemcap.c | 8 | ||||
-rw-r--r-- | util-linux/fdisk.c | 3 | ||||
-rw-r--r-- | util-linux/fdisk_gpt.c | 6 | ||||
-rw-r--r-- | util-linux/mkfs_ext2.c | 2 | ||||
-rw-r--r-- | util-linux/swaponoff.c | 2 |
23 files changed, 52 insertions, 35 deletions
@@ -125,7 +125,7 @@ BUSYBOX_C_INCLUDES = \ $(BB_PATH)/android/librpc BUSYBOX_CFLAGS = \ - -Werror=implicit \ + -Werror=implicit -Wno-clobbered \ -DNDEBUG \ -DANDROID \ -fno-strict-aliasing \ @@ -17,10 +17,13 @@ This tree has multiple configurations (busybox and recovery lib), the CONFIG_CROSS_COMPILER_PREFIX line! (to stay compatible with x86 targets) bb_obj=$OUT/obj/busybox/full - cat $bb_obj/.config | grep -v CROSS_COMPILER_ > ../busybox-full.config + cat $bb_obj/.config | grep -v CROSS_COMPILER_ > busybox-full.config + + bb_obj=$OUT/obj/busybox/minimal + cat $bb_obj/.config | grep -v CROSS_COMPILER_ > busybox-minimal.config If you add or remove some applets, - please also update busybox-profile.links and busybox-profile.sources + please also update busybox-<profile>.links and busybox-<profile>.sources ---------------- diff --git a/android/librpc/bindresvport.c b/android/librpc/bindresvport.c index 893873e..b526e34 100644 --- a/android/librpc/bindresvport.c +++ b/android/librpc/bindresvport.c @@ -38,6 +38,7 @@ #include <string.h> #ifdef ANDROID #include <rpc/types.h> +extern int __set_errno(int n); #else #include <sys/types.h> #endif diff --git a/android/librpc/rpc_dtablesize.c b/android/librpc/rpc_dtablesize.c index 692e8fc..0bd3a1c 100644 --- a/android/librpc/rpc_dtablesize.c +++ b/android/librpc/rpc_dtablesize.c @@ -38,6 +38,10 @@ static char sccsid[] = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro"; #include <unistd.h> #include <rpc/clnt.h> +#ifdef BIONIC_L +/* no more in unistd */ +extern int getdtablesize(void); +#endif /* * Cache the result of getdtablesize(), so we don't have to do an diff --git a/archival/libarchive/unxz/xz_config.h b/archival/libarchive/unxz/xz_config.h index 187e1cb..29f3d29 100644 --- a/archival/libarchive/unxz/xz_config.h +++ b/archival/libarchive/unxz/xz_config.h @@ -47,6 +47,10 @@ * NOTE: System headers on GNU/Linux may #define this macro already, * so if you want to change it, you need to #undef it first. */ +#ifdef __BIONIC__ +#undef __always_inline +#endif + #ifndef __always_inline # ifdef __GNUC__ # define __always_inline \ diff --git a/archival/unzip.c b/archival/unzip.c index ba9c263..1cde28d 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -228,7 +228,7 @@ static uint32_t find_cdf_offset(void) * where cdf_offset points past EOF - ?? * Ignore such CDEs: */ - if (cde_header.formatted.cdf_offset < end + (p - buf)) + if ((int64_t) cde_header.formatted.cdf_offset < end + (p - buf)) break; cde_header.formatted.cdf_offset = BAD_CDF_OFFSET; } diff --git a/busybox-full.config b/busybox-full.config index 5989ddf..7434435 100644 --- a/busybox-full.config +++ b/busybox-full.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Busybox version: 1.22.1 -# Thu Jul 3 17:45:14 2014 +# Fri Aug 1 16:21:29 2014 # CONFIG_HAVE_DOT_CONFIG=y diff --git a/editors/awk.c b/editors/awk.c index b511361..e2527ff 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -2088,7 +2088,7 @@ static char *awk_printf(node *n) char *b = NULL; char *fmt, *s, *f; const char *s1; - int i, j, incr, bsize; + int i, j, incr, bsize = 0; char c, c1; var *v, *arg; @@ -2490,11 +2490,11 @@ static var *evaluate(node *op, var *res) struct { var *v; const char *s; - } L; + } L = { NULL, NULL }; struct { var *v; const char *s; - } R; + } R = { NULL, NULL }; static double L_d; uint32_t opinfo; int opn; diff --git a/include/android.h b/include/android.h index 845a99d..0319376 100644 --- a/include/android.h +++ b/include/android.h @@ -51,10 +51,10 @@ int getsid(pid_t); /* local definition in libbb/xfuncs_printf.c */ int fdprintf(int fd, const char *format, ...); -/* local definitions in android/android.c */ +/* local definitions in android/libc/pty.c */ #include <fcntl.h> #ifndef SPLICE_F_GIFT -/* if this constant is not defined, we are +/* if this constant is not defined, ttyname is not in bionic */ char* bb_ttyname(int); int bb_ttyname_r(int, char *, size_t); @@ -66,6 +66,7 @@ extern char* ttyname(int); extern int ttyname_r(int, char *, size_t); #endif +/* local definitions in android/android.c */ char *getusershell(void); void setusershell(void); void endusershell(void); diff --git a/include/libbb.h b/include/libbb.h index 1b90e3d..ec5a59c 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -74,11 +74,6 @@ # include <shadow.h> # endif #endif -#if defined(ANDROID) || defined(__ANDROID__) -//see android.h -//# define endpwent() ((void)0) -//# define endgrent() ((void)0) -#endif #ifdef HAVE_MNTENT_H # include <mntent.h> #endif diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c index 715535e..377ecbc 100644 --- a/libbb/inode_hash.c +++ b/libbb/inode_hash.c @@ -71,7 +71,7 @@ void FAST_FUNC add_to_ino_dev_hashtable(const struct stat *statbuf, const char * /* Clear statbuf hash table */ void FAST_FUNC reset_ino_dev_hashtable(void) { - int i; + unsigned i; ino_dev_hashtable_bucket_t *bucket; for (i = 0; ino_dev_hashtable && i < HASH_SIZE; i++) { diff --git a/libbb/pw_encrypt_des.c b/libbb/pw_encrypt_des.c index c8e02dd..35326a5 100644 --- a/libbb/pw_encrypt_des.c +++ b/libbb/pw_encrypt_des.c @@ -598,7 +598,7 @@ do_des(struct des_ctx *ctx, /*uint32_t l_in, uint32_t r_in,*/ uint32_t *l_out, u * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format. */ uint32_t l, r, *kl, *kr; - uint32_t f = f; /* silence gcc */ + static uint32_t f; /* silence gcc */ uint32_t r48l, r48r; int round; diff --git a/libbb/pw_encrypt_sha.c b/libbb/pw_encrypt_sha.c index 8aeaaca..e48b341 100644 --- a/libbb/pw_encrypt_sha.c +++ b/libbb/pw_encrypt_sha.c @@ -21,7 +21,7 @@ sha_crypt(/*const*/ char *key_data, /*const*/ char *salt_data) void (*sha_begin)(void *ctx) FAST_FUNC; void (*sha_hash)(void *ctx, const void *buffer, size_t len) FAST_FUNC; void (*sha_end)(void *ctx, void *resbuf) FAST_FUNC; - int _32or64; + unsigned _32or64; char *result, *resptr; @@ -152,7 +152,7 @@ sha_crypt(/*const*/ char *key_data, /*const*/ char *salt_data) /* Start computation of S byte sequence. */ /* For every character in the password add the entire password. */ sha_begin(&alt_ctx); - for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt) + for (cnt = 0; cnt < 16U + alt_result[0]; ++cnt) sha_hash(&alt_ctx, salt_data, salt_len); sha_end(&alt_ctx, temp_result); diff --git a/libbb/rtc.c b/libbb/rtc.c index 97455e8..c31f848 100644 --- a/libbb/rtc.c +++ b/libbb/rtc.c @@ -61,7 +61,7 @@ void FAST_FUNC rtc_read_tm(struct tm *ptm, int fd) time_t FAST_FUNC rtc_tm2time(struct tm *ptm, int utc) { - char *oldtz = oldtz; /* for compiler */ + char *oldtz = NULL; time_t t; if (utc) { diff --git a/miscutils/less.c b/miscutils/less.c index 599e65c..3f4d50f 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -502,7 +502,7 @@ static void read_lines(void) } if (!(option_mask32 & FLAG_S) ? (max_fline > cur_fline + max_displayed_line) - : (max_fline >= cur_fline + : (max_fline >= (unsigned) cur_fline && max_lineno > LINENO(flines[cur_fline]) + max_displayed_line) ) { #if !ENABLE_FEATURE_LESS_REGEXP @@ -926,7 +926,7 @@ static int64_t getch_nowait(void) //TODO: reuse code for determining this if (!(option_mask32 & FLAG_S) ? !(max_fline > cur_fline + max_displayed_line) - : !(max_fline >= cur_fline + : !(max_fline >= (unsigned) cur_fline && max_lineno > LINENO(flines[cur_fline]) + max_displayed_line) ) { if (eof_error > 0) /* did NOT reach eof yet */ diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 506fb3c..1b414a2 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c @@ -338,7 +338,7 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) }; int arg; uint16_t id, proto; - struct ifla_vlan_flags flags = {}; + struct ifla_vlan_flags flags = { 0, 0 }; while (*argv) { arg = index_in_substrings(keywords, *argv); @@ -395,7 +395,7 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) #ifndef NLMSG_TAIL #define NLMSG_TAIL(nmsg) \ - ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) + ((struct rtattr *) ((void *) ((nmsg) + NLMSG_ALIGN((nmsg)->nlmsg_len)))) #endif /* Return value becomes exitcode. It's okay to not return at all */ static int do_add_or_delete(char **argv, const unsigned rtm) @@ -465,10 +465,10 @@ static int do_add_or_delete(char **argv, const unsigned rtm) if (strcmp(type_str, "vlan") == 0) vlan_parse_opt(argv, &req.n, sizeof(req)); - data->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)data; + data->rta_len = (NLMSG_TAIL(&req.n) - (data)); } - linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo; + linkinfo->rta_len = (NLMSG_TAIL(&req.n) - (linkinfo)); } if (rtm != RTM_NEWLINK) { if (!dev_str) diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c index c7533a4..7c80072 100644 --- a/networking/libiproute/libnetlink.c +++ b/networking/libiproute/libnetlink.c @@ -129,7 +129,7 @@ static int rtnl_dump_filter(struct rtnl_handle *rth, } h = (struct nlmsghdr*)buf; - while (NLMSG_OK(h, status)) { + while (NLMSG_OK(h, (unsigned) status)) { int err; if (nladdr.nl_pid != 0 || diff --git a/networking/ping.c b/networking/ping.c index b207442..46a3889 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -666,7 +666,7 @@ static void unpack6(char *packet, int sz, struct sockaddr_in6 *from, int hoplimi char buf[INET6_ADDRSTRLEN]; /* discard if too short */ - if (sz < (datalen + sizeof(struct icmp6_hdr))) + if (sz < (int) (datalen + sizeof(struct icmp6_hdr))) return; icmppkt = (struct icmp6_hdr *) packet; @@ -677,7 +677,7 @@ static void unpack6(char *packet, int sz, struct sockaddr_in6 *from, int hoplimi uint16_t recv_seq = ntohs(icmppkt->icmp6_seq); uint32_t *tp = NULL; - if (sz >= sizeof(struct icmp6_hdr) + sizeof(uint32_t)) + if (sz >= (int) (sizeof(struct icmp6_hdr) + sizeof(uint32_t))) tp = (uint32_t *) &icmppkt->icmp6_data8[4]; unpack_tail(sz, tp, inet_ntop(AF_INET6, &from->sin6_addr, diff --git a/procps/smemcap.c b/procps/smemcap.c index bb7c960..7dc1601 100644 --- a/procps/smemcap.c +++ b/procps/smemcap.c @@ -36,8 +36,16 @@ static void writeheader(const char *path, struct stat *sb, int type) strcpy(header.name, path); sprintf(header.mode, "%o", sb->st_mode & 0777); /* careful to not overflow fields! */ +#ifdef BIONIC_L + sprintf(header.uid, "%uo", sb->st_uid & 07777777); + sprintf(header.gid, "%uo", sb->st_gid & 07777777); +#elif defined(__BIONIC__) sprintf(header.uid, "%lo", sb->st_uid & 07777777); sprintf(header.gid, "%lo", sb->st_gid & 07777777); +#else + sprintf(header.uid, "%o", sb->st_uid & 07777777); + sprintf(header.gid, "%o", sb->st_gid & 07777777); +#endif sprintf(header.size, "%o", (unsigned)sb->st_size); sprintf(header.mtime, "%llo", sb->st_mtime & 077777777777LL); header.typeflag = type; diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index c1cca10..ce4c24f 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -2611,7 +2611,8 @@ write_table(void) static void print_buffer(char *pbuffer) { - int i,l; + unsigned i; + int l; for (i = 0, l = 0; i < sector_size; i++, l++) { if (l == 0) diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c index 5786d5f..4ec3ee4 100644 --- a/util-linux/fdisk_gpt.c +++ b/util-linux/fdisk_gpt.c @@ -47,7 +47,7 @@ static unsigned int part_array_len; static unsigned int part_entry_len; static inline gpt_partition * -gpt_part(int i) +gpt_part(unsigned i) { if (i >= n_parts) { return NULL; @@ -90,7 +90,7 @@ gpt_print_wide(uint16_t *s, int max_len) static void gpt_list_table(int xtra UNUSED_PARAM) { - int i; + unsigned i; char numstr6[6]; smart_ulltoa5(total_number_of_sectors * sector_size, numstr6, " KMGTPEZY")[0] = '\0'; @@ -175,7 +175,7 @@ check_gpt_label(void) part_array_len = n_parts * part_entry_len; part_array = xmalloc(part_array_len); seek_sector(SWAP_LE64(gpt_hdr->first_part_lba)); - if (full_read(dev_fd, part_array, part_array_len) != part_array_len) { + if (full_read(dev_fd, part_array, part_array_len) != (ssize_t) part_array_len) { fdisk_fatal(unable_to_read); } diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c index 900bfef..c437307 100644 --- a/util-linux/mkfs_ext2.c +++ b/util-linux/mkfs_ext2.c @@ -58,7 +58,7 @@ #define EXT2_FLAGS_UNSIGNED_HASH 0x0002 // storage helpers -char BUG_wrong_field_size(void); +unsigned char BUG_wrong_field_size(void); #define STORE_LE(field, value) \ do { \ if (sizeof(field) == 4) \ diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 5169613..963139a 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -60,7 +60,7 @@ static int swap_enable_disable(char *device) #if ENABLE_DESKTOP /* test for holes */ if (S_ISREG(st.st_mode)) - if (st.st_blocks * (off_t)512 < st.st_size) + if (st.st_blocks * (off_t)512 < (uint64_t) st.st_size) bb_error_msg("warning: swap file has holes"); #endif |