aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-22 19:59:07 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-22 19:59:07 +0000
commite6253d061ec48e5099fb02d458d3ef4285548ee7 (patch)
tree6a9f52138986e32772af0c39abb5648e7ad9dd64
parent8348f66dd71856d463f6cf1c760c1bb68897d428 (diff)
downloadpaludis-e6253d061ec48e5099fb02d458d3ef4285548ee7.tar.gz
paludis-e6253d061ec48e5099fb02d458d3ef4285548ee7.tar.xz
g++3.4 sucks. But we have to work with it anyway, so include a really weird workaround for a really weird bug.
-rw-r--r--paludis/match_sequence.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/paludis/match_sequence.cc b/paludis/match_sequence.cc
index 00e8c40..f6f944e 100644
--- a/paludis/match_sequence.cc
+++ b/paludis/match_sequence.cc
@@ -21,6 +21,18 @@
using namespace paludis;
+/* gcc 3.4 gets things horribly wrong, and thinks that some functions will
+ * never return when in fact they will. this is a nasty workaround. */
+#if defined(__GNUC__)
+# if __GNUC__ < 4
+# define WORK_AROUND_BROKEN_COMPILER do { std::string s; } while (false)
+# else
+# define WORK_AROUND_BROKEN_COMPILER
+# endif
+#else
+# define WORK_AROUND_BROKEN_COMPILER
+#endif
+
struct MatchRule::Rule :
InternalCounted<MatchRule::Rule>
{
@@ -63,6 +75,8 @@ struct MatchRule::SequenceRule :
std::string::size_type
local_match(const std::string & t, std::string::size_type p) const
{
+ WORK_AROUND_BROKEN_COMPILER;
+
std::string::size_type l1(r1._rule->local_match(t, p)), l2(0);
if (std::string::npos == l1)
return l1;
@@ -86,6 +100,8 @@ struct MatchRule::EitherRule :
std::string::size_type
local_match(const std::string & t, std::string::size_type p) const
{
+ WORK_AROUND_BROKEN_COMPILER;
+
std::string::size_type l1(r1._rule->local_match(t, p));
if (std::string::npos != l1)
return l1;
@@ -106,6 +122,8 @@ struct MatchRule::ZeroOrMoreRule :
std::string::size_type
local_match(const std::string & t, std::string::size_type p) const
{
+ WORK_AROUND_BROKEN_COMPILER;
+
std::string::size_type result(p), q;
while (std::string::npos != ((q = r1._rule->local_match(t, result))))
result += q;
@@ -170,6 +188,7 @@ MatchRule::operator* () const
bool
MatchRule::match(const std::string & s) const
{
+ WORK_AROUND_BROKEN_COMPILER;
return (std::string::npos != _rule->local_match(s, 0));
}