dev-python/jpype: fix building with -Werror=terminate using GCC-6.

Gentoo-Bug: https://bugs.gentoo.org/608920
Package-Manager: Portage-2.3.6, Repoman-2.3.2
Closes: https://github.com/gentoo/gentoo/pull/5194
This commit is contained in:
Peter Levine
2017-07-24 03:26:40 -04:00
committed by Patrice Clement
parent fd7d47b11f
commit 561d2af41a
3 changed files with 62 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
Bug: https://bugs.gentoo.org/show_bug.cgi?id=608920
Upstream commit: https://github.com/originell/jpype/commit/3a4fb98938afd9c03070086d1b8fda8841410fa3
From c3578c3488de35236f73b6eb27428b1f1526c45b Mon Sep 17 00:00:00 2001
From: Peter-Levine <plevine457@gmail.com>
Date: Sat, 11 Feb 2017 23:31:27 -0500
Subject: [PATCH] Mark destructor that throws as noexcept(false) for >=C++11
---
native/common/include/jp_field.h | 2 +-
native/common/include/jpype.h | 6 ++++++
native/common/jp_field.cpp | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/native/common/include/jp_field.h b/native/common/include/jp_field.h
index d28b795..f93752c 100644
--- a/native/common/include/jp_field.h
+++ b/native/common/include/jp_field.h
@@ -38,7 +38,7 @@ public :
/**
* destructor
*/
- virtual ~JPField();
+ virtual ~JPField() NO_EXCEPT_FALSE;
public :
bool isStatic() const;
diff --git a/native/common/include/jpype.h b/native/common/include/jpype.h
index 7db5832..a492d06 100644
--- a/native/common/include/jpype.h
+++ b/native/common/include/jpype.h
@@ -64,6 +64,12 @@
#define PyUnicode_FromFormat PyString_FromFormat
#endif
+// Define this and use to allow destructors to throw in C++11 or later
+#if __cplusplus >= 201103L
+#define NO_EXCEPT_FALSE noexcept(false)
+#else
+#define NO_EXCEPT_FALSE
+#endif
#include <map>
#include <string>
diff --git a/native/common/jp_field.cpp b/native/common/jp_field.cpp
index 8c75e58..5ef9d8c 100644
--- a/native/common/jp_field.cpp
+++ b/native/common/jp_field.cpp
@@ -63,7 +63,7 @@ JPField::JPField(const JPField& fld)
TRACE_OUT;
}
-JPField::~JPField()
+JPField::~JPField() NO_EXCEPT_FALSE
{
TRACE_IN("JPField::~JPField");
JPEnv::getJava()->DeleteGlobalRef(m_Field);

View File

@@ -1,4 +1,4 @@
# Copyright 1999-2016 Gentoo Foundation
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
@@ -22,6 +22,8 @@ DEPEND="
dev-python/setuptools[${PYTHON_USEDEP}]
>=virtual/jdk-1.6"
PATCHES=( "${FILESDIR}"/${PN}-gcc6-noexcept.patch )
python_compile() {
if ! python_is_python3; then
local CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"

View File

@@ -22,6 +22,8 @@ DEPEND="
dev-python/setuptools[${PYTHON_USEDEP}]
>=virtual/jdk-1.6"
PATCHES=( "${FILESDIR}"/${PN}-gcc6-noexcept.patch )
python_compile() {
if ! python_is_python3; then
local CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"