[qpid-cpp] Moved Functor and MemFuncRef out of the definition of Handler.

Darryl L. Pierce mcpierce at fedoraproject.org
Tue Feb 12 19:25:14 UTC 2013


commit 755949d4a2a96ce74c93dd00be64f5467cba23ac
Author: Darryl L. Pierce <dpierce at redhat.com>
Date:   Tue Feb 12 14:18:57 2013 -0500

    Moved Functor and MemFuncRef out of the definition of Handler.
    
    - Resolves: BZ#910201

 ...ixes-building-Qpid-under-the-latest-GCC-4.patch |   82 ++++++++++++++++++++
 qpid-cpp.spec                                      |    9 ++-
 2 files changed, 90 insertions(+), 1 deletions(-)
---
diff --git a/04-QPID-4579-Fixes-building-Qpid-under-the-latest-GCC-4.patch b/04-QPID-4579-Fixes-building-Qpid-under-the-latest-GCC-4.patch
new file mode 100644
index 0000000..e4e8f95
--- /dev/null
+++ b/04-QPID-4579-Fixes-building-Qpid-under-the-latest-GCC-4.patch
@@ -0,0 +1,82 @@
+From 00bfea9666d7f4c1cd9e246fe1ca000332eb565f Mon Sep 17 00:00:00 2001
+From: "Darryl L. Pierce" <dpierce at redhat.com>
+Date: Tue, 12 Feb 2013 10:22:08 -0500
+Subject: [PATCH] QPID-4579: Fixes building Qpid under the latest GCC (4.8.0).
+
+Moves the definition of Functor and MemFuncRef out of Handler class
+definition. Fixes the build failure in later versions of GCC.
+
+Contributed by: Petr Machata <pmachata at redhat.com>
+---
+ qpid/cpp/src/qpid/framing/Handler.h | 43 +++++++++++++++++++++----------------
+ 1 file changed, 24 insertions(+), 19 deletions(-)
+
+diff --git a/qpid/cpp/src/qpid/framing/Handler.h b/qpid/cpp/src/qpid/framing/Handler.h
+index fa8db36..e0c0e59 100644
+--- a/qpid/cpp/src/qpid/framing/Handler.h
++++ b/qpid/cpp/src/qpid/framing/Handler.h
+@@ -49,29 +49,12 @@ struct Handler {
+      * Functor<F>(f) will copy f.
+      * Functor<F&>(f) will only take a reference to x.
+      */
+-    template <class F> class Functor : public Handler<T> {
+-      public:
+-        Functor(F f, Handler<T>* next=0) : Handler<T>(next), functor(f) {}
+-        void handle(T t) { functor(t); }
+-      private:
+-        F functor;
+-    };
++    template <class F> class Functor;
+ 
+     /** Adapt a member function of X as a Handler.
+      * Only holds a reference to its target, not a copy.
+      */
+-    template <class X, void (X::*F)(T)>
+-    class MemFunRef : public Handler<T> {
+-      public:
+-        MemFunRef(X& x, Handler<T>* next=0) : Handler(next), target(&x) {}
+-        void handle(T t) { (target->*F)(t); }
+-
+-        /** Allow calling with -> syntax */
+-        MemFunRef* operator->() { return this; }
+-
+-      private:
+-        X* target;
+-    };
++    template <class X, void (X::*F)(T)> class MemFunRef;
+ 
+     /** Interface for a handler that implements a
+      * pair of in/out handle operations.
+@@ -94,7 +77,29 @@ struct Handler {
+     };
+ };
+ 
++template <class T>
++template <class F>
++class Handler<T>::Functor : public Handler<T> {
++  public:
++    Functor(F f, Handler<T>* next=0) : Handler<T>(next), functor(f) {}
++    void handle(T t) { functor(t); }
++  private:
++    F functor;
++};
++
++template <class T>
++template <class X, void (X::*F)(T)>
++class Handler<T>::MemFunRef : public Handler<T> {
++  public:
++    MemFunRef(X& x, Handler<T>* next=0) : Handler(next), target(&x) {}
++    void handle(T t) { (target->*F)(t); }
++
++    /** Allow calling with -> syntax */
++    MemFunRef* operator->() { return this; }
+ 
++  private:
++    X* target;
++};
+ 
+ }}
+ #endif  /*!QPID_FRAMING_HANDLER_H*/
+-- 
+1.8.1.2
+
diff --git a/qpid-cpp.spec b/qpid-cpp.spec
index e1f520e..9cdf6e5 100644
--- a/qpid-cpp.spec
+++ b/qpid-cpp.spec
@@ -30,7 +30,7 @@
 
 Name:           qpid-cpp
 Version:        0.20
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Libraries for Qpid C++ client applications
 License:        ASL 2.0
 URL:            http://qpid.apache.org
@@ -71,6 +71,8 @@ Patch1: 01-Add-support-for-ARM-processors.patch
 Patch2: 02-Fixed-db4-on-Fedora.patch
 # BZ#885149
 Patch3: 03-QPID-4493-Fixes-a-memory-leak-in-the-Perl-language-b.patch
+# BZ#910201
+Patch4: 04-QPID-4579-Fixes-building-Qpid-under-the-latest-GCC-4.patch
 
 %description
 
@@ -570,6 +572,7 @@ Management and diagnostic tools for Apache Qpid brokers and clients.
 %setup -q -T -D -b 1 -n qpid-%{version}
 
 %patch3 -p2
+%patch4 -p2
 
 # qpid-store
 pushd ../store-%{version}.%{store_svnrev}
@@ -764,6 +767,10 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Tue Feb 12 2013 Darryl L. Pierce <dpierce at redhat.com> - 0.20-4
+- Moved Functor and MemFuncRef out of the definition of Handler.
+- Resolves: BZ#910201
+
 * Sat Feb 09 2013 Denis Arnaud <denis.arnaud_fedora at m4x.org> - 0.20-3
 - Rebuild for Boost-1.53.0
 


More information about the scm-commits mailing list