diff options
author | Pierre Langlois <pierre.langlois@arm.com> | 2018-05-22 15:01:58 +0100 |
---|---|---|
committer | Pierre Langlois <pierre.langlois@arm.com> | 2018-05-24 14:52:41 +0100 |
commit | 4df1551659351b11606ba43ef0b90d0139d610cb (patch) | |
tree | 582d5a8c9863caa70bd75079fb4862765ab295a3 | |
parent | f59ce7c79090ebf895230f5fa4b3ec22d8cf0986 (diff) |
Fix exception related warnings introduced by GCC 8.
C++11 deprecated the use of `throw(id)` in signatures, let's just remove
it. Negative testing still works in C++98 where using `throw(id)` is allowed so
it isn't useful to conditionally add it for previous versions C++.
Additionally, GCC now warns by default if an exception is caught by value when
its type is polymorphic (-Wcatch-value).
Change-Id: I7d68c82935b4796dd0fc449228ae8df4f548574d
-rw-r--r-- | examples/aarch32/custom-aarch32-disasm.cc | 2 | ||||
-rw-r--r-- | src/aarch32/location-aarch32.h | 2 | ||||
-rw-r--r-- | src/globals-vixl.h | 2 | ||||
-rw-r--r-- | src/pool-manager.h | 3 | ||||
-rw-r--r-- | test/aarch32/config/template-assembler-negative-aarch32.cc.in | 2 | ||||
-rw-r--r-- | test/aarch32/test-assembler-aarch32.cc | 4 | ||||
-rw-r--r-- | test/aarch32/test-assembler-negative-cond-rd-rn-operand-rm-shift-rs-a32.cc | 2 | ||||
-rw-r--r-- | test/aarch32/test-disasm-a32.cc | 4 | ||||
-rw-r--r-- | test/test-aborts.cc | 2 | ||||
-rw-r--r-- | test/test-pool-manager.cc | 5 |
10 files changed, 10 insertions, 18 deletions
diff --git a/examples/aarch32/custom-aarch32-disasm.cc b/examples/aarch32/custom-aarch32-disasm.cc index 95591c94..e4df9ff3 100644 --- a/examples/aarch32/custom-aarch32-disasm.cc +++ b/examples/aarch32/custom-aarch32-disasm.cc @@ -101,7 +101,7 @@ class NamedLabel : public Label { public: NamedLabel(CustomStream* stream, const char* name) : stream_(stream), name_(name) {} - ~NamedLabel() VIXL_THROW_IN_NEGATIVE_TESTING_MODE(std::runtime_error) { + ~NamedLabel() { if (IsBound()) { stream_->GetSymbols().insert( std::pair<Location::Offset, const char*>(GetLocation(), name_)); diff --git a/src/aarch32/location-aarch32.h b/src/aarch32/location-aarch32.h index bf62a313..0f29a6c6 100644 --- a/src/aarch32/location-aarch32.h +++ b/src/aarch32/location-aarch32.h @@ -63,7 +63,7 @@ class Location : public LocationBase<int32_t> { typedef int32_t Offset; - ~Location() VIXL_THROW_IN_NEGATIVE_TESTING_MODE(std::runtime_error) { + ~Location() { #ifdef VIXL_DEBUG if (IsReferenced() && !IsBound()) { VIXL_ABORT_WITH_MSG("Location, label or literal used but not bound.\n"); diff --git a/src/globals-vixl.h b/src/globals-vixl.h index 4a82f8e3..1a71c249 100644 --- a/src/globals-vixl.h +++ b/src/globals-vixl.h @@ -117,7 +117,6 @@ struct Unsigned<64> { throw std::runtime_error(oss.str()); \ } \ } while (false) -#define VIXL_THROW_IN_NEGATIVE_TESTING_MODE(error) throw(error) #else #define VIXL_ABORT() \ do { \ @@ -139,7 +138,6 @@ struct Unsigned<64> { abort(); \ } \ } while (false) -#define VIXL_THROW_IN_NEGATIVE_TESTING_MODE(error) #endif #ifdef VIXL_DEBUG #define VIXL_ASSERT(condition) VIXL_CHECK(condition) diff --git a/src/pool-manager.h b/src/pool-manager.h index c3596de0..b5cb867b 100644 --- a/src/pool-manager.h +++ b/src/pool-manager.h @@ -142,8 +142,7 @@ class LocationBase { is_bound_(true), location_(location) {} - virtual ~LocationBase() - VIXL_THROW_IN_NEGATIVE_TESTING_MODE(std::runtime_error) {} + virtual ~LocationBase() {} // The PoolManager should assume ownership of some objects, and delete them // after they have been placed. This can happen for example for literals that diff --git a/test/aarch32/config/template-assembler-negative-aarch32.cc.in b/test/aarch32/config/template-assembler-negative-aarch32.cc.in index e89fa54d..1c6d4918 100644 --- a/test/aarch32/config/template-assembler-negative-aarch32.cc.in +++ b/test/aarch32/config/template-assembler-negative-aarch32.cc.in @@ -100,7 +100,7 @@ void TestHelper(Fn instruction, const char* mnemonic) { __LINE__, masm.IsUsingT32() ? "T32" : "A32"); abort(); - } catch (std::runtime_error) { + } catch (const std::runtime_error&) { // Nothing to do, test passed. // TODO: Consider checking the error message here, if possible. } diff --git a/test/aarch32/test-assembler-aarch32.cc b/test/aarch32/test-assembler-aarch32.cc index eb2a40d9..83134e61 100644 --- a/test/aarch32/test-assembler-aarch32.cc +++ b/test/aarch32/test-assembler-aarch32.cc @@ -6501,7 +6501,7 @@ TEST_T32(assembler_bind_label) { masm.ASM; \ printf("Negative test for forward reference failed for %s.\n", INST); \ abort(); \ - } catch (std::runtime_error) { \ + } catch (const std::runtime_error&) { \ } \ try { \ ExactAssemblyScope scope(&masm, \ @@ -6515,7 +6515,7 @@ TEST_T32(assembler_bind_label) { masm.ASM; \ printf("Negative test for forward reference failed for %s.\n", INST); \ abort(); \ - } catch (std::runtime_error) { \ + } catch (const std::runtime_error&) { \ } #else #define NEGATIVE_TEST_FORWARD_REFERENCE_INFO(INST, ASM) diff --git a/test/aarch32/test-assembler-negative-cond-rd-rn-operand-rm-shift-rs-a32.cc b/test/aarch32/test-assembler-negative-cond-rd-rn-operand-rm-shift-rs-a32.cc index 165b0113..c18197dc 100644 --- a/test/aarch32/test-assembler-negative-cond-rd-rn-operand-rm-shift-rs-a32.cc +++ b/test/aarch32/test-assembler-negative-cond-rd-rn-operand-rm-shift-rs-a32.cc @@ -3136,7 +3136,7 @@ void TestHelper(Fn instruction, const char* mnemonic) { __LINE__, masm.IsUsingT32() ? "T32" : "A32"); abort(); - } catch (std::runtime_error) { + } catch (const std::runtime_error&) { // Nothing to do, test passed. // TODO: Consider checking the error message here, if possible. } diff --git a/test/aarch32/test-disasm-a32.cc b/test/aarch32/test-disasm-a32.cc index db2902e6..efc997ff 100644 --- a/test/aarch32/test-disasm-a32.cc +++ b/test/aarch32/test-disasm-a32.cc @@ -99,7 +99,7 @@ namespace aarch32 { abort(); \ } \ } \ - catch (std::runtime_error e) { \ + catch (const std::runtime_error& e) { \ const char* msg = e.what(); \ printf("\n%s:%d:%s\nFound:\n%sExpected:\n%s", \ __FILE__, \ @@ -212,7 +212,7 @@ namespace aarch32 { printf("Found:\n%sExpected:\n%s", ss.str().c_str(), EXP); \ abort(); \ } \ - } catch (std::runtime_error e) { \ + } catch (const std::runtime_error& e) { \ const char* msg = e.what(); \ size_t exp_len = strlen(EXP); \ if (TEMPORARILY_ACCEPTED) { \ diff --git a/test/test-aborts.cc b/test/test-aborts.cc index b939c0a8..6360de42 100644 --- a/test/test-aborts.cc +++ b/test/test-aborts.cc @@ -43,7 +43,7 @@ namespace vixl { code; \ printf("\n%s:%d\nNo exception raised.\n", __FILE__, __LINE__); \ abort(); \ - } catch (std::runtime_error e) { \ + } catch (const std::runtime_error& e) { \ size_t prefix_length = strlen(expected_prefix); \ if (strncmp(expected_prefix, e.what(), prefix_length) != 0) { \ printf("\n%s:%d\nFound:\n%sExpected:\n%s...\n", \ diff --git a/test/test-pool-manager.cc b/test/test-pool-manager.cc index 47a9d59f..80680e02 100644 --- a/test/test-pool-manager.cc +++ b/test/test-pool-manager.cc @@ -91,8 +91,6 @@ class TestObject : public LocationBase<int32_t> { TestObject(int size, int alignment, int id = 0) : LocationBase(0 /*type*/, size, alignment), id_(id) {} - ~TestObject() VIXL_THROW_IN_NEGATIVE_TESTING_MODE(std::runtime_error) {} - void EmitPoolObject(MacroAssemblerInterface *masm) VIXL_OVERRIDE { USE(masm); } @@ -146,9 +144,6 @@ class TestBranchObject : public LocationBase<int32_t> { TestBranchObject(int size, int alignment, int id = 0) : LocationBase(1 /* type */, size, alignment), id_(id) {} - ~TestBranchObject() VIXL_THROW_IN_NEGATIVE_TESTING_MODE(std::runtime_error) {} - - bool UsePoolObjectEmissionMargin() const VIXL_OVERRIDE { return true; } int32_t GetPoolObjectEmissionMargin() const VIXL_OVERRIDE { return 1 * KBytes; |