From 0aeca08240660c2c99f1850ab419f92c066ea4ba Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 28 Nov 2021 18:05:14 -0600 Subject: [PATCH] Fix unused variable warnings found by clang/llvm 13. --- lib/portability.h | 15 ++++++++------- toys/other/xxd.c | 2 -- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/portability.h b/lib/portability.h index 4286b7b0..77b6a2a6 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -311,10 +311,17 @@ typedef enum android_LogPriority { ANDROID_LOG_FATAL, ANDROID_LOG_SILENT, } android_LogPriority; -static inline int __android_log_write(int pri, const char *tag, const char *msg) +#endif +#if !defined(__BIONIC__) || defined(__ANDROID_NDK__) +// Android NDKv18 has liblog.so but not liblog.a for static builds. +static inline int stub_out_log_write(int pri, const char *tag, const char *msg) { return -1; } +#ifdef __ANDROID_NDK__ +#define __android_log_write(a, b, c) stub_out_log_write(a, b, c) +#endif + #endif // libprocessgroup is an Android platform library not included in the NDK. @@ -331,12 +338,6 @@ static inline int get_sched_policy(int tid, void *policy) {return 0;} static inline char *get_sched_policy_name(int policy) {return "unknown";} #endif -// Android NDKv18 has liblog.so but not liblog.c for static builds, -// stub it out for now. -#ifdef __ANDROID_NDK__ -#define __android_log_write(a, b, c) (0) -#endif - #ifndef SYSLOG_NAMES typedef struct {char *c_name; int c_val;} CODE; extern CODE prioritynames[], facilitynames[]; diff --git a/toys/other/xxd.c b/toys/other/xxd.c index cc874d87..3a070dff 100644 --- a/toys/other/xxd.c +++ b/toys/other/xxd.c @@ -77,13 +77,11 @@ static void do_xxd(int fd, char *name) static void do_xxd_include(int fd, char *name) { - long long total = 0; int c = 1, i, len; // The original xxd outputs a header/footer if given a filename (not stdin). // We don't, which means that unlike the original we can implement -ri. while ((len = read(fd, toybuf, sizeof(toybuf))) > 0) { - total += len; for (i = 0; i < len; ++i) { printf("%s%#.02x", c > 1 ? ", " : " ", toybuf[i]); if (c++ == TT.c) { -- 2.39.2