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.
This commit is contained in:
Christoph Reiter 2018-07-29 17:13:16 +02:00
parent 7be196f295
commit a718ebac86
7 changed files with 24 additions and 0 deletions

View File

@ -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];

View File

@ -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 ();
}
}
}

View File

@ -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))

View File

@ -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 ();

View File

@ -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);

View File

@ -3092,6 +3092,8 @@ start_element_handler (GMarkupParseContext *context,
ctx, error))
goto out;
break;
default:
break;
}
if (*error == NULL && ctx->state != STATE_PASSTHROUGH)

View File

@ -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)