libbinder: Tighten compiler warnings/errors
Use all of -Wall -Wextra -Werror and fix the minor errors that result.
Change-Id: Id56e9c454dd3570f713d161577eed6aa8e8074aa
diff --git a/libs/binder/Android.mk b/libs/binder/Android.mk
index 2483659..f0368a0 100644
--- a/libs/binder/Android.mk
+++ b/libs/binder/Android.mk
@@ -42,20 +42,21 @@
LOCAL_PATH:= $(call my-dir)
+binder_cflags := -Wall -Wextra -Werror
+ifneq ($(TARGET_USES_64_BIT_BINDER),true)
+ifneq ($(TARGET_IS_64_BIT),true)
+binder_cflags += -DBINDER_IPC_32BIT=1
+endif
+endif
+
include $(CLEAR_VARS)
LOCAL_MODULE := libbinder
LOCAL_SHARED_LIBRARIES := libbase liblog libcutils libutils
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbase libutils
-LOCAL_CLANG := true
LOCAL_SANITIZE := integer
LOCAL_SRC_FILES := $(sources)
-ifneq ($(TARGET_USES_64_BIT_BINDER),true)
-ifneq ($(TARGET_IS_64_BIT),true)
-LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1
-endif
-endif
-LOCAL_CFLAGS += -Werror
+LOCAL_CFLAGS := $(binder_cflags)
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
@@ -63,10 +64,5 @@
LOCAL_STATIC_LIBRARIES := libbase libutils
LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := libbase libutils
LOCAL_SRC_FILES := $(sources)
-ifneq ($(TARGET_USES_64_BIT_BINDER),true)
-ifneq ($(TARGET_IS_64_BIT),true)
-LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1
-endif
-endif
-LOCAL_CFLAGS += -Werror
+LOCAL_CFLAGS := $(binder_cflags)
include $(BUILD_STATIC_LIBRARY)
diff --git a/libs/binder/PersistableBundle.cpp b/libs/binder/PersistableBundle.cpp
index 5c5651c..e7078ba 100644
--- a/libs/binder/PersistableBundle.cpp
+++ b/libs/binder/PersistableBundle.cpp
@@ -420,7 +420,6 @@
RETURN_IF_FAILED(parcel->readInt32(&num_entries));
for (; num_entries > 0; --num_entries) {
- size_t start_pos = parcel->dataPosition();
String16 key;
int32_t value_type;
RETURN_IF_FAILED(parcel->readString16(&key));