[givaro] Patch to adapt to new C++ scope rules in GCC 4.7.

Jerry James jjames at fedoraproject.org
Mon Jan 9 23:52:38 UTC 2012


commit 367ae90d21f30031b635a633f425d08dbcc8566a
Author: Jerry James <loganjerry at gmail.com>
Date:   Mon Jan 9 16:51:41 2012 -0700

    Patch to adapt to new C++ scope rules in GCC 4.7.

 givaro-gcc47.patch |  240 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 givaro.spec        |    2 +
 2 files changed, 242 insertions(+), 0 deletions(-)
---
diff --git a/givaro-gcc47.patch b/givaro-gcc47.patch
new file mode 100644
index 0000000..fc577ca
--- /dev/null
+++ b/givaro-gcc47.patch
@@ -0,0 +1,240 @@
+--- ./src/library/poly1/givpoly1proot.inl.orig	2011-07-03 08:50:10.000000000 -0600
++++ ./src/library/poly1/givpoly1proot.inl	2012-01-09 15:38:15.952488392 -0700
+@@ -362,7 +362,7 @@ namespace Givaro {
+ 	template<class Domain, class Tag, class RandIter >
+ 	inline typename Poly1FactorDom<Domain,Tag, RandIter>::Element& Poly1FactorDom<Domain,Tag, RandIter>::creux_random_irreducible (Element& R, Degree n) const
+ 	{
+-		init(R, n);
++		this->init(R, n);
+ 
+ 		Residu_t MOD = _domain.residu();
+ 
+@@ -398,7 +398,7 @@ namespace Givaro {
+ 	{
+ 		// Search for a monic irreducible Polynomial
+ 		// with random Elements
+-		init(R, n);
++		this->init(R, n);
+ 		Residu_t MOD = _domain.residu();
+ 
+ 		if (find_irred_randomial(R,n,MOD))
+@@ -417,9 +417,9 @@ namespace Givaro {
+ 	template<class Domain, class Tag, class RandIter >
+ 	inline typename Poly1FactorDom<Domain,Tag, RandIter>::Element& Poly1FactorDom<Domain,Tag, RandIter>::ixe_irreducible (Element& R, Degree n) const
+ 	{
+-		init(R, n);
++		this->init(R, n);
+ 		Element IXE;
+-		init(IXE,Degree(1));
++		this->init(IXE,Degree(1));
+ 		Residu_t MOD = _domain.residu();
+ 
+ 		// Search for an irreducible BINOMIAL : X^n + a
+@@ -532,13 +532,13 @@ namespace Givaro {
+ 	{
+ 		bool isproot = 0;
+ 		Rep A, G;
+-		mod(A,P,F);
++		this->mod(A,P,F);
+ 		Degree d;
+-		if ( degree(d, this->gcd(G,A,F)) == 0) {
++		if ( this->degree(d, this->gcd(G,A,F)) == 0) {
+ 			Residu_t MOD = _domain.residu();
+ 			IntFactorDom<> FD;
+ 			IntFactorDom<>::Element IMOD( MOD ), q, qp;
+-			degree(d,F);
++			this->degree(d,F);
+ 			//         FD.pow(q ,IMOD, d.value());
+ 			//         FD.sub(qp, q, FD.one);
+ 			FD.subin( FD.pow(qp ,IMOD, d.value()) , FD.one);
+@@ -592,14 +592,14 @@ namespace Givaro {
+ 	template<class Domain, class Tag, class RandIter >
+ 	inline typename Poly1FactorDom<Domain,Tag, RandIter>::Rep& Poly1FactorDom<Domain,Tag, RandIter>::give_prim_root(Rep& R, const Rep& F)  const
+ 	{
+-		Degree n; degree(n,F);
++		Degree n; this->degree(n,F);
+ 		Residu_t MOD = _domain.residu();
+ 		//    this->write(std::cout << "Give Pr: ", F) << std::endl;
+ 
+ 
+ 		// Search for a primitive BINOMIAL : X^i + a
+ 		for(Degree di=1;di<n;++di) {
+-			init(R, di);
++			this->init(R, di);
+ 			//         for(Residu_t a=MOD; a--; )
+ 			for(Residu_t a=0; a<MOD;++a ) {
+ 				_domain.assign(R[0],a);
+@@ -609,7 +609,7 @@ namespace Givaro {
+ 		}
+ 		// Search for a primitive TRINOMIAL : X^i + b*X^j + a
+ 		for(Degree di=2;di<n;++di) {
+-			init(R, di);
++			this->init(R, di);
+ 			for(Degree dj=1;dj<di;++dj)
+ 				//             for(Residu_t b=MOD; b--;)
+ 				for(Residu_t b=0; b<MOD;++b) {
+--- ./src/library/poly1/givpoly1factor.inl.orig	2011-05-14 03:21:22.000000000 -0600
++++ ./src/library/poly1/givpoly1factor.inl	2012-01-09 15:39:21.990018353 -0700
+@@ -33,7 +33,7 @@ inline void Poly1FactorDom<Domain,Tag, R
+     , Degree d
+     , Residu_t MOD) const
+ {
+-    Degree dG;degree(dG,G);
++    Degree dG;this->degree(dG,G);
+     if (dG == d)
+         L.push_back(G);
+     else {
+@@ -41,7 +41,7 @@ inline void Poly1FactorDom<Domain,Tag, R
+         while (! splitted) {
+             Rep tmp, G1;
+             this->gcd(G1, G, this->random(_g, tmp, dG-1));
+-            Degree dG1; degree(dG1,G1);
++            Degree dG1; this->degree(dG1,G1);
+ // write(std::cerr << "SF rd: ", tmp) << std::endl;
+ // write(std::cerr << "SF G1: ", G1) << std::endl;
+             if ( dG1 != dG) {
+@@ -53,8 +53,8 @@ inline void Poly1FactorDom<Domain,Tag, R
+                 Integer pp = (power(Integer(MOD), d.value()) - 1)/2;
+ // std::cerr << "pp: " << pp << std::endl;
+                 Rep tp, tp2, G2;
+-                this->gcd(G2,G, sub(tp2, this->powmod(tp, tmp, pp, G) , _domain.one) );
+-                Degree dG2; degree(dG2,G2);
++                this->gcd(G2,G, this->sub(tp2, this->powmod(tp, tmp, pp, G) , _domain.one) );
++                Degree dG2; this->degree(dG2,G2);
+ // write(std::cerr << "SF t2: ", tp2) << std::endl;
+ // write(std::cerr << "SF G2: ", G2) << std::endl;
+                 if ( dG2 != dG) {
+@@ -63,8 +63,8 @@ inline void Poly1FactorDom<Domain,Tag, R
+                         SplitFactor ( L, G2, d, MOD) ;
+                     }
+ // UNNECESSARY : ANYTHING FOUND BY G3 WOULD HAVE THE COFACTOR IN G2
+-                     Rep G3; this->gcd(G3, G, add(tp2,tp,_domain.one) );
+-                     Degree dG3; degree(dG3,G3);
++                     Rep G3; this->gcd(G3, G, this->add(tp2,tp,_domain.one) );
++                     Degree dG3; this->degree(dG3,G3);
+ // write(std::cerr << "SF t3: ", tp2) << std::endl;
+ // write(std::cerr << "SF G3: ", G3) << std::endl;
+                      if (( dG3 != dG) && (dG3 > 0 )) {
+@@ -138,21 +138,21 @@ inline void Poly1FactorDom<Domain,Tag, R
+ // write(std::cerr << "DD in: ", f) << std::endl;
+     Rep W, D, P = f;
+     Degree dP;
+-    Rep Unit, G1; init(Unit, Degree(1));
++    Rep Unit, G1; this->init(Unit, Degree(1));
+     W.copy(Unit);
+-    degree(dP,P); Degree dPo = (dP/2);
++    this->degree(dP,P); Degree dPo = (dP/2);
+     for(Degree dp = 1; dp <= dPo; ++dp) {
+ // std::cerr << "DD degree: " << dp << std::endl;
+         this->powmod(W, D.copy(W), MOD, P);
+-        this->gcd (G1,sub(D,W,Unit), P) ;
+-        Degree dG1; degree(dG1,G1);
++        this->gcd (G1, this->sub(D,W,Unit), P) ;
++        Degree dG1; this->degree(dG1,G1);
+ // write(std::cerr << "DD found: ", G1) << ", of degree " << dG1 << std::endl;
+         if ( dG1 > 0 ) {
+             SplitFactor (L, G1, dp, MOD);
+-            divin(P,G1);
++            this->divin(P,G1);
+         }
+     }
+-    degree(dP,P);
++    this->degree(dP,P);
+     if (dP > 0)
+         L.push_back(P);
+ // write(std::cerr << "DD: ", P) << std::endl;
+@@ -171,10 +171,10 @@ Poly1FactorDom<Domain,Tag, RandIter>::CZ
+ 	       Residu_t MOD)  const
+ {
+ // write(std::cerr << "CZ in: ", P) << std::endl;
+-    Degree dp; degree(dp,P);
++    Degree dp; this->degree(dp,P);
+     size_t nb=dp.value()+1;
+     Rep * g = new Rep[nb];
+-    sqrfree(nb,g,P);
++    this->sqrfree(nb,g,P);
+ // std::cerr << "CZ sqrfree: " << nb << std::endl;
+     for(size_t i = 0; i<nb;++i) {
+         size_t this_multiplicity = Lf.size();
+@@ -202,17 +202,17 @@ inline bool Poly1FactorDom<Domain,Tag, R
+ 								  , Residu_t MOD ) const
+ {
+ 	Rep W,D;
+-	this->gcd(W,diff(D,P),P);
++	this->gcd(W,this->diff(D,P),P);
+ 	Degree d, dP;
+-	if (degree(d,W) > 0) return 0;
++	if (this->degree(d,W) > 0) return 0;
+ 	// Distinct degree free ?
+-	Rep Unit, G1; init(Unit, Degree(1));
++	Rep Unit, G1; this->init(Unit, Degree(1));
+ 	W.copy(Unit);
+-	degree(dP,P); Degree dPo = (dP/2);
++	this->degree(dP,P); Degree dPo = (dP/2);
+ 	for(Degree dp = 1; dp <= dPo; ++dp) {
+ 		this->powmod(W, D.copy(W), MOD, P);
+-		this->gcd (G1, sub(D,W,Unit), P) ;
+-		if ( degree(d,G1) > 0 ) return 0;
++		this->gcd (G1, this->sub(D,W,Unit), P) ;
++		if ( this->degree(d,G1) > 0 ) return 0;
+ 	}
+ 	return 1;
+ }
+--- ./src/kernel/integer/givintnumtheo.inl.orig	2011-05-14 03:44:47.000000000 -0600
++++ ./src/kernel/integer/givintnumtheo.inl	2012-01-09 15:38:15.957487283 -0700
+@@ -28,8 +28,8 @@ namespace Givaro {
+ 	template<class RandIter>
+ 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::phi(Rep& res, const Rep& n) const
+ 	{
+-		if (isleq(n,1)) return res=n;
+-		if (isleq(n,3)) return sub(res,n,this->one);
++		if (this->isleq(n,1)) return res=n;
++		if (this->isleq(n,3)) return this->sub(res,n,this->one);
+ 		std::list<Rep> Lf;
+ 		Father_t::set(Lf,n);
+ 		//return phi (res,Lf,n);
+@@ -41,11 +41,11 @@ namespace Givaro {
+ 	template< template<class, class> class Container, template<class> class Alloc>
+ 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::phi(Rep& res, const Container<Rep, Alloc<Rep> >& Lf, const Rep& n) const
+ 	{
+-		if (isleq(n,1)) return res=n;
+-		if (isleq(n,3)) return sub(res,n,this->one);
++		if (this->isleq(n,1)) return res=n;
++		if (this->isleq(n,3)) return this->sub(res,n,this->one);
+ 		res = n; Rep t,m;
+ 		for(typename Container<Rep, Alloc<Rep> >::const_iterator f=Lf.begin(); f!=Lf.end(); ++f)
+-			mul(res, divexact(t,res,*f), sub(m, *f, this->one));
++			this->mul(res, this->divexact(t,res,*f), this->sub(m, *f, this->one));
+ 		return res;
+ 	}
+ 
+@@ -423,8 +423,8 @@ namespace Givaro {
+ 	{
+ 		// n must be in {2,4,p^m,2p^m} where p is an odd prime
+ 		// else returns zero
+-		if (isleq(n,4)) return sub(A,n,this->one);
+-		if (isZero(mod(A,n,4))) return A=this->zero;
++		if (this->isleq(n,4)) return this->sub(A,n,this->one);
++		if (isZero(this->mod(A,n,4))) return A=this->zero;
+ 		Rep phin, tmp;
+ 		phi(phin,n);
+ 		std::list<Rep> Lf;
+@@ -433,15 +433,15 @@ namespace Givaro {
+ 		for(f=Lf.begin();f!=Lf.end();++f)
+ 			this->div(*f,phin,*f);
+ 		int found=0;
+-		for(A = 2;(isleq(A,n) && (! found));addin(A,1)) {
++		for(A = 2;(this->isleq(A,n) && (! found));this->addin(A,1)) {
+ 			if (isOne(gcd(tmp,A,n))) {
+ 				found = 1;
+ 				for(f=Lf.begin();(f!=Lf.end() && found);f++)
+ 					found = (! isOne( this->powmod(tmp,A,*f,n)) );
+ 			}
+ 		}
+-		if (isleq(A,n))
+-			return subin(A,1);
++		if (this->isleq(A,n))
++			return this->subin(A,1);
+ 		else
+ 			return A=this->zero;
+ 	}
diff --git a/givaro.spec b/givaro.spec
index 64b26e8..2c84831 100644
--- a/givaro.spec
+++ b/givaro.spec
@@ -8,6 +8,7 @@ License:	CeCILL-B
 URL:		http://ljk.imag.fr/CASYS/LOGICIELS/givaro/
 Source0:	https://forge.imag.fr/frs/download.php/133/givaro-%{version}.tar.gz
 Patch0:		givaro-config-script.patch
+Patch1:         givaro-gcc47.patch
 
 BuildRequires:	doxygen
 BuildRequires:	gmp-devel
@@ -49,6 +50,7 @@ The static libraries for using %{name} for development.
 %prep
 %setup -q
 %patch0
+%patch1
 
 # Fix file encodings
 for i in Licence_CeCILL-B_V1-fr.txt Licence_CeCILL-B_V1-en.txt;


More information about the scm-commits mailing list