diff options
author | Daniel Neus <[email protected]> | 2016-01-08 21:45:48 +0100 |
---|---|---|
committer | Daniel Neus <[email protected]> | 2016-01-08 21:45:48 +0100 |
commit | 401db82da42117744cede7ce1888d76f98072bcd (patch) | |
tree | 55c7c5d79152402afcebfeb927e61e8c9422a078 /src | |
parent | 805c391817f22681ca9f09d7b04475f7cd9d34e7 (diff) |
add BOTAN_NORETURN macro and mark those functions that do not return with it
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/buildh.in | 16 | ||||
-rw-r--r-- | src/build-data/cc/gcc.txt | 2 | ||||
-rw-r--r-- | src/lib/cert/x509/ocsp_types.h | 2 | ||||
-rw-r--r-- | src/lib/cert/x509/x509_ext.h | 4 | ||||
-rw-r--r-- | src/lib/tls/credentials_manager.h | 2 | ||||
-rw-r--r-- | src/lib/utils/assert.h | 2 | ||||
-rw-r--r-- | src/lib/utils/http_util/http_util.h | 2 |
7 files changed, 23 insertions, 7 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index a1febe102..66696de00 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 79c9ba5f4..322f59453 100644 --- a/src/build-data/cc/gcc.txt +++ b/src/build-data/cc/gcc.txt @@ -9,7 +9,7 @@ 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" -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" +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 -Wsuggest-attribute=noreturn" compile_flags "-c" debug_info_flags "-g" diff --git a/src/lib/cert/x509/ocsp_types.h b/src/lib/cert/x509/ocsp_types.h index 42a84c38b..233d0793d 100644 --- a/src/lib/cert/x509/ocsp_types.h +++ b/src/lib/cert/x509/ocsp_types.h @@ -50,7 +50,7 @@ class BOTAN_DLL SingleResponse : public ASN1_Object X509_Time next_update() const { return m_nextupdate; } - void encode_into(class DER_Encoder& to) const override; + void encode_into(class DER_Encoder& to) const override BOTAN_NORETURN; void decode_from(class BER_Decoder& from) override; private: diff --git a/src/lib/cert/x509/x509_ext.h b/src/lib/cert/x509/x509_ext.h index 0ce49231a..d47409c15 100644 --- a/src/lib/cert/x509/x509_ext.h +++ b/src/lib/cert/x509/x509_ext.h @@ -361,7 +361,7 @@ class BOTAN_DLL CRL_Distribution_Points : public Certificate_Extension class BOTAN_DLL Distribution_Point : public ASN1_Object { public: - void encode_into(class DER_Encoder&) const override; + void encode_into(class DER_Encoder&) const override BOTAN_NORETURN; void decode_from(class BER_Decoder&) override; const AlternativeName& point() const { return m_point; } @@ -387,7 +387,7 @@ class BOTAN_DLL CRL_Distribution_Points : public Certificate_Extension bool should_encode() const override { return !m_distribution_points.empty(); } - std::vector<byte> encode_inner() const override; + std::vector<byte> encode_inner() const override BOTAN_NORETURN; void decode_inner(const std::vector<byte>&) override; void contents_to(Data_Store&, Data_Store&) const override; diff --git a/src/lib/tls/credentials_manager.h b/src/lib/tls/credentials_manager.h index 96e840d13..23ae863b9 100644 --- a/src/lib/tls/credentials_manager.h +++ b/src/lib/tls/credentials_manager.h @@ -181,7 +181,7 @@ class BOTAN_DLL Credentials_Manager */ virtual SymmetricKey psk(const std::string& type, const std::string& context, - const std::string& identity); + const std::string& identity) BOTAN_NORETURN; }; } diff --git a/src/lib/utils/assert.h b/src/lib/utils/assert.h index 97924174e..8dc9f2b99 100644 --- a/src/lib/utils/assert.h +++ b/src/lib/utils/assert.h @@ -19,7 +19,7 @@ void BOTAN_DLL assertion_failure(const char* expr_str, const char* assertion_made, const char* func, const char* file, - int line); + int line) BOTAN_NORETURN; /** * Make an assertion diff --git a/src/lib/utils/http_util/http_util.h b/src/lib/utils/http_util/http_util.h index 6688285c6..766ea4f6c 100644 --- a/src/lib/utils/http_util/http_util.h +++ b/src/lib/utils/http_util/http_util.h @@ -64,7 +64,7 @@ std::string BOTAN_DLL http_transact_asio(const std::string& hostname, #endif std::string BOTAN_DLL http_transact_fail(const std::string& hostname, - const std::string& message); + const std::string& message) BOTAN_NORETURN; BOTAN_DLL Response http_sync(http_exch_fn fn, |