mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-22 18:38:37 +00:00
[C++]: wrapper functions around unwind code
* Replaced all C++ exception related functions with wrappers if -fno-exception is used. This prevents linking of the corresponding code in libgcc. The code size will decrease by around 7-9 KB when building with -fno-exception. * added no except test app Closes https://github.com/espressif/esp-idf/pull/5380 Closes https://github.com/espressif/esp-idf/issues/5363 Closes https://github.com/espressif/esp-idf/issues/5224 Closes IDFGH-3153 Closes IDF-2577
This commit is contained in:
27
tools/test_apps/system/cxx_no_except/main/main.cpp
Normal file
27
tools/test_apps/system/cxx_no_except/main/main.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
No except example.
|
||||
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include "esp_system.h"
|
||||
#include <new>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
extern "C" void app_main()
|
||||
{
|
||||
char *char_array = new (std::nothrow) char [47];
|
||||
|
||||
for (int i = 10; i >= 0; i--) {
|
||||
char_array[i] = i;
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
esp_restart();
|
||||
|
||||
delete [] char_array;
|
||||
}
|
Reference in New Issue
Block a user