2738 Commits

Author SHA1 Message Date
John Wellbelove
9f4e191235
Merge branch 'development' into optional_rule_of_zero 2026-05-06 18:56:24 +01:00
Roland Reichwein
079b3345d9
Various bugfixes (#1428)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-05-06 18:26:10 +01:00
Roland Reichwein
c9198d089c
Add format checks at compile time to format.h (#1419)
* Add format checks at compile time to format.h

* format.h: Refactor padding calculation

* format.h: Code cleanup
2026-05-06 10:16:20 +01:00
Roland Reichwein
a5d279d5e4
Fix sanitizer use (#1429)
* Fix sanitizer use

A case issue prevented adding sanitizer in the tests.

* Fix compiler warnings from actual sanitizer use
2026-05-06 10:13:02 +01:00
Roland Reichwein
e8206cca83
Remove unnecessary includes (#1434)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-05-06 09:10:10 +01:00
Roland Reichwein
4f411c66a9
Remove dead code (#1427)
Removing private class members, code unused by ETL in "private"
namespaces, code unreachable via preprocessor guards (C++11 inside
C++03).

For code still to be kept, even though unused at first sight, add
tests.
2026-05-03 22:49:02 +02:00
Sergei Shirokov
87c82254d5 coderabbitai review fixes. 2026-05-03 11:51:14 +03:00
Sergei Shirokov
e36b08cff5 Apply the rule of zero for etl::optional type.
Correct move behavior of `TestDataM` - it should preserve `valid` value.
Implemented overloads of `etl::make_optional` free function.
Extend optional moveable tests
- fundamental vs non-fundamental
- move construct/assign from valueless
- Verify nothrow of `etl::swap` for `etl::optional`.
2026-05-01 01:10:59 +03:00
Roland Reichwein
a2e274bbc5
Run C++26 workflows with docker (#1421)
Ubuntu 26.04 is not available in github workflows directly and won't be soon.
But ubuntu-26.04 is available as docker container. So use it for running
C++26 workflows which were disabled previously.
2026-04-30 12:27:12 +02:00
Roland Reichwein
943e8e6089
Add invocable and further missing concepts to concepts.h (#1412)
* Print test names at test time (#1343)

* Fix operator| conflict with std::ranges (#1395)

* Add concept invocable and further missing concepts to concepts.h

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-28 15:35:21 +02:00
Joris Putcuyps
15ca12649e
Global namespace bitset free functions cleanup (#1411)
* Print test names at test time (#1343)

* Fix operator| conflict with std::ranges (#1395)

* Keep comparison and swap free functions out of the global namespace and
let ADL do its thing.

* Apply the same global to etl namespace move on overlooked functions

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-28 14:13:55 +02:00
Roland Reichwein
ee0d4740b3
Add begin() and end() to etl::expected (#1410)
* Print test names at test time (#1343)

* Fix operator| conflict with std::ranges (#1395)

* Add begin() and end() to etl::expected

* Adding error_or() to etl::expected

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-28 11:43:54 +02:00
Roland Reichwein
fe7b2da10c
Fix missing tuple_size (#1407)
* Print test names at test time (#1343)

* Fix operator| conflict with std::ranges (#1395)

* Fix missing tuple_size

In case of certain clang versions, a wrong combination of activated
and deactivated template forward declarations and specializations
were provided.

This led to redefinition errors and specialization errors.

Now aligning those combinations, and providing definitions from
<utility> from std in the STL using case.

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-28 11:03:25 +02:00
Joris Putcuyps
5ccbc6fbff
Swap can be part of the etl namespace and let ADL do its thing (#1414)
* Print test names at test time (#1343)

* Fix operator| conflict with std::ranges (#1395)

* Swap can be part of the etl namespace and let ADL do its thing

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-28 10:23:52 +02:00
Roland Reichwein
ff772d4bd1
Move operators for etl::unique_ptr to etl namespace (#1408)
* Print test names at test time (#1343)

* Fix operator| conflict with std::ranges (#1395)

* Move operators for etl::unique_ptr to etl namespace

This is in accordance with the operators of std::unique_ptr. Also,
it doesn't pollute the global namespace, and also works together
with ADL, finding the operators in the etl namespace now.

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-28 09:57:21 +02:00
Joris Putcuyps
43e97b7f3c
Expected actually doesn't require a monostate. (#1413)
* Print test names at test time (#1343)

* Fix operator| conflict with std::ranges (#1395)

* Expected actually doesn't require a monostate.

* Better naming, since uninitialised isn't an option for expected.

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-28 09:30:23 +02:00
Roland Reichwein
fbd738db69
Replace deprecated builtin __is_trivially_relocatable if possible (#1402)
Fixes: #1400
2026-04-22 13:28:47 +02:00
Roland Reichwein
a97817010e
Make etl::variant and etl::vector methods noexcept (#1383)
* Print test names at test time (#1343)

* Fix operator| conflict with std::ranges (#1395)

* Make etl::optional, etl::variant and etl::vector methods noexcept

Adding type traits supporting the respective conditional noexcept

Fix missing etl::move() in etl::optional move constructors

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-22 12:37:53 +02:00
Roland Reichwein
b860326b26
Fix delegate not being cleared by assigning empty braces (#1401)
* Fix delegate not being cleared by assigning empty braces

Fixes issue #1399.

The non-capturing lambda support (PR#1295) added a non-explicit
delegate(function_ptr) constructor and operator=(function_ptr). This
caused `delegate = {}` to implicitly convert `{}` to a null function
pointer and bind it via function_ptr_stub, leaving the delegate
appearing valid (stub != nullptr) but invoking through a null pointer
(undefined behavior).

Fix:
- Mark delegate(function_ptr) constructor explicit to prevent implicit
  conversion from `{}` during initialization.
- In operator=(function_ptr), clear the delegate when fp is null
  instead of binding a null pointer through function_ptr_stub.

Added tests verifying that both `delegate d = {}` and `d = {}` produce
an invalid (cleared) delegate.

* Fix Dockerfile for powerpc cross build

Debian snapshot sources were mixed with plain sid sources which
mismatched after a while. Now, aligning all sources from snapshot
server.
2026-04-21 15:27:43 +02:00
Roland Reichwein
bbf74c5334
Optimize formatting in format.h for float values (#1379)
When formatting float, fix the -0.0 case

format.h float format: Fix rounding issues on all platforms
2026-04-19 13:19:53 +02:00
Roland Reichwein
ff65c753d6
Actually use ETL_USE_BUILTIN_MEM_FUNCTIONS to decide about macro defi… (#1398)
* Print test names at test time (#1343)

* Fix operator| conflict with std::ranges (#1395)

* Actually use ETL_USE_BUILTIN_MEM_FUNCTIONS to decide about macro definitions

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-18 17:13:43 +02:00
Roland Reichwein
5dc682b7ff
Support for C++26 (#1375)
Includes C++26 related infrastructure macros.
Fixes compile errors when compiling under C++26.
Initially supported C++26 features:

- [[indeterminate]]
- new 2022 ISO prefixes in ratio.h
- atomic fetch_max() and fetch_min()
- is_virtual_base_of
- is_trivially_relocatable and trivially_relocate
- saturation arithmetic: add_sat, sub_sat, mul_sat, div_sat, saturate_cast
2026-04-15 15:53:29 +02:00
Roland Reichwein
866c8a315e
Extensions for testing (#1380)
* Extensions for testing

Generalize run-tests.sh

Test all C++ versions at once

Fix combination of big endian and -Wsign-conversion

Failed on s390x (as reference for big endian)

Add github workflow for s390x

Add armhf container files

Devcontainers for i386 and riscv

Add github workflows for armhf, i386 and riscv64

Add run-tests.sh for foreign architectures

Document testing in doc/testing.md

Adjustments from clang-format run

Fix .devcontainer/s390x/Dockerfile for linebreak syntax

Fix exit code of run-test.sh

Previously, "exit $?" was used, actually the return value of
FailedCompilation and FailedTest which are always 0.

Now just using 1.

In run-tests.sh at ctest, use -V for printing number of tests unconditionally

While ctest suppresses individual test list by default, it didn't even
print the number of tests anymore, as run_tests.sh does because
it suppresses it output completely.

Now, by default print number of tests, and in verbose mode, print test list
in addition.

* Support powerpc as foreign architecture

* Add SFINAE constraints to etl::begin/end and reverse iterator free functions

The unconstrained etl::begin(), etl::end(), etl::cbegin(), etl::cend(),
etl::rbegin(), etl::rend(), etl::crbegin(), and etl::crend() templates
in the no-STL code path were matching iterator types during ADL, causing
a hard error with GCC 15's std::ranges::begin. When std::ranges performed
ADL on an etl::*::iterator, it found etl::begin() as a candidate; since
the iterator type has a nested iterator typedef, the return type TContainer::iterator
was valid, but calling .begin() on the iterator failed.

Fix: add etl::void_t<decltype(...)> SFINAE guards to each template,
ensuring they only participate in overload resolution when TContainer
actually has the corresponding member function (.begin(), .end(), etc.).

* - Fix red unit tests on 32 bits big-endian platform.

* Document powerpc architecture for testing

* Use Dockerfiles in cross testing github workflows

Synchronizes environment setup for github workflows to what is
defined in the development Dockerfiles. So they don't need to
be maintained separately.

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Sergei Shirokov <sergej.shirokov@gmail.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-15 10:47:52 +02:00
Roland Reichwein
17799452d2
Add missing syntax checks (#1381)
* Fix run-syntax-checks.sh to run with bash

Contains bash specific syntax, and sync with the other *.sh files
in this directory.

* Add missing header file adaptors to the directory and CMakeLists.txt

* run-syntax-checks.sh without ETL_IN_UNIT_TEST

* Fix usage of make_unsigned

* Removing crc.h from syntax checks because of redundancy

* Remove ETL_USING_CPP11 from unit tests

Unit tests are always run with at least C++11.

* Add missing copyright header in test_manchester.cpp

* Fixed usage of ETL_DEPRECATED_REASON(), wrong syntax by order

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-15 10:09:28 +02:00
Roland Reichwein
29d0cfec7c
Suppress false positive compiler warnings when compiling with -O3 (#1389)
* Print test names at test time (#1343)

* Suppress false positive compiler warnings when compiling with -O3

The CI checks currently only check everything with -O0. Wenn activating
higher optimization levels, more warnings kick in. Leading to errors,
depending on the configuration.

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-14 12:38:59 +02:00
Roland Reichwein
f258fe4af8 Fix operator| conflict with std::ranges (#1395) 2026-04-14 12:00:37 +02:00
Roland Reichwein
b14f70698f
Fix chrono.h year_month_weekday_last and year_month_weekday sysdays() (#1396)
* Print test names at test time (#1343)

* Fix chrono.h year_month_weekday_last and year_month_weekday sysdays()

Bug 1: year_month_weekday_last::operator sys_days() — wrong weekday construction

The code was constructing a weekday from a raw day count using weekday(unsigned),
which treats the value as a weekday encoding (0–6). The fix uses weekday(sys_days),
which correctly accounts for the epoch being a Thursday (+4 offset).

Bug 2: year_month_weekday::operator sys_days() — same wrong weekday
construction + off-by-one in day_of_month

Same weekday(unsigned) vs weekday(sys_days) issue. Additionally, the day_of_month
calculation was missing the 1 + base — it computed a 0-based offset from day 1,
but forgot to add the 1 back when converting to an actual day number.

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-14 11:48:03 +02:00
Roland Reichwein
f118c2807a
Fix broken syntax from clang-format reformat (#1385)
* Print test names at test time (#1343)

* Fix broken syntax from clang-format reformat

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-11 10:16:03 +02:00
Roland Reichwein
ae6ca929c1
Rename _current to _current_it in ranges.h (#1387)
* Print test names at test time (#1343)

* Rename _current to _current_it in ranges.h

Resolves conflict with _current macro from Zephyr and improves
self-explanation of variable.

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-11 10:10:17 +02:00
John Wellbelove
7971824914
Add the ability to specify the callback type to etl closure (#1393)
* Print test names at test time (#1343)

* Modified closure to accept the callback type as a template parameter

* Modified closure to accept the callback type as a template parameter

* Applied clang-format

* Fixed C++03 compatibility

* Fixed C++03 compatibility

# Conflicts:
#	include/etl/closure.h

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
2026-04-09 07:21:19 +01:00
John Wellbelove
1a6762d6c3 Updated version and release notes 2026-04-05 14:13:22 +01:00
Roland Reichwein
3cd03fcb7f
Fix initializer_list use in algorithm.h and definition of data() in iterator.h (#1374)
* Print test names at test time (#1343)

* Fix initializer_list use in algorithm.h

Needs to be conditional.

* Move definition of data() in iterator.h

Needs to be defined earlier.

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
2026-04-05 13:37:15 +01:00
John Wellbelove
e2bed92814 Updated version and release notes 2026-04-04 09:40:46 +01:00
John Wellbelove
576b03f38d Merged from local copy of PR1295 2026-04-04 00:14:49 +01:00
John Wellbelove
e61589ebf2 Merge branch 'development' into delegate-from-non-capturing-lambda
# Conflicts:
#	include/etl/private/delegate_cpp11.h
#	test/test_delegate.cpp
2026-04-03 20:08:41 +01:00
Maksim Danilov
823f2493b4
Rename 'leaf' to 'child' in intrusive_links.h (#1373)
* Print test names at test time (#1343)

* Rename 'leaf' to 'child' in intrusive_links.h

Recent versions of the Tasking TriCore compiler treat
'leaf' as a reserved C++ keyword, causing compilation failures in ETL.

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Maksim Danilov <maksim.danilov@accenture.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-03 17:35:41 +01:00
John Wellbelove
f5128a39fe Attempt to fix syntax that comfuse clang-format 2026-04-03 13:58:19 +01:00
John Wellbelove
01066b86ae Attempt to fix syntax that comfuse clang-format 2026-04-03 12:31:51 +01:00
John Wellbelove
aeb8e4f734 Formatted source files 2026-04-02 14:11:45 +01:00
John Wellbelove
bd1def8b41 Used the correct macro for 'if constexpr' 2026-04-02 10:35:49 +01:00
John Wellbelove
9d2c73793d Ran clang-format on generated files, using the .clang-format from PR #1314 2026-04-01 13:33:18 +01:00
John Wellbelove
ea397ec2dd Changed non-capturing lambda API to runtime function pointer API 2026-03-31 21:27:44 +02:00
John Wellbelove
a483eb90c4 Fixed generator_test.py
Updated generator files in the VS2022 project
Adde licence headers to the generator headers
2026-03-31 19:11:02 +01:00
Roland Reichwein
d17c0297ec
Factor out generated code (#1369)
Previously, generator code under include/etl/generators needed to be
synchronized with the generated files under include/etl explicitly.
Leading to errors in the CI checks if forgotten.

This change separates out the generated parts to cpp03 specific
snippets. This way, most code under include/etl is now directly editable,
with only some pre-C++11 code separated out to
include/etl/generators/*_cpp03_generator.h which still needs to be
re-generated on respective changes. But in many cases, this is not necessary.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-31 16:36:54 +01:00
John Wellbelove
3d564d68b9 Fixed sign conversion in advance_helper 2026-03-30 19:34:15 +01:00
John Wellbelove
e4dfb6c045 Fixed iterator.h #if #else #endif
Fixed type_lookup_generator to match genereted
2026-03-30 19:06:07 +01:00
John Wellbelove
95c9cabc10 Fix for PR 1367 2026-03-28 20:37:03 +00:00
John Wellbelove
3638d89f8b Fix for PR 1367 2026-03-28 13:50:27 +00:00
John Wellbelove
03ca3c817e Fix for PR 1367 2026-03-28 12:03:12 +00:00
Roland Reichwein
b83cef5668
Fix compilation with -Wsign-conversion (#1367)
* Fix compilation with -Wsign-conversion

For tests with GCC and Clang

Fixes https://github.com/ETLCPP/etl/issues/632

* Fix support of negative Id in type_lookup.h: type_from_id

* Fix element access arithmetic in atomic_gcc_sync.h fetch_add/fetch_sub

* Fix rounded_integral_division.h: divide_round_half_odd(): direction is always 1
2026-03-28 11:15:56 +00:00