From feeb0d480aded01f60a1e0c932828efb66753068 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 6 Jul 2025 20:24:19 +0100 Subject: [PATCH] Fixed C++03 compatibility Added syntax checks for closure.h --- include/etl/closure.h | 10 +++++----- test/syntax_check/CMakeLists.txt | 1 + test/syntax_check/closure.h.t.cpp | 29 +++++++++++++++++++++++++++++ test/vs2022/etl.vcxproj | 20 ++++++++++++++++++++ test/vs2022/etl.vcxproj.filters | 10 ++++++++-- 5 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 test/syntax_check/closure.h.t.cpp diff --git a/include/etl/closure.h b/include/etl/closure.h index bc437a33..dac6753c 100644 --- a/include/etl/closure.h +++ b/include/etl/closure.h @@ -86,7 +86,7 @@ namespace etl class closure { public: - using fct = etl::delegate; + typedef etl::delegate fct; closure(fct const& f, Arg0 const arg0) : m_f(f), m_arg0(arg0) @@ -106,7 +106,7 @@ namespace etl class closure { public: - using fct = etl::delegate; + typedef etl::delegate fct; closure(fct const& f, Arg0 const arg0, Arg1 const arg1) : m_f(f), m_arg0(arg0), m_arg1(arg1) @@ -127,7 +127,7 @@ namespace etl class closure { public: - using fct = etl::delegate; + typedef etl::delegate fct; closure(fct const& f, Arg0 const arg0, Arg1 const arg1, Arg2 const arg2) : m_f(f), m_arg0(arg0), m_arg1(arg1), m_arg2(arg2) @@ -149,7 +149,7 @@ namespace etl class closure { public: - using fct = etl::delegate; + typedef etl::delegate fct; closure(fct const& f, Arg0 const arg0, Arg1 const arg1, Arg2 const arg2, Arg3 const arg3) : m_f(f), m_arg0(arg0), m_arg1(arg1), m_arg2(arg2), m_arg3(arg3) @@ -172,7 +172,7 @@ namespace etl class closure { public: - using fct = etl::delegate; + typedef etl::delegate fct; closure(fct const& f, Arg0 const arg0, Arg1 const arg1, Arg2 const arg2, Arg3 const arg3, Arg4 const arg4) : m_f(f), m_arg0(arg0), m_arg1(arg1), m_arg2(arg2), m_arg3(arg3), m_arg4(arg4) diff --git a/test/syntax_check/CMakeLists.txt b/test/syntax_check/CMakeLists.txt index 29cc08dd..6892d139 100644 --- a/test/syntax_check/CMakeLists.txt +++ b/test/syntax_check/CMakeLists.txt @@ -99,6 +99,7 @@ target_sources(tests PRIVATE chrono.h.t.cpp circular_buffer.h.t.cpp circular_iterator.h.t.cpp + closure.h.t.cpp combinations.h.t.cpp compare.h.t.cpp constant.h.t.cpp diff --git a/test/syntax_check/closure.h.t.cpp b/test/syntax_check/closure.h.t.cpp new file mode 100644 index 00000000..08353648 --- /dev/null +++ b/test/syntax_check/closure.h.t.cpp @@ -0,0 +1,29 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2025 John Wellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#include diff --git a/test/vs2022/etl.vcxproj b/test/vs2022/etl.vcxproj index 4884f8ed..a4c56b64 100644 --- a/test/vs2022/etl.vcxproj +++ b/test/vs2022/etl.vcxproj @@ -3288,6 +3288,7 @@ + @@ -4759,6 +4760,24 @@ true true + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true true @@ -9271,6 +9290,7 @@ + diff --git a/test/vs2022/etl.vcxproj.filters b/test/vs2022/etl.vcxproj.filters index 00d27413..351b7740 100644 --- a/test/vs2022/etl.vcxproj.filters +++ b/test/vs2022/etl.vcxproj.filters @@ -1515,6 +1515,9 @@ ETL\Containers + + ETL\Utilities + @@ -3596,8 +3599,11 @@ Tests\Chrono - - Tests\Containers + + Tests\Callbacks & Delegates + + + Tests\Syntax Checks\Source