summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2017-09-29 15:41:15 -0700
committerChih-Hung Hsieh <chh@google.com>2017-10-04 11:09:30 -0700
commit235942389f797228865c761589732e4b10f42692 (patch)
tree0ba8bc4c9eaf41bc43f9d102ec487f53a35a4599
parentce1ed062440baa9037775c63f333c319fd7d67f4 (diff)
downloadlibhardware-235942389f797228865c761589732e4b10f42692.tar.gz
Use -Werror in hardware/libhardware
* Remove unused local variables and function. * Fix unused return value warning. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: I269eca76cda2222c7a0176e85e92df0bb0924a0e
-rw-r--r--Android.bp6
-rw-r--r--modules/consumerir/Android.bp1
-rw-r--r--modules/fingerprint/Android.bp1
-rw-r--r--modules/local_time/Android.bp1
-rw-r--r--modules/local_time/local_time_hw.c2
-rw-r--r--modules/nfc-nci/Android.bp1
-rw-r--r--modules/nfc/Android.bp1
-rw-r--r--modules/power/Android.bp1
-rw-r--r--modules/sensors/Android.bp1
-rw-r--r--modules/sensors/multihal.cpp10
-rw-r--r--modules/tv_input/Android.bp1
-rw-r--r--modules/vibrator/Android.bp1
-rw-r--r--modules/vibrator/vibrator.c1
-rw-r--r--tests/fingerprint/Android.bp1
-rw-r--r--tests/nusensors/Android.bp2
15 files changed, 18 insertions, 13 deletions
diff --git a/Android.bp b/Android.bp
index 7ae27e86..d8a4f6af 100644
--- a/Android.bp
+++ b/Android.bp
@@ -29,7 +29,11 @@ cc_library_shared {
"libdl",
"libvndksupport",
],
- cflags: ["-DQEMU_HARDWARE"],
+ cflags: [
+ "-DQEMU_HARDWARE",
+ "-Wall",
+ "-Werror",
+ ],
header_libs: ["libhardware_headers"],
export_header_lib_headers: ["libhardware_headers"],
diff --git a/modules/consumerir/Android.bp b/modules/consumerir/Android.bp
index 6ba37b62..4f700c2a 100644
--- a/modules/consumerir/Android.bp
+++ b/modules/consumerir/Android.bp
@@ -17,6 +17,7 @@ cc_library_shared {
relative_install_path: "hw",
proprietary: true,
srcs: ["consumerir.c"],
+ cflags: ["-Wall", "-Werror"],
header_libs: ["libhardware_headers"],
shared_libs: [
"liblog",
diff --git a/modules/fingerprint/Android.bp b/modules/fingerprint/Android.bp
index a8246082..22648b1b 100644
--- a/modules/fingerprint/Android.bp
+++ b/modules/fingerprint/Android.bp
@@ -17,6 +17,7 @@ cc_library_shared {
relative_install_path: "hw",
proprietary: true,
srcs: ["fingerprint.c"],
+ cflags: ["-Wall", "-Werror"],
header_libs: ["libhardware_headers"],
shared_libs: ["liblog"],
}
diff --git a/modules/local_time/Android.bp b/modules/local_time/Android.bp
index 153b7e4a..9f140b34 100644
--- a/modules/local_time/Android.bp
+++ b/modules/local_time/Android.bp
@@ -26,6 +26,7 @@ cc_library_shared {
relative_install_path: "hw",
proprietary: true,
srcs: ["local_time_hw.c"],
+ cflags: ["-Wall", "-Werror"],
header_libs: ["libhardware_headers"],
shared_libs: [
"liblog",
diff --git a/modules/local_time/local_time_hw.c b/modules/local_time/local_time_hw.c
index a2d1a9e5..0350e242 100644
--- a/modules/local_time/local_time_hw.c
+++ b/modules/local_time/local_time_hw.c
@@ -72,8 +72,6 @@ static int ltdev_open(const hw_module_t* module, const char* name,
hw_device_t** device)
{
struct stub_local_time_device *ltdev;
- struct timespec ts;
- int ret;
if (strcmp(name, LOCAL_TIME_HARDWARE_INTERFACE) != 0)
return -EINVAL;
diff --git a/modules/nfc-nci/Android.bp b/modules/nfc-nci/Android.bp
index 90d2a28b..4688a814 100644
--- a/modules/nfc-nci/Android.bp
+++ b/modules/nfc-nci/Android.bp
@@ -21,4 +21,5 @@ cc_library_shared {
"liblog",
"libcutils",
],
+ cflags: ["-Wall", "-Werror"],
}
diff --git a/modules/nfc/Android.bp b/modules/nfc/Android.bp
index b4bc9b1f..7c69f114 100644
--- a/modules/nfc/Android.bp
+++ b/modules/nfc/Android.bp
@@ -17,6 +17,7 @@ cc_library_shared {
relative_install_path: "hw",
proprietary: true,
srcs: ["nfc_pn544_example.c"],
+ cflags: ["-Wall", "-Werror"],
header_libs: ["libhardware_headers"],
shared_libs: [
"liblog",
diff --git a/modules/power/Android.bp b/modules/power/Android.bp
index 41ac45c6..6b0b31fb 100644
--- a/modules/power/Android.bp
+++ b/modules/power/Android.bp
@@ -17,6 +17,7 @@ cc_library_shared {
relative_install_path: "hw",
proprietary: true,
srcs: ["power.c"],
+ cflags: ["-Wall", "-Werror"],
header_libs: [
"libhardware_headers",
"libutils_headers",
diff --git a/modules/sensors/Android.bp b/modules/sensors/Android.bp
index 1d150655..64cf2a9e 100644
--- a/modules/sensors/Android.bp
+++ b/modules/sensors/Android.bp
@@ -12,4 +12,5 @@ cc_library_static {
"libdl"
],
export_include_dirs: ["."],
+ cflags: ["-Wall", "-Werror"],
}
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp
index b5360cc8..a1f01046 100644
--- a/modules/sensors/multihal.cpp
+++ b/modules/sensors/multihal.cpp
@@ -515,6 +515,7 @@ static int device__close(struct hw_device_t *dev) {
if (ctx != NULL) {
int retval = ctx->close();
delete ctx;
+ return retval;
}
if (sub_hw_modules != nullptr) {
@@ -586,15 +587,6 @@ static int device__config_direct_report(struct sensors_poll_device_1 *dev,
static int open_sensors(const struct hw_module_t* module, const char* name,
struct hw_device_t** device);
-static bool starts_with(const char* s, const char* prefix) {
- if (s == NULL || prefix == NULL) {
- return false;
- }
- size_t s_size = strlen(s);
- size_t prefix_size = strlen(prefix);
- return s_size >= prefix_size && strncmp(s, prefix, prefix_size) == 0;
-}
-
/*
* Adds valid paths from the config file to the vector passed in.
* The vector must not be null.
diff --git a/modules/tv_input/Android.bp b/modules/tv_input/Android.bp
index 4d2369eb..b9d8afa0 100644
--- a/modules/tv_input/Android.bp
+++ b/modules/tv_input/Android.bp
@@ -22,4 +22,5 @@ cc_library_shared {
"liblog",
],
srcs: ["tv_input.cpp"],
+ cflags: ["-Wall", "-Werror"],
}
diff --git a/modules/vibrator/Android.bp b/modules/vibrator/Android.bp
index fdbfd611..13ffc835 100644
--- a/modules/vibrator/Android.bp
+++ b/modules/vibrator/Android.bp
@@ -21,5 +21,6 @@ cc_library_shared {
proprietary: true,
header_libs: ["libhardware_headers"],
srcs: ["vibrator.c"],
+ cflags: ["-Wall", "-Werror"],
shared_libs: ["liblog"],
}
diff --git a/modules/vibrator/vibrator.c b/modules/vibrator/vibrator.c
index 950bc599..8042b570 100644
--- a/modules/vibrator/vibrator.c
+++ b/modules/vibrator/vibrator.c
@@ -108,7 +108,6 @@ static int write_led_file(const char *file, const char *value)
static bool vibra_led_exists()
{
- int fd;
char file_str[50];
snprintf(file_str, sizeof(file_str), "%s/%s", LED_DEVICE, "activate");
diff --git a/tests/fingerprint/Android.bp b/tests/fingerprint/Android.bp
index 7de3dee2..9524b7ba 100644
--- a/tests/fingerprint/Android.bp
+++ b/tests/fingerprint/Android.bp
@@ -9,6 +9,7 @@ cc_test {
cflags: [
"-Wall",
+ "-Werror",
"-Wextra",
],
}
diff --git a/tests/nusensors/Android.bp b/tests/nusensors/Android.bp
index e9234684..8b267dba 100644
--- a/tests/nusensors/Android.bp
+++ b/tests/nusensors/Android.bp
@@ -3,6 +3,8 @@ cc_binary {
srcs: ["nusensors.cpp"],
+ cflags: ["-Wall", "-Werror"],
+
shared_libs: [
"libcutils",
"libhardware",