From 1c741016bf633242ade954feacf1fb11847b7437 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 10 Apr 2014 20:21:14 +0400 Subject: [PATCH] STM32 test: libstdc++ error handling workaround --- .../stm32/test_stm32f107/src/dummy.cpp | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/libuavcan_drivers/stm32/test_stm32f107/src/dummy.cpp b/libuavcan_drivers/stm32/test_stm32f107/src/dummy.cpp index e69de29bb2..9bc49289b2 100644 --- a/libuavcan_drivers/stm32/test_stm32f107/src/dummy.cpp +++ b/libuavcan_drivers/stm32/test_stm32f107/src/dummy.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2014 Pavel Kirienko + */ + +#include + +/* + * stdlibc++ workaround. + * Default implementations will throw, which causes code size explosion. + * These definitions override the ones defined in the stdlibc+++. + */ + +namespace std +{ + +void __throw_bad_exception() { std::abort(); } + +void __throw_bad_alloc() { std::abort(); } + +void __throw_bad_cast() { std::abort(); } + +void __throw_bad_typeid() { std::abort(); } + +void __throw_logic_error(const char*) { std::abort(); } + +void __throw_domain_error(const char*) { std::abort(); } + +void __throw_invalid_argument(const char*) { std::abort(); } + +void __throw_length_error(const char*) { std::abort(); } + +void __throw_out_of_range(const char*) { std::abort(); } + +void __throw_runtime_error(const char*) { std::abort(); } + +void __throw_range_error(const char*) { std::abort(); } + +void __throw_overflow_error(const char*) { std::abort(); } + +void __throw_underflow_error(const char*) { std::abort(); } + +void __throw_ios_failure(const char*) { std::abort(); } + +void __throw_system_error(int) { std::abort(); } + +void __throw_future_error(int) { std::abort(); } + +void __throw_bad_function_call() { std::abort(); } + +}