Use -Werror in frameworks/native/libs/vr
* Suppress/fix warnings of unused variable, parameter,
private-field, and function.
* Fix warnings about typedef missing declarator.
* Use -Wno-error to keep existing warnings, to fix later.
Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: Ifb82fcd76fcb5d9c9d9f017f2541581661493bd5
diff --git a/libs/vr/libbufferhub/Android.bp b/libs/vr/libbufferhub/Android.bp
index 17725f8..2819fe9 100644
--- a/libs/vr/libbufferhub/Android.bp
+++ b/libs/vr/libbufferhub/Android.bp
@@ -42,6 +42,9 @@
"-DLOG_TAG=\"libbufferhub\"",
"-DTRACE=0",
"-DATRACE_TAG=ATRACE_TAG_GRAPHICS",
+ "-Wall",
+ "-Werror",
+ "-Wno-error=sign-compare", // to fix later
],
export_include_dirs: localIncludeFiles,
static_libs: staticLibraries,
@@ -55,5 +58,10 @@
static_libs: ["libbufferhub"] + staticLibraries,
shared_libs: sharedLibraries,
name: "bufferhub_tests",
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-error=sign-compare", // to fix later
+ ],
}
diff --git a/libs/vr/libbufferhubqueue/Android.bp b/libs/vr/libbufferhubqueue/Android.bp
index a7c33ee..efd5cc7 100644
--- a/libs/vr/libbufferhubqueue/Android.bp
+++ b/libs/vr/libbufferhubqueue/Android.bp
@@ -48,6 +48,11 @@
"-DLOG_TAG=\"libbufferhubqueue\"",
"-DTRACE=0",
"-DATRACE_TAG=ATRACE_TAG_GRAPHICS",
+ "-Wall",
+ "-Werror",
+ "-Wno-error=sign-compare", // to fix later
+ "-Wno-unused-parameter",
+ "-Wno-unused-variable",
],
srcs: sourceFiles,
export_include_dirs: includeFiles,
diff --git a/libs/vr/libbufferhubqueue/tests/Android.bp b/libs/vr/libbufferhubqueue/tests/Android.bp
index 865573c..21a675f 100644
--- a/libs/vr/libbufferhubqueue/tests/Android.bp
+++ b/libs/vr/libbufferhubqueue/tests/Android.bp
@@ -28,6 +28,9 @@
"-DTRACE=0",
"-O0",
"-g",
+ "-Wall",
+ "-Werror",
+ "-Wno-error=sign-compare", // to fix later
],
name: "buffer_hub_queue-test",
tags: ["optional"],
@@ -42,6 +45,9 @@
"-DTRACE=0",
"-O0",
"-g",
+ "-Wall",
+ "-Werror",
+ "-Wno-error=sign-compare", // to fix later
],
name: "buffer_hub_queue_producer-test",
tags: ["optional"],
diff --git a/libs/vr/libdisplay/Android.bp b/libs/vr/libdisplay/Android.bp
index d90521a..abc8159 100644
--- a/libs/vr/libdisplay/Android.bp
+++ b/libs/vr/libdisplay/Android.bp
@@ -55,6 +55,8 @@
"-DATRACE_TAG=ATRACE_TAG_GRAPHICS",
"-DGL_GLEXT_PROTOTYPES",
"-DEGL_EGLEXT_PROTOTYPES",
+ "-Wall",
+ "-Werror",
], // + [ "-UNDEBUG", "-DDEBUG", "-O0", "-g" ],
export_include_dirs: localIncludeFiles,
shared_libs: sharedLibraries,
diff --git a/libs/vr/libdisplay/include/dvr/dvr_display_types.h b/libs/vr/libdisplay/include/dvr/dvr_display_types.h
index 25364d8..fd69843 100644
--- a/libs/vr/libdisplay/include/dvr/dvr_display_types.h
+++ b/libs/vr/libdisplay/include/dvr/dvr_display_types.h
@@ -13,7 +13,7 @@
#ifndef __FLOAT32X4T_86
#define __FLOAT32X4T_86
typedef float float32x4_t __attribute__((__vector_size__(16)));
-typedef struct float32x4x4_t { float32x4_t val[4]; };
+typedef struct float32x4x4_t { float32x4_t val[4]; } float32x4x4_t;
#endif
#endif
diff --git a/libs/vr/libdvr/Android.bp b/libs/vr/libdvr/Android.bp
index 7a7c8aa..65123d6 100644
--- a/libs/vr/libdvr/Android.bp
+++ b/libs/vr/libdvr/Android.bp
@@ -22,6 +22,8 @@
cflags = [
"-DLOG_TAG=\"libdvr\"",
"-DTRACE=0",
+ "-Wall",
+ "-Werror",
]
srcs = [
diff --git a/libs/vr/libdvr/tests/Android.bp b/libs/vr/libdvr/tests/Android.bp
index ef746e2..21e9643 100644
--- a/libs/vr/libdvr/tests/Android.bp
+++ b/libs/vr/libdvr/tests/Android.bp
@@ -48,6 +48,11 @@
"-DTRACE=0",
"-O0",
"-g",
+ "-Wall",
+ "-Werror",
+ "-Wno-error=macro-redefined", // to fix later
+ "-Wno-error=sign-compare", // to fix later
+ "-Wno-unused-variable",
],
name: "dvr_api-test",
}
diff --git a/libs/vr/libdvrcommon/Android.bp b/libs/vr/libdvrcommon/Android.bp
index 527cdbd..8d2beca 100644
--- a/libs/vr/libdvrcommon/Android.bp
+++ b/libs/vr/libdvrcommon/Android.bp
@@ -40,6 +40,8 @@
cflags: [
"-DLOG_TAG=\"libdvrcommon\"",
"-DTRACE=0",
+ "-Wall",
+ "-Werror",
],
export_include_dirs: localIncludeFiles,
@@ -59,6 +61,11 @@
tags: ["optional"],
srcs: testFiles,
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-parameter",
+ ],
shared_libs: sharedLibraries,
diff --git a/libs/vr/libperformance/Android.bp b/libs/vr/libperformance/Android.bp
index 364873d..6a46876 100644
--- a/libs/vr/libperformance/Android.bp
+++ b/libs/vr/libperformance/Android.bp
@@ -32,7 +32,9 @@
srcs: sourceFiles,
cflags: [
"-DLOG_TAG=\"libperformance\"",
- "-DTRACE=0"
+ "-DTRACE=0",
+ "-Wall",
+ "-Werror",
],
export_include_dirs: includeFiles,
static_libs: staticLibraries,
diff --git a/libs/vr/libvrflinger/Android.bp b/libs/vr/libvrflinger/Android.bp
index de26a74..f2c88ad 100644
--- a/libs/vr/libvrflinger/Android.bp
+++ b/libs/vr/libvrflinger/Android.bp
@@ -71,6 +71,10 @@
"-DATRACE_TAG=ATRACE_TAG_GRAPHICS",
"-DGL_GLEXT_PROTOTYPES",
"-DEGL_EGLEXT_PROTOTYPES",
+ "-Wall",
+ "-Werror",
+ "-Wno-error=sign-compare", // to fix later
+ "-Wno-unused-variable",
],
shared_libs: sharedLibraries,
whole_static_libs: staticLibraries,
diff --git a/libs/vr/libvrsensor/Android.bp b/libs/vr/libvrsensor/Android.bp
index abad78b..1a15b6a 100644
--- a/libs/vr/libvrsensor/Android.bp
+++ b/libs/vr/libvrsensor/Android.bp
@@ -40,6 +40,10 @@
cc_library {
srcs: sourceFiles,
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
export_include_dirs: includeFiles,
static_libs: staticLibraries,
shared_libs: sharedLibraries,
diff --git a/libs/vr/libvrsensor/include/dvr/pose_client.h b/libs/vr/libvrsensor/include/dvr/pose_client.h
index ed75f84..d32df64 100644
--- a/libs/vr/libvrsensor/include/dvr/pose_client.h
+++ b/libs/vr/libvrsensor/include/dvr/pose_client.h
@@ -7,7 +7,7 @@
#ifndef __FLOAT32X4T_86
#define __FLOAT32X4T_86
typedef float float32x4_t __attribute__ ((__vector_size__ (16)));
-typedef struct float32x4x4_t { float32x4_t val[4]; };
+typedef struct float32x4x4_t { float32x4_t val[4]; } float32x4x4_t;
#endif
#endif
diff --git a/services/vr/hardware_composer/Android.bp b/services/vr/hardware_composer/Android.bp
index 5cb201d..88a5a611 100644
--- a/services/vr/hardware_composer/Android.bp
+++ b/services/vr/hardware_composer/Android.bp
@@ -43,6 +43,11 @@
cflags: [
"-DLOG_TAG=\"vr_hwc\"",
+ "-Wall",
+ "-Werror",
+ "-Wno-error=sign-compare", // fix later
+ "-Wno-unused-private-field",
+ "-Wno-unused-parameter",
],
}
@@ -56,6 +61,7 @@
"aidl/android/dvr/parcelable_composer_layer.cpp",
"aidl/android/dvr/parcelable_unique_fd.cpp",
],
+ cflags: ["-Wall", "-Werror"],
aidl: {
include_dirs: ["frameworks/native/services/vr/hardware_composer/aidl"],
export_aidl_headers: true,
@@ -91,6 +97,8 @@
],
cflags: [
"-DLOG_TAG=\"vr_hwc\"",
+ "-Wall",
+ "-Werror",
],
}
@@ -119,6 +127,8 @@
],
cflags: [
"-DLOG_TAG=\"vr_hwc\"",
+ "-Wall",
+ "-Werror",
],
init_rc: [
"vr_hwc.rc",
@@ -129,6 +139,12 @@
name: "vr_hwc_test",
gtest: true,
srcs: ["tests/vr_composer_test.cpp"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-error=sign-compare", // fix later
+ "-Wno-unused-parameter",
+ ],
static_libs: [
"libgtest",
"libvr_hwc-impl",
diff --git a/services/vr/virtual_touchpad/Android.bp b/services/vr/virtual_touchpad/Android.bp
index 3d5dfb2..919d124 100644
--- a/services/vr/virtual_touchpad/Android.bp
+++ b/services/vr/virtual_touchpad/Android.bp
@@ -18,7 +18,11 @@
export_include_dirs: ["include"],
shared_libs: shared_libs,
cppflags: ["-std=c++11"],
- cflags: ["-DLOG_TAG=\"VrVirtualTouchpad\""],
+ cflags: [
+ "-DLOG_TAG=\"VrVirtualTouchpad\"",
+ "-Wall",
+ "-Werror",
+ ],
name: "libvirtualtouchpad",
tags: ["optional"],
}
@@ -51,6 +55,12 @@
name: "VirtualTouchpad_test",
stl: "libc++_static",
tags: [ "optional" ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-function",
+ "-Wno-unused-variable",
+ ],
}
// Service.
@@ -80,6 +90,8 @@
cppflags: ["-std=c++11"],
cflags: [
"-DLOG_TAG=\"VrVirtualTouchpad\"",
+ "-Wall",
+ "-Werror",
],
host_ldlibs: ["-llog"],
name: "virtual_touchpad",
@@ -108,7 +120,11 @@
srcs: client_src,
shared_libs: client_shared_libs,
cppflags: ["-std=c++11"],
- cflags: ["-DLOG_TAG=\"VirtualTouchpadClient\""],
+ cflags: [
+ "-DLOG_TAG=\"VirtualTouchpadClient\"",
+ "-Wall",
+ "-Werror",
+ ],
host_ldlibs: ["-llog"],
name: "libvirtualtouchpadclient",
tags: ["optional"],