[yap] Fix regression with GCC 5.0

Petr Pisar ppisar at fedoraproject.org
Thu Feb 12 17:09:00 UTC 2015


commit cbff981ec5af2f6649ef0ceb3d285bce1fe806b7
Author: Petr Písař <ppisar at redhat.com>
Date:   Thu Feb 12 17:56:03 2015 +0100

    Fix regression with GCC 5.0

 ...tion-template-defined-in-a-class-cannot-b.patch |   62 ++++++++++++++++++++
 yap.spec                                           |    9 +++-
 2 files changed, 70 insertions(+), 1 deletions(-)
---
diff --git a/yap-6.2.2-Friend-function-template-defined-in-a-class-cannot-b.patch b/yap-6.2.2-Friend-function-template-defined-in-a-class-cannot-b.patch
new file mode 100644
index 0000000..6a018c8
--- /dev/null
+++ b/yap-6.2.2-Friend-function-template-defined-in-a-class-cannot-b.patch
@@ -0,0 +1,62 @@
+From 92d5303c23fcc698233b754fc8f180df1fa2aa9b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Thu, 12 Feb 2015 17:37:57 +0100
+Subject: [PATCH] Friend function template defined in a class cannot be used
+ without ADL
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+GCC 5.0 stopped searching friend function templates without ADL.
+
+The Clause_new() function can be kept a friend but must be defined out
+of scope of the Clause class, or the callers must use fully
+qualificated name (Clause::Clause_new()) and the method must be
+changed from friend to static.
+
+So far my poor C++ knowledge.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ packages/swi-minisat2/C/Solver.C      | 4 ++--
+ packages/swi-minisat2/C/SolverTypes.h | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/packages/swi-minisat2/C/Solver.C b/packages/swi-minisat2/C/Solver.C
+index 2de3e6d..1bcdbff 100644
+--- a/packages/swi-minisat2/C/Solver.C
++++ b/packages/swi-minisat2/C/Solver.C
+@@ -120,7 +120,7 @@ bool Solver::addClause(vec<Lit>& ps)
+         uncheckedEnqueue(ps[0]);
+         return ok = (propagate() == NULL);
+     }else{
+-        Clause* c = Clause_new(ps, false);
++        Clause* c = Clause::Clause_new(ps, false);
+         clauses.push(c);
+         attachClause(*c);
+     }
+@@ -599,7 +599,7 @@ lbool Solver::search(int nof_conflicts, int nof_learnts)
+             if (learnt_clause.size() == 1){
+                 uncheckedEnqueue(learnt_clause[0]);
+             }else{
+-                Clause* c = Clause_new(learnt_clause, true);
++                Clause* c = Clause::Clause_new(learnt_clause, true);
+                 learnts.push(c);
+                 attachClause(*c);
+                 claBumpActivity(*c);
+diff --git a/packages/swi-minisat2/C/SolverTypes.h b/packages/swi-minisat2/C/SolverTypes.h
+index 47e3023..919b60b 100644
+--- a/packages/swi-minisat2/C/SolverTypes.h
++++ b/packages/swi-minisat2/C/SolverTypes.h
+@@ -119,7 +119,7 @@ public:
+ 
+     // -- use this function instead:
+     template<class V>
+-    friend Clause* Clause_new(const V& ps, bool learnt = false) {
++    static Clause* Clause_new(const V& ps, bool learnt = false) {
+         assert(sizeof(Lit)      == sizeof(uint32_t));
+         assert(sizeof(float)    == sizeof(uint32_t));
+         void* mem = malloc(sizeof(Clause) + sizeof(uint32_t)*(ps.size()));
+-- 
+1.9.3
+
diff --git a/yap.spec b/yap.spec
index c88e9c3..df96215 100644
--- a/yap.spec
+++ b/yap.spec
@@ -4,7 +4,7 @@
 
 Name:       yap
 Version:    6.2.2
-Release:    12%{?dist}
+Release:    13%{?dist}
 Summary:    High-performance Prolog Compiler
 Group:      Development/Languages
 # README                            Perl Artistic license 2 and the FSF's LGPL
@@ -32,6 +32,9 @@ Patch10:    yap-6.2.2-Off-by-one-error-when-initializing-yap_flags.patch
 # yap 6.2.2 does not work on PPC (bug #790625)
 # Reported to upstream <yap-users at lists.sourceforge.net>
 Patch11:    yap-6.2.2-Texinfo-5-does-not-allow-bullet-as-table-indicator.patch
+# Fix regression with GCC 5.0
+# <https://sourceforge.net/p/yap/mailman/message/33405667/>
+Patch12:    yap-6.2.2-Friend-function-template-defined-in-a-class-cannot-b.patch
 ExcludeArch:    ppc %{power64}
 BuildRequires:  autoconf
 # Update config.sub to support aarch64, bug #926852
@@ -91,6 +94,7 @@ Documentation for Yap.
 %patch9 -p1 -b .remove_feature_macro
 %patch10 -p1 -b .initialization
 %patch11 -p1 -b .texinfo5
+%patch12 -p1 -b .gcc5
 
 # remove redundant RPATH
 sed -i 's/-Wl,-R\(,\)\{0,1\}\\$(LIBDIR)//' configure.in
@@ -234,6 +238,9 @@ fi
 
 
 %changelog
+* Thu Feb 12 2015 Petr Pisar <ppisar at redhat.com> - 6.2.2-13
+- Fix regression with GCC 5.0
+
 * Wed Aug 20 2014 Kevin Fenzi <kevin at scrye.com> - 6.2.2-12
 - Rebuild for rpm bug 1131892
 


More information about the scm-commits mailing list