summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-06-03 23:14:20 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-06-03 23:14:21 +0000
commitbe15d16b7246e32a1e622d4442cf919646bc71a9 (patch)
treec1edc80194a19b7b443611acd0ffdea2ddfe130a
parent2f9400b679ffe08f7190781e64edda5edf0f7297 (diff)
parentd286796fce1e6fff407b719a53eb2afbeb96c327 (diff)
downloadbionic-be15d16b7246e32a1e622d4442cf919646bc71a9.zip
bionic-be15d16b7246e32a1e622d4442cf919646bc71a9.tar.gz
bionic-be15d16b7246e32a1e622d4442cf919646bc71a9.tar.bz2
Merge "Turn on -Wunused and fix the mistakes it uncovers."
-rw-r--r--benchmarks/Android.mk2
-rw-r--r--libc/Android.mk4
-rw-r--r--libc/bionic/libc_init_dynamic.cpp2
-rw-r--r--libc/bionic/libc_init_static.cpp2
-rw-r--r--libdl/Android.mk2
-rw-r--r--linker/Android.mk2
-rw-r--r--linker/linked_list.h1
-rw-r--r--linker/linker.cpp2
-rw-r--r--linker/tests/Android.mk2
-rw-r--r--tests/Android.mk2
10 files changed, 10 insertions, 11 deletions
diff --git a/benchmarks/Android.mk b/benchmarks/Android.mk
index cf3d692..f9722ae 100644
--- a/benchmarks/Android.mk
+++ b/benchmarks/Android.mk
@@ -24,7 +24,7 @@ LOCAL_PATH := $(call my-dir)
benchmark_c_flags = \
-O2 \
- -Wall -Wextra \
+ -Wall -Wextra -Wunused \
-Werror \
-fno-builtin \
-std=gnu++11 \
diff --git a/libc/Android.mk b/libc/Android.mk
index 4783bd3..02fad3b 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -486,7 +486,7 @@ libc_arch_static_src_files := \
# ========================================================
libc_common_cflags := \
-D_LIBC=1 \
- -Wall -Wextra \
+ -Wall -Wextra -Wunused \
# Try to catch typical 32-bit assumptions that break with 64-bit pointers.
libc_common_cflags += \
@@ -709,7 +709,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
LOCAL_CFLAGS := \
$(libc_common_cflags) \
- -Wno-sign-compare -Wno-uninitialized \
+ -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \
-Werror \
-I$(LOCAL_PATH)/upstream-openbsd/android/include \
-I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
index 659cf39..7c46364 100644
--- a/libc/bionic/libc_init_dynamic.cpp
+++ b/libc/bionic/libc_init_dynamic.cpp
@@ -94,7 +94,7 @@ __LIBC_HIDDEN__ void __libc_postfini() {
// Note that the dynamic linker has also run all constructors in the
// executable at this point.
__noreturn void __libc_init(void* raw_args,
- void (*onexit)(void),
+ void (*onexit)(void) __unused,
int (*slingshot)(int, char**, char**),
structors_array_t const * const structors) {
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index e45422e..ab0b3a6 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -85,7 +85,7 @@ static void apply_gnu_relro() {
}
__noreturn void __libc_init(void* raw_args,
- void (*onexit)(void),
+ void (*onexit)(void) __unused,
int (*slingshot)(int, char**, char**),
structors_array_t const * const structors) {
KernelArgumentBlock args(raw_args);
diff --git a/libdl/Android.mk b/libdl/Android.mk
index 3d60474..cb1cb7d 100644
--- a/libdl/Android.mk
+++ b/libdl/Android.mk
@@ -22,7 +22,7 @@ LOCAL_LDFLAGS_x86 := -Wl,--exclude-libs=libgcc_eh.a
LOCAL_LDFLAGS_x86_64 := $(LOCAL_LDFLAGS_x86)
LOCAL_SRC_FILES:= libdl.c
-LOCAL_CFLAGS := -Wall -Wextra -Werror
+LOCAL_CFLAGS := -Wall -Wextra -Wunused -Werror
LOCAL_MODULE := libdl
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
diff --git a/linker/Android.mk b/linker/Android.mk
index d2bcfaf..811cf6e 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -26,7 +26,7 @@ LOCAL_CFLAGS += \
-fno-stack-protector \
-Wstrict-overflow=5 \
-fvisibility=hidden \
- -Wall -Wextra -Werror \
+ -Wall -Wextra -Wunused -Werror \
LOCAL_CONLYFLAGS += \
-std=gnu99 \
diff --git a/linker/linked_list.h b/linker/linked_list.h
index a6bea6c..52af0f1 100644
--- a/linker/linked_list.h
+++ b/linker/linked_list.h
@@ -59,7 +59,6 @@ class LinkedList {
template<typename F>
void remove_if(F&& predicate) {
- LinkedListEntry<T>* e = head_;
for (LinkedListEntry<T>* e = head_; e != nullptr; e = e->next) {
if (e->element != nullptr && predicate(e->element)) {
e->element = nullptr;
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 98cb178..5452f30 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -827,7 +827,7 @@ void do_android_update_LD_LIBRARY_PATH(const char* ld_library_path) {
}
}
-soinfo* do_dlopen(const char* name, int flags, soinfo* caller, const android_dlextinfo* extinfo) {
+soinfo* do_dlopen(const char* name, int flags, soinfo* /*caller*/, const android_dlextinfo* extinfo) {
if ((flags & ~(RTLD_NOW|RTLD_LAZY|RTLD_LOCAL|RTLD_GLOBAL|RTLD_NOLOAD)) != 0) {
DL_ERR("invalid flags to dlopen: %x", flags);
return NULL;
diff --git a/linker/tests/Android.mk b/linker/tests/Android.mk
index 831cfcb..683f9ee 100644
--- a/linker/tests/Android.mk
+++ b/linker/tests/Android.mk
@@ -26,7 +26,7 @@ LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_CFLAGS += -g -Wall -Wextra -Werror -std=gnu++11
+LOCAL_CFLAGS += -g -Wall -Wextra -Wunused -Werror -std=gnu++11
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../libc/
LOCAL_SRC_FILES := \
diff --git a/tests/Android.mk b/tests/Android.mk
index db8dd8c..811c12a 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -34,7 +34,7 @@ endif
test_cflags = \
-fstack-protector-all \
-g \
- -Wall -Wextra \
+ -Wall -Wextra -Wunused \
-Werror \
-fno-builtin \