summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-07-29 17:13:16 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-07-29 18:57:03 +0200
commit9535fc481f28fa661fa9d48b932e089aa3504bc3 (patch)
tree1fe0475b815e59ac637d284ffdb70d34c38550b9
parente552057558ac4c02b9bba922ee2f06d2f9b0d57d (diff)
downloadgobject-introspection-9535fc481f28fa661fa9d48b932e089aa3504bc3.tar.gz
build: enable -Wswitch-default
In case the surrounding code handles missing cases break, otherwise add a g_assert_not_reached(). The generated parser code triggers this as well, so disable it there only.
-rw-r--r--configure.ac4
-rw-r--r--girepository/gicallableinfo.c2
-rw-r--r--girepository/giconstantinfo.c2
-rw-r--r--girepository/gifieldinfo.c8
-rw-r--r--girepository/girffi.c2
-rw-r--r--girepository/girnode.c4
-rw-r--r--girepository/girparser.c2
-rw-r--r--girepository/girwriter.c4
8 files changed, 26 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index bfe7c5d8..af2a27d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,14 +65,14 @@ AX_COMPILER_FLAGS(,, [yes])
# These get triggered a lot, not worth it imo, but feel free to fix them
AX_APPEND_COMPILE_FLAGS([-Wno-duplicated-branches -Wno-switch-enum])
# FIXME: Fix the warnings and remove the flags
-AX_APPEND_COMPILE_FLAGS([-Wno-redundant-decls -Wno-switch-default -Wno-deprecated-declarations])
+AX_APPEND_COMPILE_FLAGS([-Wno-redundant-decls -Wno-deprecated-declarations])
WARN_CFLAGS_PYTHON="$WARN_CFLAGS"
AX_APPEND_COMPILE_FLAGS([-Wno-discarded-qualifiers], [WARN_CFLAGS_PYTHON])
AC_SUBST(WARN_CFLAGS_PYTHON)
WARN_CFLAGS_FLEX="$WARN_CFLAGS"
-AX_APPEND_COMPILE_FLAGS([-Wno-sign-compare], [WARN_CFLAGS_FLEX])
+AX_APPEND_COMPILE_FLAGS([-Wno-sign-compare -Wno-switch-default], [WARN_CFLAGS_FLEX])
AC_SUBST(WARN_CFLAGS_FLEX)
# Checks for libraries.
diff --git a/girepository/gicallableinfo.c b/girepository/gicallableinfo.c
index 5f923d1a..e9a426e1 100644
--- a/girepository/gicallableinfo.c
+++ b/girepository/gicallableinfo.c
@@ -77,6 +77,8 @@ signature_offset (GICallableInfo *info)
case GI_INFO_TYPE_SIGNAL:
sigoff = G_STRUCT_OFFSET (SignalBlob, signature);
break;
+ default:
+ g_assert_not_reached ();
}
if (sigoff >= 0)
return *(guint32 *)&rinfo->typelib->data[rinfo->offset + sigoff];
diff --git a/girepository/giconstantinfo.c b/girepository/giconstantinfo.c
index 60715a4b..d44646ee 100644
--- a/girepository/giconstantinfo.c
+++ b/girepository/giconstantinfo.c
@@ -166,6 +166,8 @@ g_constant_info_get_value (GIConstantInfo *info,
case GI_TYPE_TAG_DOUBLE:
DO_ALIGNED_COPY(&value->v_double, &rinfo->typelib->data[blob->offset], gdouble);
break;
+ default:
+ g_assert_not_reached ();
}
}
}
diff --git a/girepository/gifieldinfo.c b/girepository/gifieldinfo.c
index ea64dabb..4d07304e 100644
--- a/girepository/gifieldinfo.c
+++ b/girepository/gifieldinfo.c
@@ -337,12 +337,16 @@ g_field_info_get_field (GIFieldInfo *field_info,
g_base_info_get_name ((GIBaseInfo *)field_info),
g_base_info_get_type (interface));
break;
+ default:
+ break;
}
g_base_info_unref ((GIBaseInfo *)interface);
break;
}
break;
+ default:
+ break;
}
}
@@ -513,12 +517,16 @@ g_field_info_set_field (GIFieldInfo *field_info,
g_base_info_get_name ((GIBaseInfo *)field_info),
g_base_info_get_type (interface));
break;
+ default:
+ break;
}
g_base_info_unref ((GIBaseInfo *)interface);
break;
}
break;
+ default:
+ break;
}
} else {
switch (g_type_info_get_tag (type_info))
diff --git a/girepository/girffi.c b/girepository/girffi.c
index 30642fe1..86a13052 100644
--- a/girepository/girffi.c
+++ b/girepository/girffi.c
@@ -102,6 +102,8 @@ gi_type_tag_get_ffi_type_internal (GITypeTag tag,
return &ffi_type_pointer;
else
return &ffi_type_void;
+ default:
+ break;
}
g_assert_not_reached ();
diff --git a/girepository/girnode.c b/girepository/girnode.c
index fb21c288..decd8420 100644
--- a/girepository/girnode.c
+++ b/girepository/girnode.c
@@ -923,6 +923,8 @@ _g_ir_node_can_have_member (GIrNode *node)
case G_IR_NODE_FIELD:
case G_IR_NODE_XREF:
return FALSE;
+ default:
+ g_assert_not_reached ();
};
return FALSE;
}
@@ -2305,6 +2307,8 @@ _g_ir_node_build_typelib (GIrNode *node,
blob->size = strlen (constant->value) + 1;
memcpy (&data[blob->offset], constant->value, blob->size);
break;
+ default:
+ g_assert_not_reached ();
}
*offset2 += ALIGN_VALUE (blob->size, 4);
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 893a9a4e..97e62a53 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -3092,6 +3092,8 @@ start_element_handler (GMarkupParseContext *context,
ctx, error))
goto out;
break;
+ default:
+ break;
}
if (*error == NULL && ctx->state != STATE_PASSTHROUGH)
diff --git a/girepository/girwriter.c b/girepository/girwriter.c
index bb82a46f..7b255423 100644
--- a/girepository/girwriter.c
+++ b/girepository/girwriter.c
@@ -505,6 +505,8 @@ write_callable_info (const gchar *namespace,
case GI_DIRECTION_INOUT:
xml_printf (file, " direction=\"inout\"");
break;
+ default:
+ g_assert_not_reached ();
}
if (g_arg_info_may_be_null (arg))
@@ -529,6 +531,8 @@ write_callable_info (const gchar *namespace,
case GI_SCOPE_TYPE_NOTIFIED:
xml_printf (file, " scope=\"notified\"");
break;
+ default:
+ g_assert_not_reached ();
}
if (g_arg_info_get_closure (arg) >= 0)