forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sci-electronics/klayout: Fix "error: throw will always call terminate…
…()" (bug #612978) Package-Manager: Portage-2.3.5, Repoman-2.3.2 Closes: gentoo#4267
- Loading branch information
1 parent
97ac77b
commit 7ad2c40
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
sci-electronics/klayout/files/klayout-0.24.9-c++11-no-throw-in-destuctor.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters