From 373d3c7257fa815d0b9ee8f16874470a6002042e Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Wed, 18 Oct 2017 16:28:14 -0700 Subject: Use -Werror in system/extras * Remove unused variables. * Fix redefined macro warnings. * Fix sign-compare warnings. * Fix 'return false' in main(). * Keep existing warnings to fix later. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: Ib92ef5297693595fb84ed4f8e61665bda4cee312 --- ANRdaemon/Android.mk | 1 + app-launcher/Android.mk | 2 + boot_control_copy/Android.mk | 2 +- bootctl/Android.mk | 1 + bootctl/bootctl.cpp | 1 - cpustats/Android.mk | 1 + cpustats/cpustats.c | 2 +- crypto-perf/Android.mk | 2 +- crypto-perf/crypto.cpp | 2 +- ext4_utils/Android.mk | 7 +++- kexec_tools/Android.mk | 1 + kexec_tools/kexecload.c | 4 +- ksmutils/Android.mk | 1 + ksmutils/lookup3.c | 3 ++ latencytop/Android.mk | 2 +- latencytop/latencytop.c | 11 ----- librank/Android.mk | 1 + librank/librank.c | 5 +-- memtrack/Android.mk | 2 + memtrack/memtrack.cpp | 2 +- memtrack/memtrack.h | 4 +- micro_bench/Android.mk | 2 + micro_bench/micro_bench.cpp | 3 +- multinetwork/Android.mk | 2 + pagecache/Android.mk | 1 + procmem/Android.mk | 1 + puncture_fs/Android.mk | 1 + sane_schedstat/Android.mk | 2 +- showmap/Android.mk | 1 + showslab/Android.mk | 1 + simpleperf/Android.mk | 84 +++++++++++++++++++------------------- sound/Android.mk | 2 +- sound/playwav.c | 16 ++++---- taskstats/Android.mk | 1 + tests/audio/alsa/Android.mk | 1 + tests/binder/benchmarks/Android.mk | 1 + tests/cpueater/Android.mk | 3 +- tests/crypto/Android.mk | 2 +- tests/crypto/get_dm_versions.c | 1 - tests/directiotest/Android.mk | 1 + tests/ext4/Android.mk | 1 + tests/framebuffer/Android.mk | 4 +- tests/framebuffer/fb_test.c | 1 - tests/framebuffer/refresh.c | 1 - tests/fstest/Android.mk | 1 + tests/fstest/recovery_test.cpp | 2 - tests/iptables/qtaguid/Android.mk | 2 +- tests/kernel.config/Android.mk | 5 ++- tests/pagingtest/Android.mk | 2 + tests/pagingtest/mmap_test.c | 5 +-- tests/pftest/Android.mk | 2 +- tests/schedtest/Android.mk | 2 +- tests/storage/Android.mk | 2 + tests/timetest/Android.mk | 1 + tests/uevents/Android.mk | 2 +- verity/Android.mk | 2 + verity/verify_boot_signature.c | 1 - 57 files changed, 121 insertions(+), 98 deletions(-) diff --git a/ANRdaemon/Android.mk b/ANRdaemon/Android.mk index 24072e21..de5accec 100644 --- a/ANRdaemon/Android.mk +++ b/ANRdaemon/Android.mk @@ -6,6 +6,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := ANRdaemon.cpp LOCAL_C_INCLUDES += external/zlib LOCAL_MODULE := anrd +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug LOCAL_SHARED_LIBRARIES := \ diff --git a/app-launcher/Android.mk b/app-launcher/Android.mk index 755b1d3f..cef9daaa 100644 --- a/app-launcher/Android.mk +++ b/app-launcher/Android.mk @@ -5,6 +5,7 @@ include $(CLEAR_VARS) LOCAL_MODULE_HOST_OS := linux LOCAL_SRC_FILES := computestatsf.c LOCAL_MODULE := computestatsf +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_TAGS := debug include $(BUILD_HOST_EXECUTABLE) @@ -13,6 +14,7 @@ include $(CLEAR_VARS) LOCAL_MODULE_HOST_OS := linux LOCAL_SRC_FILES := computestats.c LOCAL_MODULE := computestats +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_TAGS := debug include $(BUILD_HOST_EXECUTABLE) diff --git a/boot_control_copy/Android.mk b/boot_control_copy/Android.mk index fecd314c..c90fd7ce 100644 --- a/boot_control_copy/Android.mk +++ b/boot_control_copy/Android.mk @@ -4,7 +4,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := boot_control_copy.cpp bootinfo.cpp -LOCAL_CFLAGS := -Wall -Wno-missing-field-initializers -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-missing-field-initializers -Wno-unused-parameter LOCAL_C_INCLUDES := system/core/mkbootimg bootable/recovery LOCAL_SHARED_LIBRARIES := libbase libcutils LOCAL_STATIC_LIBRARIES := libfs_mgr diff --git a/bootctl/Android.mk b/bootctl/Android.mk index 04dbf8dd..7a0c526b 100644 --- a/bootctl/Android.mk +++ b/bootctl/Android.mk @@ -5,6 +5,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := bootctl.cpp LOCAL_MODULE := bootctl +LOCAL_CFLAGS := -Wall -Werror LOCAL_SHARED_LIBRARIES := \ libhidlbase \ libhidltransport \ diff --git a/bootctl/bootctl.cpp b/bootctl/bootctl.cpp index d80bb158..799d0666 100644 --- a/bootctl/bootctl.cpp +++ b/bootctl/bootctl.cpp @@ -174,7 +174,6 @@ static uint32_t parse_slot(int pos, int argc, char *argv[]) int main(int argc, char *argv[]) { sp module; - int ret; if (argc < 2) { usage(stderr, argc, argv); diff --git a/cpustats/Android.mk b/cpustats/Android.mk index 27899894..a6db30ff 100644 --- a/cpustats/Android.mk +++ b/cpustats/Android.mk @@ -2,6 +2,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := cpustats.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug diff --git a/cpustats/cpustats.c b/cpustats/cpustats.c index 375143b6..b2b7c07c 100644 --- a/cpustats/cpustats.c +++ b/cpustats/cpustats.c @@ -301,7 +301,7 @@ static long unsigned get_cpu_total_time(struct cpu_info *cpu) { */ static void print_stats() { char label[8]; - int i, j; + int i; char print_freq; print_freq = should_print_freq_stats(); diff --git a/crypto-perf/Android.mk b/crypto-perf/Android.mk index 291aca12..4a3cbe41 100644 --- a/crypto-perf/Android.mk +++ b/crypto-perf/Android.mk @@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir) ifeq ($(TARGET_ARCH),arm64) include $(CLEAR_VARS) -LOCAL_CFLAGS := -O0 -march=armv8-a+crypto +LOCAL_CFLAGS := -O0 -march=armv8-a+crypto -Wall -Werror LOCAL_SRC_FILES := crypto.cpp LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) diff --git a/crypto-perf/crypto.cpp b/crypto-perf/crypto.cpp index 2cd2709f..c1860764 100644 --- a/crypto-perf/crypto.cpp +++ b/crypto-perf/crypto.cpp @@ -121,7 +121,7 @@ int main(int argc, char **argv) { CPU_SET(cmd_data.cpu_to_lock, &cpuset); if (sched_setaffinity(0, sizeof(cpuset), &cpuset) != 0) { perror("sched_setaffinity failed"); - return false; + return 1; } gettimeofday(&begin_time, NULL); while (count < MAX_COUNT) { diff --git a/ext4_utils/Android.mk b/ext4_utils/Android.mk index a80e473d..6f26dd64 100644 --- a/ext4_utils/Android.mk +++ b/ext4_utils/Android.mk @@ -21,6 +21,7 @@ LOCAL_SHARED_LIBRARIES_darwin += libselinux LOCAL_SHARED_LIBRARIES_linux += libselinux LOCAL_CFLAGS_darwin := -DHOST LOCAL_CFLAGS_linux := -DHOST +LOCAL_CFLAGS += -Wall -Werror include $(BUILD_HOST_EXECUTABLE) @@ -30,6 +31,7 @@ LOCAL_MODULE := blk_alloc_to_base_fs LOCAL_SHARED_LIBRARIES := libcutils LOCAL_CFLAGS_darwin := -DHOST LOCAL_CFLAGS_linux := -DHOST +LOCAL_CFLAGS += -Wall -Werror include $(BUILD_HOST_EXECUTABLE) # @@ -49,7 +51,7 @@ LOCAL_SHARED_LIBRARIES := \ libext4_utils \ libselinux \ libz -LOCAL_CFLAGS := -DREAL_UUID +LOCAL_CFLAGS := -DREAL_UUID -Wall -Werror include $(BUILD_EXECUTABLE) @@ -57,11 +59,13 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := setup_fs.c LOCAL_MODULE := setup_fs LOCAL_SHARED_LIBRARIES += libcutils +LOCAL_CFLAGS := -Wall -Werror include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_SRC_FILES := ext4fixup_main.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE := ext4fixup LOCAL_SHARED_LIBRARIES += \ libext4_utils \ @@ -72,6 +76,7 @@ include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_SRC_FILES := ext4fixup_main.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE := ext4fixup LOCAL_STATIC_LIBRARIES += \ libext4_utils \ diff --git a/kexec_tools/Android.mk b/kexec_tools/Android.mk index f6bf7dc2..c8a49321 100644 --- a/kexec_tools/Android.mk +++ b/kexec_tools/Android.mk @@ -20,4 +20,5 @@ LOCAL_MODULE := kexecload LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := eng LOCAL_SRC_FILES := kexecload.c +LOCAL_CFLAGS := -Wall -Werror include $(BUILD_EXECUTABLE) diff --git a/kexec_tools/kexecload.c b/kexec_tools/kexecload.c index 2bf3d183..71365435 100644 --- a/kexec_tools/kexecload.c +++ b/kexec_tools/kexecload.c @@ -68,8 +68,7 @@ int main(int argc, char *argv[]) int atag_file, zimage_file; int atag_size, - zimage_size, - total_size; + zimage_size; void *atag_buffer; void *zimage_buffer; struct kexec_segment segment[2]; @@ -85,7 +84,6 @@ int main(int argc, char *argv[]) }; while (1) { - int option_index = 0; c = getopt_long(argc, argv, "s:th", longopts, NULL); if (c < 0) { break; diff --git a/ksmutils/Android.mk b/ksmutils/Android.mk index b7825c4e..2be4ddf2 100644 --- a/ksmutils/Android.mk +++ b/ksmutils/Android.mk @@ -16,6 +16,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := ksminfo.c lookup3.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_SHARED_LIBRARIES := libpagemap LOCAL_MODULE := ksminfo LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) diff --git a/ksmutils/lookup3.c b/ksmutils/lookup3.c index 8fcc3255..6563feb3 100644 --- a/ksmutils/lookup3.c +++ b/ksmutils/lookup3.c @@ -316,6 +316,7 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval) */ #ifndef VALGRIND + (void) k8; // unused switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; @@ -501,6 +502,7 @@ void hashlittle2( */ #ifndef VALGRIND + (void) k8; // unused switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; @@ -678,6 +680,7 @@ uint32_t hashbig( const void *key, size_t length, uint32_t initval) */ #ifndef VALGRIND + (void) k8; // unused switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; diff --git a/latencytop/Android.mk b/latencytop/Android.mk index 220f4e36..6649a83b 100644 --- a/latencytop/Android.mk +++ b/latencytop/Android.mk @@ -23,6 +23,6 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter include $(BUILD_EXECUTABLE) diff --git a/latencytop/latencytop.c b/latencytop/latencytop.c index 667fbf7e..d20bd7f5 100644 --- a/latencytop/latencytop.c +++ b/latencytop/latencytop.c @@ -46,11 +46,9 @@ static struct latency_entry *read_process_stats(struct latency_entry *list, int static struct latency_entry *read_thread_stats(struct latency_entry *list, int erase, int pid, int tid, int fatal); static struct latency_entry *alloc_latency_entry(void); -static void free_latency_entry(struct latency_entry *e); static void set_latencytop(int on); static struct latency_entry *read_latency_file(FILE *f, struct latency_entry *list); -static void erase_latency_file(FILE *f); static struct latency_entry *find_latency_entry(struct latency_entry *e, char *reason); static void print_latency_entries(struct latency_entry *head); @@ -286,11 +284,6 @@ static struct latency_entry *alloc_latency_entry(void) { return e; } -static void free_latency_entry(struct latency_entry *e) { - e->next = free_entries; - free_entries = e; -} - static struct latency_entry *find_latency_entry(struct latency_entry *head, char *reason) { struct latency_entry *e; @@ -319,10 +312,6 @@ static void set_latencytop(int on) { fclose(f); } -static void erase_latency_file(FILE *f) { - fprintf(f, "erase\n"); -} - static struct latency_entry *read_latency_file(FILE *f, struct latency_entry *list) { struct latency_entry *e, *head; char line[MAX_LINE]; diff --git a/librank/Android.mk b/librank/Android.mk index 101b94a2..d19b2a6a 100644 --- a/librank/Android.mk +++ b/librank/Android.mk @@ -16,6 +16,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := librank.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_SHARED_LIBRARIES := libpagemap LOCAL_MODULE := librank LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) diff --git a/librank/librank.c b/librank/librank.c index f017c9d2..7aa19881 100644 --- a/librank/librank.c +++ b/librank/librank.c @@ -196,7 +196,6 @@ static int parse_perm(const char *perm) } int main(int argc, char *argv[]) { - char cmdline[256]; char *prefix; size_t prefix_len; int (*compfn)(const void *a, const void *b); @@ -211,8 +210,8 @@ int main(int argc, char *argv[]) { size_t num_maps; pm_memusage_t map_usage; - struct library_info *li, **lis; - struct mapping_info *mi, **mis; + struct library_info *li; + struct mapping_info *mi; struct process_info *pi; size_t i, j; diff --git a/memtrack/Android.mk b/memtrack/Android.mk index 5fa9f157..cd99b6cc 100644 --- a/memtrack/Android.mk +++ b/memtrack/Android.mk @@ -24,6 +24,7 @@ LOCAL_SRC_FILES := $(src_files) LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE := memtrack_share +LOCAL_CFLAGS := -Wall -Werror -Wno-error=unused-value LOCAL_C_INCLUDES += $(includes) LOCAL_SHARED_LIBRARIES := \ @@ -37,6 +38,7 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk LOCAL_SRC_FILES := $(src_files) LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE := memtrack +LOCAL_CFLAGS := -Wall -Werror -Wno-error=unused-value LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_STATIC_LIBRARIES := \ diff --git a/memtrack/memtrack.cpp b/memtrack/memtrack.cpp index 8ff5c07d..d3736091 100644 --- a/memtrack/memtrack.cpp +++ b/memtrack/memtrack.cpp @@ -68,7 +68,7 @@ bool FileData::isAvail(size_t bytes_needed) { while (cur_idx_ + bytes_needed >= len_) { bytes = read(fd_, data_ + len_, max_ - len_); if (bytes == 0 || bytes == -1) { - read_complete_; + read_complete_; // unused read? break; } len_ += bytes; diff --git a/memtrack/memtrack.h b/memtrack/memtrack.h index 602fdb22..6c3ab453 100644 --- a/memtrack/memtrack.h +++ b/memtrack/memtrack.h @@ -24,7 +24,9 @@ #include #define DEFAULT_SLEEP_DELAY_SECONDS 5 -#define NS_PER_SEC 1000000000LL +#ifndef NS_PER_SEC +#define NS_PER_SEC 1000000000ULL +#endif class FileData { public: diff --git a/micro_bench/Android.mk b/micro_bench/Android.mk index 0655536e..843a2e5e 100644 --- a/micro_bench/Android.mk +++ b/micro_bench/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES := micro_bench.cpp LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug LOCAL_MODULE := micro_bench +LOCAL_CFLAGS := -Wall -Werror -Wno-error=unused-variable LOCAL_MULTILIB := both LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE) @@ -19,6 +20,7 @@ LOCAL_SRC_FILES := micro_bench.cpp LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug LOCAL_MODULE := micro_bench_static +LOCAL_CFLAGS := -Wall -Werror -Wno-error=unused-variable LOCAL_STATIC_LIBRARIES = libc libm LOCAL_FORCE_STATIC_EXECUTABLE := true diff --git a/micro_bench/micro_bench.cpp b/micro_bench/micro_bench.cpp index 4d3177da..05cc54ed 100644 --- a/micro_bench/micro_bench.cpp +++ b/micro_bench/micro_bench.cpp @@ -400,6 +400,7 @@ int benchmarkMemset(const char *name, const command_data_t &cmd_data, void_func_ int benchmarkMemsetCold(const char *name, const command_data_t &cmd_data, void_func_t func) { memset_func_t memset_func = reinterpret_cast(func); COLD_ONE_BUF(name, cmd_data, ;, memset_func(buf, l, size)); + (void)buffer_size; return 0; } @@ -430,7 +431,7 @@ int benchmarkMemmoveBackwards(const char *name, const command_data_t &cmd_data, memcpy_func_t memmove_func = reinterpret_cast(func); size_t size = cmd_data.args[0]; - size_t alloc_size = size * 2 + 3 * cmd_data.dst_align; + size_t alloc_size = size * 2 + 3 * cmd_data.dst_align; // should alloc_size be used? uint8_t* src = allocateAlignedMemory(size, cmd_data.src_align, cmd_data.src_or_mask); if (!src) return -1; diff --git a/multinetwork/Android.mk b/multinetwork/Android.mk index 356a46a6..7e6426a1 100644 --- a/multinetwork/Android.mk +++ b/multinetwork/Android.mk @@ -6,6 +6,7 @@ ifneq ($(TARGET_BUILD_PDK), true) # Sample util binaries. include $(CLEAR_VARS) LOCAL_MODULE := dnschk +LOCAL_CFLAGS := -Wall -Werror LOCAL_C_INCLUDES += frameworks/native/include external/libcxx/include LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) @@ -18,6 +19,7 @@ include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_MODULE := httpurl +LOCAL_CFLAGS := -Wall -Werror LOCAL_C_INCLUDES += frameworks/native/include external/libcxx/include LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) diff --git a/pagecache/Android.mk b/pagecache/Android.mk index fe064100..7861273a 100644 --- a/pagecache/Android.mk +++ b/pagecache/Android.mk @@ -4,6 +4,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= dumpcache.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_SHARED_LIBRARIES := libcutils LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug diff --git a/procmem/Android.mk b/procmem/Android.mk index b7fba563..6e9e2105 100644 --- a/procmem/Android.mk +++ b/procmem/Android.mk @@ -16,6 +16,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := procmem.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_SHARED_LIBRARIES := libpagemap LOCAL_MODULE := procmem LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) diff --git a/puncture_fs/Android.mk b/puncture_fs/Android.mk index 0b79cca7..2c72ed8a 100644 --- a/puncture_fs/Android.mk +++ b/puncture_fs/Android.mk @@ -17,6 +17,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := puncture_fs.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_C_INCLUDES += system/core/logwrapper/include diff --git a/sane_schedstat/Android.mk b/sane_schedstat/Android.mk index c984b9f2..5351ea6a 100644 --- a/sane_schedstat/Android.mk +++ b/sane_schedstat/Android.mk @@ -7,6 +7,6 @@ LOCAL_SRC_FILES := sane_schedstat.c LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug LOCAL_MODULE := sane_schedstat -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter include $(BUILD_EXECUTABLE) diff --git a/showmap/Android.mk b/showmap/Android.mk index 44ca8183..c9279ba1 100644 --- a/showmap/Android.mk +++ b/showmap/Android.mk @@ -4,6 +4,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= showmap.cpp +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug LOCAL_MODULE:= showmap diff --git a/showslab/Android.mk b/showslab/Android.mk index c914a8b6..f48c52cb 100644 --- a/showslab/Android.mk +++ b/showslab/Android.mk @@ -4,6 +4,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= showslab.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_SHARED_LIBRARIES := LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) diff --git a/simpleperf/Android.mk b/simpleperf/Android.mk index 5d079761..3cc6cf9f 100644 --- a/simpleperf/Android.mk +++ b/simpleperf/Android.mk @@ -17,17 +17,17 @@ LOCAL_PATH := $(call my-dir) simpleperf_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null) -simpleperf_common_cppflags := -Wextra -Wunused -Wno-unknown-pragmas \ +simpleperf_common_cflags := -Wall -Werror -Wextra -Wunused -Wno-unknown-pragmas \ -DSIMPLEPERF_REVISION='"$(simpleperf_version)"' -simpleperf_cppflags_target := $(simpleperf_common_cppflags) +simpleperf_cflags_target := $(simpleperf_common_cflags) -simpleperf_cppflags_host := $(simpleperf_common_cppflags) \ +simpleperf_cflags_host := $(simpleperf_common_cflags) \ -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \ -fvisibility=hidden \ -simpleperf_cppflags_host_darwin := -I $(LOCAL_PATH)/nonlinux_support/include -simpleperf_cppflags_host_windows := -I $(LOCAL_PATH)/nonlinux_support/include +simpleperf_cflags_host_darwin := -I $(LOCAL_PATH)/nonlinux_support/include +simpleperf_cflags_host_windows := -I $(LOCAL_PATH)/nonlinux_support/include LLVM_ROOT_PATH := external/llvm @@ -133,7 +133,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf LOCAL_MODULE_TAGS := debug LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) -LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) +LOCAL_CFLAGS := $(simpleperf_cflags_target) LOCAL_SRC_FILES := \ $(libsimpleperf_src_files) \ $(libsimpleperf_src_files_linux) \ @@ -148,10 +148,10 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf LOCAL_MODULE_HOST_OS := darwin linux windows -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) -LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_darwin := $(simpleperf_cflags_host_darwin) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) +LOCAL_CFLAGS_windows := $(simpleperf_cflags_host_windows) LOCAL_SRC_FILES := $(libsimpleperf_src_files) LOCAL_SRC_FILES_darwin := $(libsimpleperf_src_files_darwin) LOCAL_SRC_FILES_linux := $(libsimpleperf_src_files_linux) @@ -174,7 +174,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := simpleperf LOCAL_MODULE_TAGS := debug LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) -LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) +LOCAL_CFLAGS := $(simpleperf_cflags_target) LOCAL_SRC_FILES := main.cpp LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_with_libc_target) ifdef TARGET_2ND_ARCH @@ -195,10 +195,10 @@ endif include $(CLEAR_VARS) LOCAL_MODULE := simpleperf_host LOCAL_MODULE_HOST_OS := darwin linux windows -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) -LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_darwin := $(simpleperf_cflags_host_darwin) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) +LOCAL_CFLAGS_windows := $(simpleperf_cflags_host_windows) LOCAL_SRC_FILES := main.cpp LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux) @@ -227,7 +227,7 @@ endif # libsimpleperf_record.a on target include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf_record -LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) +LOCAL_CFLAGS := $(simpleperf_cflags_target) LOCAL_SRC_FILES := record_lib_interface.cpp LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target) LOCAL_MULTILIB := both @@ -240,7 +240,7 @@ include $(BUILD_STATIC_LIBRARY) # libsimpleperf_record.so on target include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf_record -LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) +LOCAL_CFLAGS := $(simpleperf_cflags_target) LOCAL_SRC_FILES := record_lib_interface.cpp LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target) LOCAL_MULTILIB := both @@ -254,8 +254,8 @@ include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf_record LOCAL_MODULE_HOST_OS := linux -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) LOCAL_SRC_FILES := record_lib_interface.cpp LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux) @@ -270,8 +270,8 @@ include $(BUILD_HOST_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf_record LOCAL_MODULE_HOST_OS := linux -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) LOCAL_SRC_FILES := record_lib_interface.cpp LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux) @@ -290,10 +290,10 @@ include $(BUILD_HOST_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf_report LOCAL_MODULE_HOST_OS := darwin linux windows -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) -LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_darwin := $(simpleperf_cflags_host_darwin) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) +LOCAL_CFLAGS_windows := $(simpleperf_cflags_host_windows) LOCAL_SRC_FILES := report_lib_interface.cpp LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux) @@ -321,7 +321,7 @@ endif # libsimpleperf_inplace_sampler.so on target include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf_inplace_sampler -LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) +LOCAL_CFLAGS := $(simpleperf_cflags_target) LOCAL_SRC_FILES := inplace_sampler_lib.cpp LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target) LOCAL_MULTILIB := both @@ -334,8 +334,8 @@ include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf_inplace_sampler LOCAL_MODULE_HOST_OS := linux -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) LOCAL_SRC_FILES := inplace_sampler_lib.cpp LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux) @@ -375,7 +375,7 @@ simpleperf_unit_test_src_files_linux := \ include $(CLEAR_VARS) LOCAL_MODULE := simpleperf_unit_test LOCAL_COMPATIBILITY_SUITE := device-tests -LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) +LOCAL_CFLAGS := $(simpleperf_cflags_target) LOCAL_SRC_FILES := \ $(simpleperf_unit_test_src_files) \ $(simpleperf_unit_test_src_files_linux) \ @@ -391,10 +391,10 @@ include $(BUILD_NATIVE_TEST) include $(CLEAR_VARS) LOCAL_MODULE := simpleperf_unit_test LOCAL_MODULE_HOST_OS := darwin linux windows -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) -LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_darwin := $(simpleperf_cflags_host_darwin) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) +LOCAL_CFLAGS_windows := $(simpleperf_cflags_host_windows) LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files) LOCAL_SRC_FILES_linux := $(simpleperf_unit_test_src_files_linux) LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) @@ -414,7 +414,7 @@ simpleperf_cpu_hotplug_test_src_files := \ include $(CLEAR_VARS) LOCAL_MODULE := simpleperf_cpu_hotplug_test LOCAL_COMPATIBILITY_SUITE := device-tests -LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) +LOCAL_CFLAGS := $(simpleperf_cflags_target) LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files) LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_with_libc_target) LOCAL_MULTILIB := both @@ -426,8 +426,8 @@ include $(BUILD_NATIVE_TEST) include $(CLEAR_VARS) LOCAL_MODULE := simpleperf_cpu_hotplug_test LOCAL_MODULE_HOST_OS := linux -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files) LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux) @@ -448,7 +448,7 @@ libsimpleperf_cts_test_src_files := \ # libsimpleperf_cts_test target include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf_cts_test -LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) -DRUN_IN_APP_CONTEXT="\"com.android.simpleperf\"" +LOCAL_CFLAGS := $(simpleperf_cflags_target) -DRUN_IN_APP_CONTEXT="\"com.android.simpleperf\"" LOCAL_SRC_FILES := $(libsimpleperf_cts_test_src_files) LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_target) LOCAL_MULTILIB := both @@ -460,8 +460,8 @@ include $(BUILD_STATIC_TEST_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libsimpleperf_cts_test LOCAL_MODULE_HOST_OS := linux -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) LOCAL_SRC_FILES := $(libsimpleperf_cts_test_src_files) LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host) LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux) @@ -476,7 +476,7 @@ include $(BUILD_HOST_STATIC_TEST_LIBRARY) # simpleperf_record_test target include $(CLEAR_VARS) LOCAL_MODULE := simpleperf_record_test -LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) +LOCAL_CFLAGS := $(simpleperf_cflags_target) LOCAL_SRC_FILES := record_lib_test.cpp LOCAL_SHARED_LIBRARIES := libsimpleperf_record LOCAL_MULTILIB := both @@ -486,8 +486,8 @@ include $(BUILD_NATIVE_TEST) include $(CLEAR_VARS) LOCAL_MODULE := simpleperf_record_test LOCAL_MODULE_HOST_OS := linux -LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) +LOCAL_CFLAGS := $(simpleperf_cflags_host) +LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux) LOCAL_SRC_FILES := record_lib_test.cpp LOCAL_SHARED_LIBRARIES := libsimpleperf_record LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux) diff --git a/sound/Android.mk b/sound/Android.mk index a08c4371..860c4958 100644 --- a/sound/Android.mk +++ b/sound/Android.mk @@ -3,6 +3,6 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := sound LOCAL_SRC_FILES := playwav.c -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter include $(BUILD_EXECUTABLE) diff --git a/sound/playwav.c b/sound/playwav.c index 19a755e8..604ad959 100644 --- a/sound/playwav.c +++ b/sound/playwav.c @@ -40,7 +40,9 @@ int pcm_play(unsigned rate, unsigned channels, void *cookie) { struct msm_audio_config config; +#if 0 struct msm_audio_stats stats; +#endif unsigned sz, n; char buf[8192]; int afd; @@ -72,7 +74,7 @@ int pcm_play(unsigned rate, unsigned channels, for (n = 0; n < config.buffer_count; n++) { if (fill(buf, sz, cookie)) break; - if (write(afd, buf, sz) != sz) + if (write(afd, buf, sz) != (ssize_t) sz) break; } @@ -86,11 +88,10 @@ int pcm_play(unsigned rate, unsigned channels, #endif if (fill(buf, sz, cookie)) break; - if (write(afd, buf, sz) != sz) + if (write(afd, buf, sz) != (ssize_t) sz) break; } -done: close(afd); return 0; } @@ -142,7 +143,7 @@ void play_file(unsigned rate, unsigned channels, fprintf(stderr,"could not allocate %d bytes\n", count); return; } - if (read(fd, next, count) != count) { + if (read(fd, next, count) != (ssize_t) count) { fprintf(stderr,"could not read %d bytes\n", count); return; } @@ -153,7 +154,6 @@ void play_file(unsigned rate, unsigned channels, int wav_play(const char *fn) { struct wav_header hdr; - unsigned rate, channels; int fd; fd = open(fn, O_RDONLY); if (fd < 0) { @@ -195,7 +195,7 @@ int wav_rec(const char *fn, unsigned channels, unsigned rate) struct wav_header hdr; unsigned char buf[8192]; struct msm_audio_config cfg; - unsigned sz, n; + unsigned sz; int fd, afd; unsigned total = 0; unsigned char tmp; @@ -265,11 +265,11 @@ int wav_rec(const char *fn, unsigned channels, unsigned rate) while (read(0, &tmp, 1) == 1) { if ((tmp == 13) || (tmp == 10)) goto done; } - if (read(afd, buf, sz) != sz) { + if (read(afd, buf, sz) != (ssize_t) sz) { perror("cannot read buffer"); goto fail; } - if (write(fd, buf, sz) != sz) { + if (write(fd, buf, sz) != (ssize_t) sz) { perror("cannot write buffer"); goto fail; } diff --git a/taskstats/Android.mk b/taskstats/Android.mk index 1a3cbdb7..38044f08 100644 --- a/taskstats/Android.mk +++ b/taskstats/Android.mk @@ -12,5 +12,6 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := debug LOCAL_MODULE:= taskstats +LOCAL_CFLAGS:= -Wall -Werror include $(BUILD_EXECUTABLE) diff --git a/tests/audio/alsa/Android.mk b/tests/audio/alsa/Android.mk index c6e5a8af..7d37af96 100644 --- a/tests/audio/alsa/Android.mk +++ b/tests/audio/alsa/Android.mk @@ -20,6 +20,7 @@ include $(CLEAR_VARS) LOCAL_MODULE_TAGS := tests LOCAL_MODULE := pcmtest LOCAL_SRC_FILES := pcmtest.cpp +LOCAL_CFLAGS:= -Wall -Werror LOCAL_SHARED_LIBRARIES += libcutils libutils liblog libtinyalsa LOCAL_STATIC_LIBRARIES += libtestUtil LOCAL_C_INCLUDES += system/extras/tests/include external/tinyalsa/include diff --git a/tests/binder/benchmarks/Android.mk b/tests/binder/benchmarks/Android.mk index b43dd326..e3812ff7 100644 --- a/tests/binder/benchmarks/Android.mk +++ b/tests/binder/benchmarks/Android.mk @@ -36,5 +36,6 @@ LOCAL_C_INCLUDES += \ LOCAL_MODULE := binderAddInts LOCAL_COMPATIBILITY_SUITE := device-tests LOCAL_SRC_FILES := binderAddInts.cpp +LOCAL_CFLAGS:= -Wall -Werror include $(BUILD_NATIVE_BENCHMARK) diff --git a/tests/cpueater/Android.mk b/tests/cpueater/Android.mk index 0bb08d9d..3ee7a379 100644 --- a/tests/cpueater/Android.mk +++ b/tests/cpueater/Android.mk @@ -20,7 +20,7 @@ LOCAL_MODULE := cpueater LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := eng LOCAL_SRC_FILES := cpueater.c -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) @@ -28,6 +28,7 @@ LOCAL_MODULE := daemonize LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := eng LOCAL_SRC_FILES := daemonize.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_SHARED_LIBRARIES := libhardware_legacy include $(BUILD_EXECUTABLE) diff --git a/tests/crypto/Android.mk b/tests/crypto/Android.mk index e118e5d0..d48f7229 100644 --- a/tests/crypto/Android.mk +++ b/tests/crypto/Android.mk @@ -7,5 +7,5 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= get_dm_versions.c LOCAL_MODULE:= get_dm_versions LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter include $(BUILD_EXECUTABLE) diff --git a/tests/crypto/get_dm_versions.c b/tests/crypto/get_dm_versions.c index 8ffe0a19..ba6b8953 100644 --- a/tests/crypto/get_dm_versions.c +++ b/tests/crypto/get_dm_versions.c @@ -27,7 +27,6 @@ int main(int argc, char *argv[]) char buffer[DM_CRYPT_BUF_SIZE]; struct dm_ioctl *io; struct dm_target_versions *v; - int i; int fd; fd = open("/dev/device-mapper", O_RDWR); diff --git a/tests/directiotest/Android.mk b/tests/directiotest/Android.mk index fb5f12a2..2bde675f 100644 --- a/tests/directiotest/Android.mk +++ b/tests/directiotest/Android.mk @@ -5,4 +5,5 @@ LOCAL_MODULE := directiotest LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := eng LOCAL_SRC_FILES := directiotest.c +LOCAL_CFLAGS := -Wall -Werror include $(BUILD_EXECUTABLE) diff --git a/tests/ext4/Android.mk b/tests/ext4/Android.mk index bdd4072a..a9a684d2 100644 --- a/tests/ext4/Android.mk +++ b/tests/ext4/Android.mk @@ -5,6 +5,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= rand_emmc_perf.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE:= rand_emmc_perf LOCAL_MULTILIB := both LOCAL_MODULE_STEM_32:= rand_emmc_perf diff --git a/tests/framebuffer/Android.mk b/tests/framebuffer/Android.mk index 7f4c7125..1c4f5df7 100644 --- a/tests/framebuffer/Android.mk +++ b/tests/framebuffer/Android.mk @@ -9,7 +9,7 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_MODULE:= test-fb-refresh -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter include $(BUILD_EXECUTABLE) @@ -20,5 +20,5 @@ LOCAL_SRC_FILES := fb_test.c LOCAL_MODULE = test-fb-simple LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_STATIC_LIBRARIES := libc -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter include $(BUILD_EXECUTABLE) diff --git a/tests/framebuffer/fb_test.c b/tests/framebuffer/fb_test.c index 0b8bc68c..6d386299 100644 --- a/tests/framebuffer/fb_test.c +++ b/tests/framebuffer/fb_test.c @@ -206,7 +206,6 @@ uint32_t black32 = 0x0; void draw_grid(int w, int h, void* _loc) { int i, j; - int v; int stride = fi.line_length / (vi.bits_per_pixel >> 3); uint16_t *loc = _loc; uint32_t *loc32 = _loc; diff --git a/tests/framebuffer/refresh.c b/tests/framebuffer/refresh.c index 38e78719..0c2bb9d5 100644 --- a/tests/framebuffer/refresh.c +++ b/tests/framebuffer/refresh.c @@ -32,7 +32,6 @@ int main(int argc, char** argv) 0 }; int fd = -1; int i=0; - int j=0; char name[64]; while ((fd==-1) && device_template[i]) { snprintf(name, 64, device_template[i], 0); diff --git a/tests/fstest/Android.mk b/tests/fstest/Android.mk index 8ea48818..52f113ce 100644 --- a/tests/fstest/Android.mk +++ b/tests/fstest/Android.mk @@ -18,6 +18,7 @@ include $(CLEAR_VARS) LOCAL_MODULE_TAGS := tests LOCAL_MODULE := recovery_test LOCAL_SRC_FILES := recovery_test.cpp +LOCAL_CFLAGS := -Wall -Werror LOCAL_SHARED_LIBRARIES += libcutils libutils libbase liblog \ liblogwrap libext4_utils LOCAL_STATIC_LIBRARIES += libtestUtil libfs_mgr diff --git a/tests/fstest/recovery_test.cpp b/tests/fstest/recovery_test.cpp index e2371395..c34607d6 100644 --- a/tests/fstest/recovery_test.cpp +++ b/tests/fstest/recovery_test.cpp @@ -216,7 +216,6 @@ class FsRecoveryTest : public ::testing::Test { UMOUNT_BIN, cache_str, }; - int status; return android_fork_execvp_ext(ARRAY_SIZE(umount_argv), umount_argv, NULL, true, LOG_KLOG, false, NULL, NULL, 0) >= 0; @@ -230,7 +229,6 @@ class FsRecoveryTest : public ::testing::Test { storage_str, mountall_str, }; - int status; return android_fork_execvp_ext(ARRAY_SIZE(mountall_argv), mountall_argv, NULL, true, LOG_KLOG, false, NULL, NULL, 0) >= 0; diff --git a/tests/iptables/qtaguid/Android.mk b/tests/iptables/qtaguid/Android.mk index 6328883d..bc09bdd8 100644 --- a/tests/iptables/qtaguid/Android.mk +++ b/tests/iptables/qtaguid/Android.mk @@ -23,6 +23,6 @@ LOCAL_SRC_FILES := socketTag.cpp LOCAL_SHARED_LIBRARIES += libcutils libutils liblog libbase LOCAL_STATIC_LIBRARIES += libtestUtil LOCAL_C_INCLUDES += system/extras/tests/include -LOCAL_CFLAGS += -fno-strict-aliasing +LOCAL_CFLAGS += -Wall -Werror -fno-strict-aliasing include $(BUILD_NATIVE_TEST) diff --git a/tests/kernel.config/Android.mk b/tests/kernel.config/Android.mk index 0c87107f..aa506c08 100644 --- a/tests/kernel.config/Android.mk +++ b/tests/kernel.config/Android.mk @@ -33,7 +33,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := kernel-config-unit-tests LOCAL_MODULE_TAGS := tests LOCAL_CFLAGS := $(test_c_flags) -LOCAL_CFLAGS := -DHAS_KCMP +LOCAL_CFLAGS += -DHAS_KCMP LOCAL_SRC_FILES := $(test_src_files) LOCAL_SHARED_LIBRARIES := libbase include $(BUILD_NATIVE_TEST) @@ -42,7 +42,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := CtsKernelConfigTestCases LOCAL_MODULE_TAGS := optional LOCAL_CFLAGS := $(test_c_flags) -LOCAL_CFLAGS := -DHAS_KCMP +LOCAL_CFLAGS += -DHAS_KCMP LOCAL_SRC_FILES := $(cts_src_files) LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest LOCAL_MULTILIB := both @@ -60,4 +60,5 @@ LOCAL_SRC_FILES := \ scrape_mmap_addr.cpp LOCAL_MODULE := scrape_mmap_addr +LOCAL_CFLAGS := -Wall -Werror include $(BUILD_NATIVE_TEST) diff --git a/tests/pagingtest/Android.mk b/tests/pagingtest/Android.mk index 727e3b81..de952ce3 100644 --- a/tests/pagingtest/Android.mk +++ b/tests/pagingtest/Android.mk @@ -10,6 +10,8 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE:= pagingtest +LOCAL_CFLAGS := -Wall -Werror + LOCAL_MODULE_TAGS := tests LOCAL_MODULE_PATH := $(local_target_dir) diff --git a/tests/pagingtest/mmap_test.c b/tests/pagingtest/mmap_test.c index d0d9846a..93859880 100644 --- a/tests/pagingtest/mmap_test.c +++ b/tests/pagingtest/mmap_test.c @@ -10,7 +10,6 @@ int mmap_test(int test_runs, unsigned long long alloc_size) { void *buf; int ret = -1; - int rc; int i; struct timeval begin_time, end_time, elapsed_time; struct timeval total_time_mmap, total_time_munmap, total_time_in, total_time_out; @@ -43,8 +42,8 @@ int mmap_test(int test_runs, unsigned long long alloc_size) { ret = 0; goto end; -err: - munmap(buf, alloc_size); +// err: + munmap(buf, alloc_size); // unreached? end: err_map: return ret; diff --git a/tests/pftest/Android.mk b/tests/pftest/Android.mk index bedbd0cb..1f829370 100644 --- a/tests/pftest/Android.mk +++ b/tests/pftest/Android.mk @@ -13,6 +13,6 @@ LOCAL_MODULE:= pftest LOCAL_MODULE_TAGS := optional ## LOCAL_CFLAGS += -fstack-protector-all -LOCAL_CFLAGS += -fomit-frame-pointer +LOCAL_CFLAGS += -fomit-frame-pointer -Wall -Werror include $(BUILD_EXECUTABLE) diff --git a/tests/schedtest/Android.mk b/tests/schedtest/Android.mk index 036c9fec..a018cb50 100644 --- a/tests/schedtest/Android.mk +++ b/tests/schedtest/Android.mk @@ -6,6 +6,6 @@ LOCAL_SRC_FILES := \ schedtest.c LOCAL_MODULE := schedtest -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wno-unused-parameter -Wall -Werror include $(BUILD_EXECUTABLE) diff --git a/tests/storage/Android.mk b/tests/storage/Android.mk index 462ebef6..41bbd661 100644 --- a/tests/storage/Android.mk +++ b/tests/storage/Android.mk @@ -6,12 +6,14 @@ include $(CLEAR_VARS) include $(CLEAR_VARS) LOCAL_SRC_FILES := opentest.c LOCAL_MODULE := opentest +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_TAGS := optional include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_SRC_FILES := wipe_blkdev.c LOCAL_MODULE := wipe_blkdev +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_TAGS := optional include $(BUILD_EXECUTABLE) diff --git a/tests/timetest/Android.mk b/tests/timetest/Android.mk index 0485caec..af3447fd 100644 --- a/tests/timetest/Android.mk +++ b/tests/timetest/Android.mk @@ -5,6 +5,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := timetest.c LOCAL_MODULE := timetest +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_TAGS := tests LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_STATIC_LIBRARIES := libc diff --git a/tests/uevents/Android.mk b/tests/uevents/Android.mk index fb8a8518..46e712d4 100644 --- a/tests/uevents/Android.mk +++ b/tests/uevents/Android.mk @@ -6,6 +6,6 @@ LOCAL_SRC_FILES := uevents.c LOCAL_SHARED_LIBRARIES += libcutils LOCAL_MODULE:= uevents -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter include $(BUILD_EXECUTABLE) diff --git a/verity/Android.mk b/verity/Android.mk index e379a475..7ddf75f6 100644 --- a/verity/Android.mk +++ b/verity/Android.mk @@ -5,6 +5,7 @@ ifeq ($(HOST_OS),linux) include $(CLEAR_VARS) LOCAL_MODULE := verify_boot_signature LOCAL_SRC_FILES := verify_boot_signature.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := libcrypto @@ -16,6 +17,7 @@ endif # HOST_OS == linux include $(CLEAR_VARS) LOCAL_MODULE := generate_verity_key LOCAL_SRC_FILES := generate_verity_key.c +LOCAL_CFLAGS := -Wall -Werror LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := libcrypto_utils libcrypto diff --git a/verity/verify_boot_signature.c b/verity/verify_boot_signature.c index 36760ad7..e1c53d81 100644 --- a/verity/verify_boot_signature.c +++ b/verity/verify_boot_signature.c @@ -92,7 +92,6 @@ static uint64_t page_align(uint64_t n, uint64_t page_size) */ static int get_signature_offset(int fd, off64_t *offset) { - int i; struct boot_img_hdr hdr; if (!offset) { -- cgit v1.2.3