Patchwork Avoid redefinition in PPL

login
register
mail settings
Submitter Malte Forkel
Date March 16, 2014, 8:22 p.m.
Message ID <532607F3.7040901@berlin.de>
Download mbox | patch
Permalink /patch/330733/
State Under Review
Headers show

Comments

Malte Forkel - March 16, 2014, 8:22 p.m.
Hello,

While building a toolchain with crosstool-NG 0.19.0, I ran into a
conflict between GMP 5.1.1 and PPL 0.11.2:

   .build/src/ppl-0.11.2/src/mp_std_bits.defs.hh:48:7: error:
redefinition of 'class std::numeric_limits<__gmp_expr<__mpz_struct [1],
__mpz_struct [1]> >'

I backported the attached patch from the PPL mailing list [1] to PPL
0.11.2 and successfully used it in crosstool-ng as 
ct-ng.1.19.0/patches/ppl/0.11.2/400-fix-redefinition-numeric-limits.patch.

Please let me know if this is not the proper way to suggest a patch to
crosstool-ng.

Thanks,
Malte

[1] http://www.cs.unipr.it/pipermail/ppl-devel/2012-December/018574.html




--
For unsubscribe information see http://sourceware.org/lists.html#faq

Patch

diff --git a/src/mp_std_bits.cc b/src/mp_std_bits.cc
--- a/src/mp_std_bits.cc
+++ b/src/mp_std_bits.cc
@@ -26,6 +26,9 @@ 
 #include <ppl-config.h>
 #include "mp_std_bits.defs.hh"

+#if __GNU_MP_VERSION < 5 \
+  || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
+
 const bool std::numeric_limits<mpz_class>::is_specialized;
 const int std::numeric_limits<mpz_class>::digits;
 const int std::numeric_limits<mpz_class>::digits10;
@@ -71,3 +74,6 @@ 
 const bool std::numeric_limits<mpq_class>::traps;
 const bool std::numeric_limits<mpq_class>::tininess_before;
 const std::float_round_style std::numeric_limits<mpq_class>::round_style;
+
+#endif // __GNU_MP_VERSION < 5
+       // || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
diff --git a/src/mp_std_bits.defs.hh b/src/mp_std_bits.defs.hh
--- a/src/mp_std_bits.defs.hh
+++ b/src/mp_std_bits.defs.hh
@@ -39,6 +39,9 @@ 
 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
 void swap(mpq_class& x, mpq_class& y);

+#if __GNU_MP_VERSION < 5 \
+  || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
+
 namespace std {

 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
@@ -165,6 +168,9 @@ 

 } // namespace std

+#endif // __GNU_MP_VERSION < 5
+       // || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
+
 #include "mp_std_bits.inlines.hh"

 #endif // !defined(PPL_mp_std_bits_defs_hh)