From 77f2a03e39858624bffbc6aa04d512ffc46ea22f Mon Sep 17 00:00:00 2001 From: dooglus Date: Thu, 27 Sep 2007 15:10:39 +0000 Subject: [PATCH] Fix 1509627: Work around a bug in gcc 4.1.2 and earlier. Compiling with -O2 or higher was optimizing out a variable that we are using. git-svn-id: http://svn.voria.com/code@774 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/loadcanvas.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/synfig-core/trunk/src/synfig/loadcanvas.cpp b/synfig-core/trunk/src/synfig/loadcanvas.cpp index 760a231..8edd651 100644 --- a/synfig-core/trunk/src/synfig/loadcanvas.cpp +++ b/synfig-core/trunk/src/synfig/loadcanvas.cpp @@ -290,6 +290,15 @@ CanvasParser::parse_integer(xmlpp::Element *element) return atoi(val.c_str()); } +// see 'minor hack' at the end of parse_vector() below +// making this 'static' to give it file local scope +// stops it working (where working means working around +// bug #1509627) +Vector &canvas_parser_vector_id(Vector &vector) +{ + return vector; +} + Vector CanvasParser::parse_vector(xmlpp::Element *element) { @@ -332,7 +341,12 @@ CanvasParser::parse_vector(xmlpp::Element *element) else error_unexpected_element(child,child->get_name()); } - return vect; + // Minor hack - gcc 4.1.2 and earlier think that we're not using + // 'vect' and optimize it out at -O2 and higher. This convinces + // them that we are really using it. + return canvas_parser_vector_id(vect); + // When the bug is fixed, we can just do this instead: + // return vect; } Color -- 2.7.4