From c1c93501b0ec181bbe0070ba3b7cbd1a720cefd1 Mon Sep 17 00:00:00 2001 From: Euripedes Rocha Date: Thu, 5 Oct 2023 12:46:07 +0200 Subject: [PATCH] fix(asio): Removes esp_exception and make all examples to use exceptions The usage of esp_exception header defining the exception handler prevents users to customize the exception treatment. By removing it we allow users that want to run without exceptions to customize the behavior. --- .../examples/async_request/sdkconfig.defaults | 8 +++++ .../ssl_client_server/sdkconfig.defaults | 1 + .../tcp_echo_server/sdkconfig.defaults | 1 + .../udp_echo_server/sdkconfig.defaults | 1 + components/asio/port/include/esp_exception.h | 31 ------------------- 5 files changed, 11 insertions(+), 31 deletions(-) create mode 100644 components/asio/examples/async_request/sdkconfig.defaults delete mode 100644 components/asio/port/include/esp_exception.h diff --git a/components/asio/examples/async_request/sdkconfig.defaults b/components/asio/examples/async_request/sdkconfig.defaults new file mode 100644 index 000000000..94184e28c --- /dev/null +++ b/components/asio/examples/async_request/sdkconfig.defaults @@ -0,0 +1,8 @@ +CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 +CONFIG_COMPILER_CXX_EXCEPTIONS=y + +# +# Partition Table +# +# Leave some room for larger apps without needing to reduce other features +CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y diff --git a/components/asio/examples/ssl_client_server/sdkconfig.defaults b/components/asio/examples/ssl_client_server/sdkconfig.defaults index 30bba61d4..8dffe267d 100644 --- a/components/asio/examples/ssl_client_server/sdkconfig.defaults +++ b/components/asio/examples/ssl_client_server/sdkconfig.defaults @@ -2,6 +2,7 @@ CONFIG_ASIO_SSL_SUPPORT=y CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" +CONFIG_COMPILER_CXX_EXCEPTIONS=y # # Partition Table diff --git a/components/asio/examples/tcp_echo_server/sdkconfig.defaults b/components/asio/examples/tcp_echo_server/sdkconfig.defaults index b02a3a3ef..94184e28c 100644 --- a/components/asio/examples/tcp_echo_server/sdkconfig.defaults +++ b/components/asio/examples/tcp_echo_server/sdkconfig.defaults @@ -1,4 +1,5 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 +CONFIG_COMPILER_CXX_EXCEPTIONS=y # # Partition Table diff --git a/components/asio/examples/udp_echo_server/sdkconfig.defaults b/components/asio/examples/udp_echo_server/sdkconfig.defaults index b02a3a3ef..94184e28c 100644 --- a/components/asio/examples/udp_echo_server/sdkconfig.defaults +++ b/components/asio/examples/udp_echo_server/sdkconfig.defaults @@ -1,4 +1,5 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 +CONFIG_COMPILER_CXX_EXCEPTIONS=y # # Partition Table diff --git a/components/asio/port/include/esp_exception.h b/components/asio/port/include/esp_exception.h deleted file mode 100644 index 41cc99b13..000000000 --- a/components/asio/port/include/esp_exception.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef _ESP_EXCEPTION_H_ -#define _ESP_EXCEPTION_H_ - -// -// This exception stub is enabled only if exceptions are disabled in menuconfig -// -#if !defined(CONFIG_COMPILER_CXX_EXCEPTIONS) && defined (ASIO_NO_EXCEPTIONS) - -#include "esp_log.h" - -// -// asio exception stub -// -namespace asio { -namespace detail { -template -void throw_exception(const Exception &e) -{ - ESP_LOGE("esp32_asio_exception", "Caught exception: %s!", e.what()); - abort(); -} -} -} -#endif // CONFIG_COMPILER_CXX_EXCEPTIONS==1 && defined (ASIO_NO_EXCEPTIONS) - -#endif // _ESP_EXCEPTION_H_