SensorLib
0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
SensorLibExceptionFix.cpp
Go to the documentation of this file.
1
13
// Only activate this fix for Arduino nRF52 platforms with C++ exceptions disabled
14
#if defined(ARDUINO_ARCH_NRF52) && !defined(__cpp_exceptions)
15
16
#include <assert.h>
17
#include <cstdlib>
18
#include <new>
19
20
#pragma GCC diagnostic push
21
#pragma GCC diagnostic ignored "-Wpedantic"
22
23
namespace
std
24
{
34
__attribute__
((weak))
35
void
__throw_bad_function_call()
36
{
37
assert(
false
&&
"Attempted to call an empty std::function"
);
38
}
39
48
__attribute__
((weak))
49
void
__throw_length_error(
char
const
* msg)
50
{
51
// Use assert to indicate programming error
52
assert(
false
&& msg);
53
}
54
63
__attribute__
((weak))
64
void
__throw_out_of_range(
char
const
* msg)
65
{
66
assert(
false
&& msg);
67
}
68
69
const
nothrow_t nothrow{};
70
}
71
81
__attribute__
((weak))
82
void
*
operator
new
(std::size_t size,
const
std::nothrow_t &)
noexcept
83
{
84
return
malloc(size);
85
}
86
95
__attribute__
((weak))
96
void
operator
delete
(
void
* ptr,
const
std::nothrow_t &)
noexcept
97
{
98
free(ptr);
99
}
100
110
__attribute__
((weak))
111
void
*
operator
new
[](std::size_t size,
const
std::nothrow_t &)
noexcept
112
{
113
return
malloc(size);
114
}
115
124
__attribute__
((weak))
125
void
operator
delete
[](
void
* ptr,
const
std::nothrow_t &)
noexcept
126
{
127
free(ptr);
128
}
129
#pragma GCC diagnostic pop
130
131
#endif
// defined(ARDUINO_ARCH_NRF52) && !defined(__cpp_exceptions)
__attribute__
__attribute__((weak)) void setupPower()
Definition
qmi8658_pedometer.ino:102
src
SensorLibExceptionFix.cpp
Generated by
1.9.8