Skip to content

Commit 16d4a1f

Browse files
committed
Disable runtime type information and exceptions
1 parent d91aa1a commit 16d4a1f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/TinyVec.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "Common.h"
4+
#include "Logging.h"
45

56
#include <cstdint>
67
#include <cstdlib>
@@ -69,10 +70,10 @@ class TinyVec {
6970
void reserve(SizeType new_cap)
7071
{
7172
if (new_cap <= _cap) return;
72-
if (sizeof(T) && new_cap > std::numeric_limits<SizeType>::max() / sizeof(T)) throw std::bad_alloc();
73+
if (sizeof(T) && new_cap > std::numeric_limits<SizeType>::max() / sizeof(T)) OS_PANIC_INSTANT("TVEC", "Cannot allocate a buffer of given size!");
7374

7475
void* newbuf = malloc(size_t(new_cap) * sizeof(T));
75-
if (!newbuf) throw std::bad_alloc();
76+
if (!newbuf) OS_PANIC_INSTANT("TVEC", "Could not allocate a buffer of given size!");
7677
if (_data) {
7778
memcpy(newbuf, _data, size_t(_len) * sizeof(T));
7879
free(_data);

platformio.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ framework = arduino
1717
build_flags =
1818
-std=c++2a
1919
-std=gnu++2a
20+
-fno-exceptions
21+
-fno-rtti
2022
-Wall
2123
-Wextra
2224
;-Wpedantic

0 commit comments

Comments
 (0)