sci-electronics/klayout: Fix "error: throw will always call terminate()" (bug #612978)
authorPeter Levine <plevine457@gmail.com>
Tue, 21 Mar 2017 00:05:31 +0000 (20:05 -0400)
committerDavid Seifert <soap@gentoo.org>
Sun, 16 Apr 2017 18:57:14 +0000 (20:57 +0200)
Package-Manager: Portage-2.3.5, Repoman-2.3.2
Closes: https://github.com/gentoo/gentoo/pull/4267

sci-electronics/klayout/files/klayout-0.24.9-c++11-no-throw-in-destuctor.patch [new file with mode: 0644]
sci-electronics/klayout/klayout-0.24.9.ebuild

diff --git a/sci-electronics/klayout/files/klayout-0.24.9-c++11-no-throw-in-destuctor.patch b/sci-electronics/klayout/files/klayout-0.24.9-c++11-no-throw-in-destuctor.patch
new file mode 100644 (file)
index 0000000..4cb6473
--- /dev/null
@@ -0,0 +1,34 @@
+# Fixes "error: throw will always call terminate() [-Werror=terminate]". Gentoo bug 612978.
+
+--- a/src/tlAssert.h.old
++++ b/src/tlAssert.h
+@@ -27,6 +27,16 @@
+ 
+ #include "config.h"
+ 
++// For >=C++11, mark assertion_failed() with attribute [[noreturn]] and call std::terminate().
++// Or else, throw int(0) to tell the compiler that the assertion will not return.
++#if __cplusplus < 201103L
++#define ATTRIB_ASSERT KLAYOUT_DLL
++#define END_ASSERT throw int(0)
++#else
++#define ATTRIB_ASSERT [[noreturn]] KLAYOUT_DLL
++#define END_ASSERT std::terminate()
++#endif
++ 
+ namespace tl
+ {
+ 
+@@ -34,10 +44,10 @@
+  *  @brief The corresponding assert macro
+  */
+ 
+-KLAYOUT_DLL void assertion_failed (const char *filename, unsigned int line, const char *condition);
++ATTRIB_ASSERT void assertion_failed (const char *filename, unsigned int line, const char *condition);
+ 
+ //  the throw int(0) instruction will tell the compiler that the assertion will not return
+-#define tl_assert(COND) if (!(COND)) { tl::assertion_failed (__FILE__, __LINE__, #COND); throw int(0); }
++#define tl_assert(COND) if (!(COND)) { tl::assertion_failed (__FILE__, __LINE__, #COND); END_ASSERT; }
+ 
+ } // namespace tl
+ 
index ff57ef397746912577a695958bd858a6d7f198c6..8c7ca923bbd8a7710371ab7040f8e9b2b0749987 100644 (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
@@ -27,6 +27,8 @@ RDEPEND="
 DEPEND="${RDEPEND}"
 
 all_ruby_prepare() {
+       epatch "${FILESDIR}"/${P}-c++11-no-throw-in-destuctor.patch
+
        # now we generate the stub build configuration file for the home-brew build system
        cp "${FILESDIR}/${PN}-0.23.10-Makefile.conf.linux-gentoo" "${S}/config/Makefile.conf.linux-gentoo" || die
 }