Use -Werror in hardware/libhardware/tests
* Remove unused local variables.
* Suppress warning of unused template functions.
* Fix error of unused expression value.
Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I5a37c24f3be0f61b0ae4552e34b7311f561d499e
diff --git a/tests/hardware/Android.mk b/tests/hardware/Android.mk
index 9927343..02a3596 100644
--- a/tests/hardware/Android.mk
+++ b/tests/hardware/Android.mk
@@ -4,7 +4,7 @@
LOCAL_MODULE := static-hal-check
LOCAL_SRC_FILES := struct-size.cpp struct-offset.cpp struct-last.cpp
LOCAL_SHARED_LIBRARIES := libhardware
-LOCAL_CFLAGS := -O0
+LOCAL_CFLAGS := -O0 -Wall -Werror
LOCAL_C_INCLUDES += \
system/media/camera/include
diff --git a/tests/hardware/struct-size.cpp b/tests/hardware/struct-size.cpp
index 232b55d..14a26ef 100644
--- a/tests/hardware/struct-size.cpp
+++ b/tests/hardware/struct-size.cpp
@@ -24,7 +24,7 @@
#include <hardware/camera_common.h>
#include <hardware/camera3.h>
-template<size_t> static constexpr size_t CheckSizeHelper(size_t, size_t);
+template<size_t> static constexpr size_t CheckSizeHelper(size_t, size_t) __attribute((unused));
template<> constexpr size_t CheckSizeHelper<4>(size_t size32, size_t /* size64 */) {
return size32;