egl: split enums to make use of -Wswitch
authorEric Engestrom <eric@engestrom.ch>
Sun, 30 Jul 2017 01:11:58 +0000 (02:11 +0100)
committerEric Engestrom <eric.engestrom@imgtec.com>
Tue, 1 Aug 2017 16:43:11 +0000 (17:43 +0100)
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/main/eglconfig.c

index f747c33184314f0e878940b1e054f9beaef7b57d..f057b0bfe8c8dc63e327ea861fdb149d97bcac64 100644 (file)
@@ -118,15 +118,16 @@ _eglLookupConfig(EGLConfig config, _EGLDisplay *dpy)
 }
 
 
-enum {
-   /* types */
+enum type {
    ATTRIB_TYPE_INTEGER,
    ATTRIB_TYPE_BOOLEAN,
    ATTRIB_TYPE_BITMASK,
    ATTRIB_TYPE_ENUM,
    ATTRIB_TYPE_PSEUDO, /* non-queryable */
    ATTRIB_TYPE_PLATFORM, /* platform-dependent */
-   /* criteria */
+};
+
+enum criterion {
    ATTRIB_CRITERION_EXACT,
    ATTRIB_CRITERION_ATLEAST,
    ATTRIB_CRITERION_MASK,
@@ -138,8 +139,8 @@ enum {
 /* EGL spec Table 3.1 and 3.4 */
 static const struct {
    EGLint attr;
-   EGLint type;
-   EGLint criterion;
+   enum type type;
+   enum criterion criterion;
    EGLint default_value;
 } _eglValidationTable[] =
 {
@@ -355,9 +356,6 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
          if (val != 0)
             valid = EGL_FALSE;
          break;
-      default:
-         assert(0);
-         break;
       }
 
       if (!valid && for_matching) {
@@ -465,8 +463,8 @@ _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria)
       case ATTRIB_CRITERION_SPECIAL:
          /* ignored here */
          break;
-      default:
-         assert(0);
+      case ATTRIB_CRITERION_IGNORE:
+         unreachable("already handled above");
          break;
       }