Compare commits

...

5 Commits

Author SHA1 Message Date
Emmanuele Bassi
6d3beaf955 gsk/ngl: Build with G_DISABLE_ASSERT enabled 2021-04-12 12:27:55 +01:00
Emmanuele Bassi
1968a18edb gsk/gl: Build with G_DISABLE_ASSERT enabled 2021-04-12 12:27:33 +01:00
Emmanuele Bassi
cfe688f27e wayland: Build with G_DISABLE_ASSERT 2021-04-12 11:59:56 +01:00
Emmanuele Bassi
d37e9f708b build: Don't append multiple flags as a string
The gtk_debug_cflags variable is an array, with each argument stored in
a separate string; if we add multiple arguments inside the same string
we break the escaping rules.

Fixes: #3864
2021-04-12 11:29:53 +01:00
Emmanuele Bassi
fe66225189 Disable G_DISABLE_ASSERT in gtk_test_init()
If G_DISABLE_ASSERT is set when calling g_test_init(), the function will
warn and break every test.
2021-04-12 11:29:53 +01:00
8 changed files with 76 additions and 8 deletions

View File

@@ -848,7 +848,12 @@ gdk_wayland_device_pad_get_n_groups (GdkDevicePad *pad)
data = gdk_wayland_seat_find_pad (GDK_WAYLAND_SEAT (seat),
GDK_DEVICE (pad));
#ifdef G_DISABLE_ASSERT
if (data == NULL)
return 0;
#else
g_assert (data != NULL);
#endif
return g_list_length (data->mode_groups);
}
@@ -863,7 +868,12 @@ gdk_wayland_device_pad_get_group_n_modes (GdkDevicePad *pad,
data = gdk_wayland_seat_find_pad (GDK_WAYLAND_SEAT (seat),
GDK_DEVICE (pad));
#ifdef G_DISABLE_ASSERT
if (data == NULL)
return 0;
#else
g_assert (data != NULL);
#endif
group = g_list_nth_data (data->mode_groups, n_group);
if (!group)
@@ -909,7 +919,12 @@ gdk_wayland_device_pad_get_feature_group (GdkDevicePad *pad,
data = gdk_wayland_seat_find_pad (GDK_WAYLAND_SEAT (seat),
GDK_DEVICE (pad));
#ifdef G_DISABLE_ASSERT
if (data == NULL)
return -1;
#else
g_assert (data != NULL);
#endif
for (l = data->mode_groups, i = 0; l; l = l->next, i++)
{
@@ -4236,7 +4251,14 @@ tablet_pad_handle_button (void *data,
wp_tablet_pad, button, state));
group = tablet_pad_lookup_button_group (pad, button);
#ifdef G_DISABLE_ASSERT
if (group == NULL)
return;
#else
g_assert (group != NULL);
#endif
n_group = g_list_index (pad->mode_groups, group);
event = gdk_pad_event_new_button (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED

View File

@@ -58,6 +58,19 @@
#include "gdk/gdk-private.h"
/* Keep g_assert() defined even if we disable it globally,
* as we use it in many places as a handy mechanism to check
* for non-NULL
*/
#ifdef G_DISABLE_ASSERT
# undef g_assert
# define g_assert(expr) G_STMT_START { \
if G_LIKELY (expr) ; else \
g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
#expr); \
} G_STMT_END
#endif
/**
* GdkWaylandDisplay:
*

View File

@@ -433,8 +433,6 @@ gsk_gl_driver_slice_texture (GskGLDriver *self,
guint *out_n_slices)
{
const int max_texture_size = gsk_gl_driver_get_max_texture_size (self) / 4; // XXX Too much?
const int tex_width = texture->width;
const int tex_height = texture->height;
const int cols = (texture->width / max_texture_size) + 1;
const int rows = (texture->height / max_texture_size) + 1;
int col, row;
@@ -442,8 +440,7 @@ gsk_gl_driver_slice_texture (GskGLDriver *self,
TextureSlice *slices;
Texture *tex;
g_assert (tex_width > max_texture_size || tex_height > max_texture_size);
g_assert (texture->width > max_texture_size || texture->height > max_texture_size);
tex = gdk_texture_get_render_data (texture, self);
@@ -730,7 +727,12 @@ gsk_gl_driver_mark_texture_permanent (GskGLDriver *self,
{
Texture *t = gsk_gl_driver_get_texture (self, texture_id);
#ifdef G_DISABLE_ASSERT
if (t == NULL)
return;
#else
g_assert (t != NULL);
#endif
t->permanent = TRUE;
}

View File

@@ -2002,7 +2002,12 @@ render_unblurred_inset_shadow_node (GskGLRenderer *self,
const float dy = gsk_inset_shadow_node_get_dy (node);
const float spread = gsk_inset_shadow_node_get_spread (node);
#if G_DISABLE_ASSERT
if (blur_radius == 0)
return;
#else
g_assert (blur_radius == 0);
#endif
ops_set_program (builder, &self->programs->inset_shadow_program);
ops_set_inset_shadow (builder, transform_rect (self, builder, gsk_inset_shadow_node_get_outline (node)),

View File

@@ -19,9 +19,9 @@ rounded_rect_equal (const GskRoundedRect *r1,
const GskRoundedRect *r2)
{
if (r1 == r2)
return true;
return true;
if (!r1)
if (r1 == NULL || r2 == NULL)
return false;
if (r1->bounds.origin.x != r2->bounds.origin.x ||
@@ -626,6 +626,9 @@ ops_draw (RenderOpBuilder *builder,
ProgramState *program_state = get_current_program_state (builder);
OpDraw *op;
if (program_state == NULL)
return NULL;
if (memcmp (&builder->current_projection, &program_state->projection, sizeof (graphene_matrix_t)) != 0)
{
OpMatrix *opm;
@@ -739,7 +742,12 @@ ops_set_inset_shadow (RenderOpBuilder *self,
ProgramState *current_program_state = get_current_program_state (self);
OpShadow *op;
#ifdef G_DISABLE_ASSERT
if (current_program_state == NULL)
return;
#else
g_assert (current_program_state);
#endif
op = ops_begin (self, OP_CHANGE_INSET_SHADOW);
@@ -806,7 +814,12 @@ ops_set_unblurred_outset_shadow (RenderOpBuilder *self,
ProgramState *current_program_state = get_current_program_state (self);
OpShadow *op;
#ifdef G_DISABLE_ASSERT
if (current_program_state == NULL)
return;
#else
g_assert (current_program_state);
#endif
op = ops_begin (self, OP_CHANGE_UNBLURRED_OUTSET_SHADOW);
@@ -869,7 +882,12 @@ ops_set_linear_gradient (RenderOpBuilder *self,
OpLinearGradient *op;
const guint real_n_color_stops = MIN (GL_MAX_GRADIENT_STOPS, n_color_stops);
#ifdef G_DISABLE_ASSERT
if (current_program_state == NULL)
return;
#else
g_assert (current_program_state);
#endif
op = ops_begin (self, OP_CHANGE_LINEAR_GRADIENT);

View File

@@ -246,7 +246,7 @@ gsk_ngl_texture_atlas_initialize (GskNglDriver *driver,
{
/* Insert a single pixel at 0,0 for use in coloring */
gboolean packed;
gboolean packed G_GNUC_UNUSED;
int x, y;
guint gl_format;
guint gl_type;

View File

@@ -17,6 +17,14 @@
*/
/* We need to remove G_DISABLE_ASSERT to ensure g_test_init() works;
* this needs to happen before we end up including glib.h, so we should
* do it as soon as possible.
*/
#ifdef G_DISABLE_ASSERT
#undef G_DISABLE_ASSERT
#endif
#include "config.h"
#include "gtkspinbutton.h"

View File

@@ -66,7 +66,7 @@ if debug
gtk_debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS'
endif
elif optimization in ['2', '3', 's']
gtk_debug_cflags += '-DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT'
gtk_debug_cflags += ['-DG_DISABLE_CAST_CHECKS', '-DG_DISABLE_ASSERT']
endif
add_project_arguments(gtk_debug_cflags, language: 'c')