aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-01-09 07:57:32 -0500
committerJack Lloyd <[email protected]>2016-01-09 07:57:32 -0500
commit672d29570e55686b90126b5d6f5d337ddf0b8f04 (patch)
tree206459e94ab379ba18a8e8035b1855327aa02126
parent791b3dc9947a94d35e6d54b274b0512fb0ebd09c (diff)
parentf391635f202cf6f83539bd69688975a30f5f874f (diff)
Merge GH #403 add noreturn attribute on assertion failure func
-rw-r--r--src/build-data/buildh.in16
-rw-r--r--src/build-data/cc/gcc.txt2
-rw-r--r--src/lib/utils/assert.h2
3 files changed, 18 insertions, 2 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in
index a1febe102..42d5a1531 100644
--- a/src/build-data/buildh.in
+++ b/src/build-data/buildh.in
@@ -245,6 +245,22 @@ softare-based entropy polling is still used.
#endif
+#if !defined(BOTAN_NORETURN)
+
+ #if defined (__clang__) || defined (__GNUG__)
+ #define BOTAN_NORETURN __attribute__ ((__noreturn__))
+
+ #elif defined (_MSC_VER)
+ #define BOTAN_NORETURN __declspec(noreturn)
+
+ #else
+ #define BOTAN_NORETURN
+
+ #endif
+
+#endif
+
+
#if defined(_MSC_VER)
#define BOTAN_CURRENT_FUNCTION __FUNCTION__
#else
diff --git a/src/build-data/cc/gcc.txt b/src/build-data/cc/gcc.txt
index c507b6f02..b00f8bd31 100644
--- a/src/build-data/cc/gcc.txt
+++ b/src/build-data/cc/gcc.txt
@@ -8,7 +8,7 @@ add_lib_dir_option -L
add_lib_option -l
lang_flags "-std=c++11 -D_REENTRANT"
-maintainer_warning_flags "-Wold-style-cast -Werror -Wno-error=old-style-cast -Wno-error=zero-as-null-pointer-constant -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=strict-overflow -Wsuggest-override"
+maintainer_warning_flags "-Wold-style-cast -Werror -Wno-error=old-style-cast -Wno-error=zero-as-null-pointer-constant -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=strict-overflow -Wsuggest-override -Wsuggest-attribute=noreturn"
warning_flags "-Wall -Wextra -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor"
compile_flags "-c"
diff --git a/src/lib/utils/assert.h b/src/lib/utils/assert.h
index 97924174e..f80f9b170 100644
--- a/src/lib/utils/assert.h
+++ b/src/lib/utils/assert.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* Called when an assertion fails
*/
-void BOTAN_DLL assertion_failure(const char* expr_str,
+BOTAN_NORETURN void BOTAN_DLL assertion_failure(const char* expr_str,
const char* assertion_made,
const char* func,
const char* file,