diff options
author | Benjamin Otte <otte@redhat.com> | 2010-02-10 22:10:23 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-02-10 22:13:33 +0100 |
commit | ed4a30b38311e4ce0730ecd6026432f4a1e8ddf7 (patch) | |
tree | 6aca027781d4522e093939afdc061f3d977eb72c | |
parent | 4113e455a317785b83324215a6b0156995665989 (diff) |
build: Add -Wdeclaration-after-statement
... and fix the compile errors from it I get on my build.
It's Cairo style to put declarations before the code, so better warn
about it.
Besides, it eases porting to old compilers like MSVC.
-rw-r--r-- | build/configure.ac.warnings | 2 | ||||
-rw-r--r-- | src/cairo-gl-shaders.c | 8 | ||||
-rw-r--r-- | src/cairo-gl-surface.c | 3 | ||||
-rw-r--r-- | src/cairo-xcb-surface-core.c | 3 |
4 files changed, 9 insertions, 7 deletions
diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings index 212f8a06..5b561e14 100644 --- a/build/configure.ac.warnings +++ b/build/configure.ac.warnings @@ -9,7 +9,7 @@ dnl MAYBE_WARN in an ignorable way (like adding whitespace) # cast image data from uint8_t to uin32_t. MAYBE_WARN="-Wall -Wextra \ --Wold-style-definition \ +-Wold-style-definition -Wdeclaration-after-statement \ -Wmissing-declarations -Werror-implicit-function-declaration \ -Wnested-externs -Wpointer-arith -Wwrite-strings \ -Wsign-compare -Wstrict-prototypes -Wmissing-prototypes \ diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c index 582eb484..e2797d58 100644 --- a/src/cairo-gl-shaders.c +++ b/src/cairo-gl-shaders.c @@ -292,14 +292,14 @@ static cairo_status_t bind_matrix_to_shader_arb (GLuint program, const char *name, cairo_matrix_t* m) { GLint location = glGetUniformLocationARB (program, name); - if (location == -1) - return CAIRO_INT_STATUS_UNSUPPORTED; float gl_m[16] = { m->xx, m->xy, 0, m->x0, m->yx, m->yy, 0, m->y0, 0, 0, 1, 0, 0, 0, 0, 1 }; + if (location == -1) + return CAIRO_INT_STATUS_UNSUPPORTED; glUniformMatrix4fvARB (location, 1, GL_TRUE, gl_m); return CAIRO_STATUS_SUCCESS; } @@ -466,14 +466,14 @@ static cairo_status_t bind_matrix_to_shader_core_2_0 (GLuint program, const char *name, cairo_matrix_t* m) { GLint location = glGetUniformLocation (program, name); - if (location == -1) - return CAIRO_INT_STATUS_UNSUPPORTED; float gl_m[16] = { m->xx, m->xy, 0, m->x0, m->yx, m->yy, 0, m->y0, 0, 0, 1, 0, 0, 0, 0, 1 }; + if (location == -1) + return CAIRO_INT_STATUS_UNSUPPORTED; glUniformMatrix4fv (location, 1, GL_TRUE, gl_m); return CAIRO_STATUS_SUCCESS; } diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index c860f304..9c7c28ef 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -1311,9 +1311,10 @@ _cairo_gl_operand_init (cairo_gl_composite_operand_t *operand, int dst_x, int dst_y, int width, int height) { - operand->pattern = pattern; cairo_status_t status; + operand->pattern = pattern; + switch (pattern->type) { case CAIRO_PATTERN_TYPE_SOLID: return _cairo_gl_solid_operand_init (operand, diff --git a/src/cairo-xcb-surface-core.c b/src/cairo-xcb-surface-core.c index 2788bdf2..3cc167ee 100644 --- a/src/cairo-xcb-surface-core.c +++ b/src/cairo-xcb-surface-core.c @@ -506,9 +506,10 @@ _cairo_xcb_surface_core_copy_boxes (cairo_xcb_surface_t *dst, _cairo_xcb_connection_change_gc (dst->connection, gc, mask, values); for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) { - xcb_rects = (xcb_rectangle_t *) chunk->base; int i; + xcb_rects = (xcb_rectangle_t *) chunk->base; + for (i = 0; i < chunk->count; i++) { int x1 = _cairo_fixed_integer_round (chunk->base[i].p1.x); int x2 = _cairo_fixed_integer_round (chunk->base[i].p2.x); |