[gtk/matthiasc/for-master] Add some static assertions
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] Add some static assertions
- Date: Tue, 21 Jan 2020 03:55:03 +0000 (UTC)
commit a38ba91e357ad4f4fca6b7e302672463d5dfb064
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jan 20 22:53:25 2020 -0500
Add some static assertions
Add assertions that ensure the relationships between
css property IDs that we rely on are preserved.
gtk/gtkcssstaticstyle.c | 6 ++++++
gtk/gtkcssstylepropertyimpl.c | 3 +++
2 files changed, 9 insertions(+)
---
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index 24189fcd15..0c6b8da04b 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -206,6 +206,12 @@ gtk_css_static_style_new_compute (GtkStyleProvider *provider,
return GTK_CSS_STYLE (result);
}
+G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_TOP_STYLE == GTK_CSS_PROPERTY_BORDER_TOP_WIDTH - 1);
+G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE == GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH - 1);
+G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE == GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH - 1);
+G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE == GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH - 1);
+G_STATIC_ASSERT (GTK_CSS_PROPERTY_OUTLINE_STYLE == GTK_CSS_PROPERTY_OUTLINE_WIDTH - 1);
+
void
gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProvider *provider,
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index ba65e3cbde..e5834b1dfd 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -921,6 +921,9 @@ icon_theme_value_parse (GtkCssStyleProperty *property,
/*** REGISTRATION ***/
+G_STATIC_ASSERT (GTK_CSS_PROPERTY_COLOR == 0);
+G_STATIC_ASSERT (GTK_CSS_PROPERTY_DPI < GTK_CSS_PROPERTY_FONT_SIZE);
+
void
_gtk_css_style_property_init_properties (void)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]