Fix enum switch warnings
hardware/libhardware/include was being included with -isystem, which
hides warnings. -Wswitch requires that all cases in a switch statement
on an enum be enum values. For enums being used as bit flags, cast the
enum to an int.
Bug: 32018017
Test: m -j
Change-Id: Idb430c451d017bb7ec61a7119d6abd87b6dcdc87
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index 6973603..f4f6093 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_HARDWARE_HWCOMPOSER2_H
#define ANDROID_HARDWARE_HWCOMPOSER2_H
+#include <sys/cdefs.h>
+
#include <hardware/hardware.h>
#include "hwcomposer_defs.h"
@@ -360,7 +362,7 @@
static inline const char* getDisplayRequestName(
hwc2_display_request_t request) {
- switch (request) {
+ switch (__BIONIC_CAST(static_cast, int, request)) {
case 0: return "None";
case HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET: return "FlipClientTarget";
case HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT:
@@ -459,7 +461,7 @@
}
static inline const char* getLayerRequestName(hwc2_layer_request_t request) {
- switch (request) {
+ switch (__BIONIC_CAST(static_cast, int, request)) {
case 0: return "None";
case HWC2_LAYER_REQUEST_CLEAR_CLIENT_TARGET: return "ClearClientTarget";
default: return "Unknown";
@@ -477,7 +479,7 @@
}
static inline const char* getTransformName(hwc_transform_t transform) {
- switch (transform) {
+ switch (__BIONIC_CAST(static_cast, int, transform)) {
case 0: return "None";
case HWC_TRANSFORM_FLIP_H: return "FlipH";
case HWC_TRANSFORM_FLIP_V: return "FlipV";