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
This commit is contained in:
Chih-Hung Hsieh 2017-09-29 15:41:15 -07:00
parent ce1ed06244
commit 235942389f
15 changed files with 18 additions and 13 deletions

View file

@ -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"],

View file

@ -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",

View file

@ -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"],
}

View file

@ -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",

View file

@ -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;

View file

@ -21,4 +21,5 @@ cc_library_shared {
"liblog",
"libcutils",
],
cflags: ["-Wall", "-Werror"],
}

View file

@ -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",

View file

@ -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",

View file

@ -12,4 +12,5 @@ cc_library_static {
"libdl"
],
export_include_dirs: ["."],
cflags: ["-Wall", "-Werror"],
}

View file

@ -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.

View file

@ -22,4 +22,5 @@ cc_library_shared {
"liblog",
],
srcs: ["tv_input.cpp"],
cflags: ["-Wall", "-Werror"],
}

View file

@ -21,5 +21,6 @@ cc_library_shared {
proprietary: true,
header_libs: ["libhardware_headers"],
srcs: ["vibrator.c"],
cflags: ["-Wall", "-Werror"],
shared_libs: ["liblog"],
}

View file

@ -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");

View file

@ -9,6 +9,7 @@ cc_test {
cflags: [
"-Wall",
"-Werror",
"-Wextra",
],
}

View file

@ -3,6 +3,8 @@ cc_binary {
srcs: ["nusensors.cpp"],
cflags: ["-Wall", "-Werror"],
shared_libs: [
"libcutils",
"libhardware",