[Patch] Fix warnigns from clang (was: Undefined symbols _cairo_boilerplate_get_target_by_name _cairo_boilerplate_xrealloc _cairo_boilerplate_xmalloc)
Uli Schlachter <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Hi,
On 13.04.2012 01:42, Ryan Schmidt wrote:
> Some users of cairo in MacPorts are reporting this build failure with cairo 1.12 on OS X Lion using the Xcode clang compiler:
>
>
> Undefined symbols for architecture x86_64:
> "_cairo_boilerplate_get_target_by_name", referenced from:
> _main in cairo_sphinx-sphinx.o
> "_cairo_boilerplate_xrealloc", referenced from:
> _main in cairo_sphinx-sphinx.o
> _recorder in lto.o
> "_cairo_boilerplate_xmalloc", referenced from:
> _main in cairo_sphinx-sphinx.o
> __surface_create in lto.o
> __context_create in lto.o
> _get_surface_size in lto.o
> _recorder in lto.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>
>
> The full build log (1.1MB) is here:
>
> https://trac.macports.org/attachment/ticket/33827/main.3.log
Sorry, no idea for this issue.
> As an aside, the log shows over 1500 warnings of the form "implicit conversion from enumeration type ... to different enumeration type",
Most of them are between cairo_status_t and cairo_int_status_t. I guess there
isn't much that we can do about those.
> along with this uninitialized variable warning:
>
>
> cairo-scaled-font-subsets.c:526:33: warning: variable 'sub_font_glyph' is uninitialized when used here [-Wuninitialized]
> _cairo_sub_font_glyph_destroy (sub_font_glyph);
> ^~~~~~~~~~~~~~
> cairo-scaled-font-subsets.c:504:43: note: initialize the variable 'sub_font_glyph' to silence this warning
> cairo_sub_font_glyph_t *sub_font_glyph;
> ^
> = NULL
[...]
Ouch. This is indeed wrong. However, just some dead code, so nothing serious.
Attached are two patches which remove some daed code. I will push them if no one
complains.
Uli
--
"Do you know that books smell like nutmeg or some spice from a foreign land?"
-- Faber in Fahrenheit 451
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
0001-Remove-some-unused-functions.patch
(text/x-diff, 3.7 KB)
From 2f9cc45519b9041f96096df21a46ce63fc809a96 Mon Sep 17 00:00:00 2001 From: Uli Schlachter <[email protected]> Date: Tue, 1 May 2012 14:38:51 +0200 Subject: [PATCH 1/2] Remove some unused functions All of these are unused since af9fbd176b145f0424 "Introduce a new compositor architecture". Since no one complained yet, I guess that means that we don't need these any more. :-) This was noticed while looking into the build log provided by http://lists.cairographics.org/archives/cairo/2012-April/022993.html Signed-off-by: Uli Schlachter <[email protected]> --- src/cairo-botor-scan-converter.c | 36 ------------------------------- src/cairo-path-stroke-polygon.c | 44 -------------------------------------- 2 files changed, 80 deletions(-) diff --git a/src/cairo-botor-scan-converter.c b/src/cairo-botor-scan-converter.c index 2729463..515305b 100644 --- a/src/cairo-botor-scan-converter.c +++ b/src/cairo-botor-scan-converter.c @@ -2128,42 +2128,6 @@ botor_add_edge (cairo_botor_scan_converter_t *self, return CAIRO_STATUS_SUCCESS; } -static cairo_status_t -_cairo_botor_scan_converter_add_edge (void *converter, - const cairo_point_t *p1, - const cairo_point_t *p2, - int top, int bottom, - int dir) -{ - cairo_botor_scan_converter_t *self = converter; - cairo_edge_t edge; - - edge.line.p1 = *p1; - edge.line.p2 = *p2; - edge.top = top; - edge.bottom = bottom; - edge.dir = dir; - - return botor_add_edge (self, &edge); -} - -static cairo_status_t -_cairo_botor_scan_converter_add_polygon (void *converter, - const cairo_polygon_t *polygon) -{ - cairo_botor_scan_converter_t *self = converter; - cairo_status_t status; - int i; - - for (i = 0; i < polygon->num_edges; i++) { - status = botor_add_edge (self, &polygon->edges[i]); - if (unlikely (status)) - return status; - } - - return CAIRO_STATUS_SUCCESS; -} - static void _cairo_botor_scan_converter_destroy (void *converter) { diff --git a/src/cairo-path-stroke-polygon.c b/src/cairo-path-stroke-polygon.c index 7b485a1..919e7db 100644 --- a/src/cairo-path-stroke-polygon.c +++ b/src/cairo-path-stroke-polygon.c @@ -232,50 +232,6 @@ join_is_clockwise (const cairo_stroke_face_t *in, return _cairo_slope_compare (&in->dev_vector, &out->dev_vector) < 0; } -static cairo_int64_t -distance_from_face (const cairo_stroke_face_t *face, - const cairo_point_t *p, - cairo_bool_t negate) -{ - int32_t dx = (p->x - face->point.x); - int32_t dy = (p->y - face->point.y); - cairo_int64_t d; - - d = _cairo_int64_sub (_cairo_int32x32_64_mul (dx, face->dev_vector.dy), - _cairo_int32x32_64_mul (dy, face->dev_vector.dx)); - if (negate) - d = _cairo_int64_negate (d); - return d; -} - -static cairo_int64_t -distance_along_face (const cairo_stroke_face_t *face, - const cairo_point_t *p) -{ - int32_t dx = (p->x - face->point.x); - int32_t dy = (p->y - face->point.y); - return _cairo_int64_add (_cairo_int32x32_64_mul (dx, face->dev_vector.dx), - _cairo_int32x32_64_mul (dy, face->dev_vector.dy)); -} - -static void -compute_inner_joint (cairo_point_t *p1, cairo_int64_t d_p1, - const cairo_point_t *p2, cairo_int64_t d_p2, - cairo_int64_t half_line_width) -{ - int32_t dx = p2->x - p1->x; - int32_t dy = p2->y - p1->y; - - half_line_width = _cairo_int64_sub (half_line_width, d_p1); - d_p2 = _cairo_int64_sub (d_p2, d_p1); - - p1->x += _cairo_int_96by64_32x64_divrem (_cairo_int64x32_128_mul (half_line_width, dx), - d_p2).quo; - - p1->y += _cairo_int_96by64_32x64_divrem (_cairo_int64x32_128_mul (half_line_width, dy), - d_p2).quo; -} - static void inner_join (struct stroker *stroker, const cairo_stroke_face_t *in, -- 1.7.10
0002-Remove-some-dead-code.patch
(text/x-diff, 1.3 KB)
From dc9dab365bdd3e571058babe6f7a8408414025ac Mon Sep 17 00:00:00 2001 From: Uli Schlachter <[email protected]> Date: Tue, 1 May 2012 14:48:43 +0200 Subject: [PATCH 2/2] Remove some dead code This code could never be executed, because the status variable doesn't get set since the last time it is checked and errors get returned to the caller. This was noticed while looking into the build log provided by http://lists.cairographics.org/archives/cairo/2012-April/022993.html Reported-by: Ryan Schmidt <[email protected]> Signed-off-by: Uli Schlachter <[email protected]> --- src/cairo-scaled-font-subsets.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c index 355245a..e78e0c2 100644 --- a/src/cairo-scaled-font-subsets.c +++ b/src/cairo-scaled-font-subsets.c @@ -522,11 +522,6 @@ _cairo_sub_font_add_glyph (cairo_sub_font_t *sub_font, y_advance = scaled_glyph->metrics.y_advance; _cairo_scaled_font_thaw_cache (sub_font->scaled_font); - if (unlikely (status)) { - _cairo_sub_font_glyph_destroy (sub_font_glyph); - return status; - } - if (!is_latin && sub_font->num_glyphs_in_current_subset == sub_font->max_glyphs_per_subset) { sub_font->current_subset++; -- 1.7.10