[med-svn] [opensurgsim] 01/01: Backport patches for building with GCC 5
Paul Novotny
paulnovo-guest at moszumanska.debian.org
Wed Sep 9 13:34:30 UTC 2015
This is an automated email from the git hooks/post-receive script.
paulnovo-guest pushed a commit to branch master
in repository opensurgsim.
commit 99fcb1addad768914eb2f0cbe9d560da0bace686
Author: Paul Novotny <paul at paulnovo.us>
Date: Wed Sep 9 08:34:56 2015 -0400
Backport patches for building with GCC 5
---
debian/changelog | 1 +
debian/patches/backport-d0a635981.patch | 48 +++++++++++++++++++++
debian/patches/backport-e762a2ea9.patch | 76 +++++++++++++++++++++++++++++++++
debian/patches/series | 2 +
4 files changed, 127 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 8517e06..bd7afb8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ opensurgsim (0.6.0-2) unstable; urgency=low
[ Paul Novotny ]
* Updates for yaml-cpp 0.5.2
+ * Backport fixes for compiling with GCC 5
[ Andreas Tille ]
* Fix Vcs fields via `cme fix dpkg-control`
diff --git a/debian/patches/backport-d0a635981.patch b/debian/patches/backport-d0a635981.patch
new file mode 100644
index 0000000..90d19ed
--- /dev/null
+++ b/debian/patches/backport-d0a635981.patch
@@ -0,0 +1,48 @@
+Description: Fix gcc5 related issues [Patch 2/2]
+ Backported commits from upstream that fix building with GCC 5.
+ This commit prevents GCC from optimizing out unused static variables
+ that should not be removed.
+Author: Paul Novotny <paul at paulnovo.us>
+Origin: upstream, https://github.com/simquest/opensurgsim/commit/d0a635981
+Last-Update: 2015-09-08
+
+--- a/SurgSim/Framework/Macros.h
++++ b/SurgSim/Framework/Macros.h
+@@ -21,11 +21,11 @@
+ #define SURGSIM_CLASSNAME(ClassName) \
+ virtual std::string getClassName() const {return #ClassName;}
+
+-/// GCC macro to suppress unused-variable warnings
++/// Macro to tell GCC this is a used variable, and not to optimize it out
+ #ifdef __GNUC__
+-#define SURGSIM_UNUSED_VARIABLE(x) __attribute__((unused)) x
++#define SURGSIM_USED_VARIABLE(x) x __attribute__((used))
+ #else
+-#define SURGSIM_UNUSED_VARIABLE(x) x
++#define SURGSIM_USED_VARIABLE(x) x
+ #endif
+
+ ///@{
+--- a/SurgSim/Framework/ObjectFactory.h
++++ b/SurgSim/Framework/ObjectFactory.h
+@@ -126,8 +126,8 @@
+ /// 'DerivedClass' is 'ClassName' with namespace prefixes,
+ /// and 'ClassName' is the name of the class without namespace prefix.
+ #define SURGSIM_REGISTER(BaseClass, DerivedClass, ClassName) \
+- SURGSIM_UNUSED_VARIABLE(bool SURGSIM_CONCATENATE(ClassName, Registered) = \
+- BaseClass::getFactory().registerClass<DerivedClass>(#DerivedClass));
++ SURGSIM_USED_VARIABLE(bool SURGSIM_CONCATENATE(ClassName, Registered)) = \
++ BaseClass::getFactory().registerClass<DerivedClass>(#DerivedClass);
+
+ /// Force compilation of the boolean symbol SURGSIM_CONCATENATE(ClassName, Registered) in SURGSIM_REGISTER macro,
+ /// which in turn registers DerivedClass into BaseClass's ObjectFactory.
+@@ -144,7 +144,7 @@
+ /// 'ClassName' should be the name of the class without any prefix.
+ #define SURGSIM_STATIC_REGISTRATION(ClassName) \
+ extern bool SURGSIM_CONCATENATE(ClassName, Registered); \
+- SURGSIM_UNUSED_VARIABLE(static bool SURGSIM_CONCATENATE(ClassName, IsRegistered) = \
+- SURGSIM_CONCATENATE(ClassName, Registered));
++ SURGSIM_USED_VARIABLE(static bool SURGSIM_CONCATENATE(ClassName, IsRegistered)) = \
++ SURGSIM_CONCATENATE(ClassName, Registered);
+
+ #endif // SURGSIM_FRAMEWORK_OBJECTFACTORY_H
diff --git a/debian/patches/backport-e762a2ea9.patch b/debian/patches/backport-e762a2ea9.patch
new file mode 100644
index 0000000..51afdad
--- /dev/null
+++ b/debian/patches/backport-e762a2ea9.patch
@@ -0,0 +1,76 @@
+Description: Fix gcc5 related issues [Patch 1/2]
+ Backported commits from upstream that fix building with GCC 5.
+ This commit fixes an error with a ObjectFactory, a couple of
+ failing unit tests, and a variable might be used uninitialized
+ warning.
+Author: Paul Novotny <paul at paulnovo.us>
+Origin: upstream, https://github.com/simquest/opensurgsim/commit/e762a2ea9
+Last-Update: 2015-09-08
+
+--- a/SurgSim/Framework/Macros.h
++++ b/SurgSim/Framework/Macros.h
+@@ -21,11 +21,11 @@
+ #define SURGSIM_CLASSNAME(ClassName) \
+ virtual std::string getClassName() const {return #ClassName;}
+
+-/// GCC macro to write out an _Pragma statement inside a macro, disabled for other platforms
++/// GCC macro to suppress unused-variable warnings
+ #ifdef __GNUC__
+-#define SURGSIM_DO_PRAGMA(x) _Pragma (#x)
++#define SURGSIM_UNUSED_VARIABLE(x) __attribute__((unused)) x
+ #else
+-#define SURGSIM_DO_PRAGMA(x)
++#define SURGSIM_UNUSED_VARIABLE(x) x
+ #endif
+
+ ///@{
+--- a/SurgSim/Framework/ObjectFactory.h
++++ b/SurgSim/Framework/ObjectFactory.h
+@@ -105,7 +105,7 @@
+
+ private:
+
+- typedef boost::function<std::shared_ptr<Base>(Parameter1)> Constructor;
++ typedef boost::function<std::shared_ptr<Base>(const Parameter1&)> Constructor;
+
+ /// All the constructors.
+ std::map<std::string, Constructor> m_constructors;
+@@ -126,8 +126,8 @@
+ /// 'DerivedClass' is 'ClassName' with namespace prefixes,
+ /// and 'ClassName' is the name of the class without namespace prefix.
+ #define SURGSIM_REGISTER(BaseClass, DerivedClass, ClassName) \
+- bool SURGSIM_CONCATENATE(ClassName, Registered) = \
+- BaseClass::getFactory().registerClass<DerivedClass>(#DerivedClass); \
++ SURGSIM_UNUSED_VARIABLE(bool SURGSIM_CONCATENATE(ClassName, Registered) = \
++ BaseClass::getFactory().registerClass<DerivedClass>(#DerivedClass));
+
+ /// Force compilation of the boolean symbol SURGSIM_CONCATENATE(ClassName, Registered) in SURGSIM_REGISTER macro,
+ /// which in turn registers DerivedClass into BaseClass's ObjectFactory.
+@@ -143,10 +143,8 @@
+ /// This macro should be put in the DerivedClass's header file, under the same namespace in which the DerivedClass is.
+ /// 'ClassName' should be the name of the class without any prefix.
+ #define SURGSIM_STATIC_REGISTRATION(ClassName) \
+- SURGSIM_DO_PRAGMA (GCC diagnostic push); \
+- SURGSIM_DO_PRAGMA (GCC diagnostic ignored "-Wunused-variable"); \
+ extern bool SURGSIM_CONCATENATE(ClassName, Registered); \
+- static bool SURGSIM_CONCATENATE(ClassName, IsRegistered) = SURGSIM_CONCATENATE(ClassName, Registered); \
+- SURGSIM_DO_PRAGMA (GCC diagnostic pop)
++ SURGSIM_UNUSED_VARIABLE(static bool SURGSIM_CONCATENATE(ClassName, IsRegistered) = \
++ SURGSIM_CONCATENATE(ClassName, Registered));
+
+-#endif // SURGSIM_FRAMEWORK_OBJECTFACTORY_H
+\ No newline at end of file
++#endif // SURGSIM_FRAMEWORK_OBJECTFACTORY_H
+--- a/SurgSim/Physics/Fem3DElementCorotationalTetrahedron.cpp
++++ b/SurgSim/Physics/Fem3DElementCorotationalTetrahedron.cpp
+@@ -180,8 +180,8 @@
+ // Now we compute some useful matrices for the next step
+ double determinant;
+ bool invertible;
+- SurgSim::Math::Matrix33d G, Ginv;
+- G = (scaling.trace() * SurgSim::Math::Matrix33d::Identity() - scaling) * m_rotation.transpose();
++ Math::Matrix33d G = (scaling.trace() * Math::Matrix33d::Identity() - scaling) * m_rotation.transpose();
++ Math::Matrix33d Ginv = Math::Matrix33d::Zero();
+ G.computeInverseAndDetWithCheck(Ginv, determinant, invertible);
+ if (!invertible)
+ {
diff --git a/debian/patches/series b/debian/patches/series
index fd9ff98..bb55fe7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,5 @@ backport-03c10f32d.patch
use-debian-yaml-cpp.patch
add-version-to-libs.patch
backport-cb568a34f.patch
+backport-e762a2ea9.patch
+backport-d0a635981.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/opensurgsim.git
More information about the debian-med-commit
mailing list