diff options
author | Johannes Schanda <schanda@itestra.de> | 2013-09-18 14:40:10 +0200 |
---|---|---|
committer | Johannes Schanda <schanda@itestra.de> | 2013-09-18 14:40:10 +0200 |
commit | 61229569bfcb6f053eb4b1bbf803881c6c9c0ed6 (patch) | |
tree | c32744956af34fc3985d46caf7d91f174f809e3c | |
parent | af283890f1fc388f3dd889df134a6c5fd7526b13 (diff) | |
download | genivi-common-api-runtime-61229569bfcb6f053eb4b1bbf803881c6c9c0ed6.tar.gz |
Make exceptions optional & fix incorrectly documented throw
-rw-r--r-- | src/CommonAPI/Runtime.h | 3 | ||||
-rw-r--r-- | src/CommonAPI/SerializableVariant.hpp | 5 | ||||
-rwxr-xr-x | src/test/VariantTest.cpp | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/CommonAPI/Runtime.h b/src/CommonAPI/Runtime.h index 0a93ccc..15fc05c 100644 --- a/src/CommonAPI/Runtime.h +++ b/src/CommonAPI/Runtime.h @@ -87,9 +87,6 @@ class Runtime { * @param middlewareIdOrAlias A well known name or an alias for a binding * * @return The runtime object for specified binding, or null if any error occurred. - * - * @throw std::invalid_argument if a path for this middlewareId has been configured, but no appropriate library - * could be found there. */ static std::shared_ptr<Runtime> load(const std::string& middlewareIdOrAlias); diff --git a/src/CommonAPI/SerializableVariant.hpp b/src/CommonAPI/SerializableVariant.hpp index 2919638..febff2d 100644 --- a/src/CommonAPI/SerializableVariant.hpp +++ b/src/CommonAPI/SerializableVariant.hpp @@ -453,8 +453,13 @@ const _Type & Variant<_Types...>::get() const { if (cType == valueType_) { return *(reinterpret_cast<const _Type *>(&valueStorage_)); } else { +#ifdef __EXCEPTIONS std::bad_cast toThrow; throw toThrow; +#else + printf("SerializableVariant.hpp:%i %s: Incorrect access to variant; attempting to get type not currently contained", __LINE__, __FUNCTION__); + abort(); +#endif } } diff --git a/src/test/VariantTest.cpp b/src/test/VariantTest.cpp index 8854951..ed793f5 100755 --- a/src/test/VariantTest.cpp +++ b/src/test/VariantTest.cpp @@ -103,8 +103,9 @@ TEST_F(VariantTest, VariantTestPack) { const int& myIntCopy2 = myVariantCopy2.get<int>(); EXPECT_EQ(myIntCopy2, fromInt); - +#ifdef __EXCEPTIONS EXPECT_ANY_THROW(const int& myFake = myVariant.get<double>()); +#endif EXPECT_TRUE(myVariant.isType<int>()); |