123 Commits

Author SHA1 Message Date
christophcrruething
ef2be90f37 Add constexpr to trivial Atomics
According to https://en.cppreference.com/cpp/atomic/atomic/atomic the constructors of atomics should be constexpr. This change marks (at least for the trivial types) the constructor as constexpr.
2026-06-05 15:55:01 +02:00
John Wellbelove
aeb8e4f734 Formatted source files 2026-04-02 14:11:45 +01:00
Christoph Rüthing
237d83c107
Add pre C++20 Support for ETL_CONSTINIT using Compiler Extensions (#1335)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-12 19:47:39 +00:00
John Wellbelove
8a61985ac8
span is constructible from temporary (#1338)
* Added missing files from VS2022 project

* Added global data() overloads to complement etl::size()

* Added C++03 compatible implementation of etl::is_convertible

* Updated etl::span to more closely align with std::span

* Fix etl::rotate (#1327)

Per the C++ standard, std::rotate returns first + (last - middle):

* When first == middle, return last
* When middle == last, return first

* Fix greater_equal and less_equal (#1331)

* Align comparison operators (#1330)

In functional.h, the comparison operators for equal_to and not_equal_to
mismatch between the actual comparison execution and the type inference
for the return type. This change adjusts it by using the same operator==()
in the return type inference as used in the comparison execution.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

* Add missing tests (#1321)

* Add missing tests

* Typo fixes

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

* Add ETL_FORMAT_NO_FLOATING_POINT control macro for etl::format (#1329)

When ETL_FORMAT_NO_FLOATING_POINT is defined, all floating-point formatting support (float, double, long double) is excluded from etl::format. This reduces code size on targets that do not require floating-point formatting.

Guarded sections:

- #include <cmath>

- float/double/long double in supported_format_types variant

- float/double/long double constructors in basic_format_arg

- format_floating_* functions and format_aligned_floating

- formatter<float>, formatter<double>, formatter<long double>

- Floating-point test cases in test_format.cpp

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
# Conflicts:
#	include/etl/platform.h

* Manchester documentation (#1325)

* manchester
* Added manchester code and test

* manchester
* Formatting and added missing file

* manchester
* Some functions can only be constexpr since C++14

* manchester
* Manchester decode and some refactoring

* manchester
* Added some missing typenames

* manchester
* constexpr void function not allowed in C++11

* manchester
* condition on static_assert tests

* manchester
* revert CMakeLists.txt
* Using ETL_STATIC_ASSERT
* Some cleanup

* manchester
* Added static_assert message

* manchester
* Added compile time tests

* manchester
* Added invert manchester
* Some refactoring

* manchester
* Disable test for now
* Move ETL_NODISCARD before static

* manchester
* Test for valid_span

* manchester
* Remove redundant (?) storage specifiers for template specializations. Storage specifier already given in base template

* manchester
* refactoring to get rid of specialized template functions in template class

* manchester
* cleanup

* manchester
* Added documentation comments
* Some refactoring

* manchester
* introducing namespace detail_manchester

* manchester
* Some refactoring
* Update tests

* manchester
* Some refactoring
* Removed possible undefined behavior by refactoring encode_span
* constexpr version of encode_span
* Static assertion for rare case where code doesn't work because CHAR_BIT is not the same as the number of bits in uint_least8_t

* manchester
* renamed valid to is_valid

* manchester
* renamed is_valid_span to is_valid
* Using etl exceptions in ETL_ASSERT

* manchester
* Removed _fast functions
* merged encode_in_place with encode and decode_in_place with decode
* removed _span to create normal overloads of encode and decode for span
* Some renaming and minor refactoring

* manchester
* Fix build issues

* manchester
* Conditionally compile manchester_decoded

* Update test_manchester.cpp

Removed redundant semicolon

* #1258 Manchester coding
* Formatting
* consistency: hex literals with lower case 0x

* #1258 Manchester coding
* Moved copyright to top of file
* Make constexpr encode/decode span functions equal for little and big endian platforms

* #1258 Manchester coding
* Added missing include
* Added missing 8bit/64bit guards
* Fixed is_valid for big endian platforms

* #1258 Manchester coding
* private memcpy alias

* #1258 Manchester coding
* Review comments

* #1258 Manchester coding
* Cleanup
* Fix build error

* #1258 Manchester coding
* Add manchester documentation

* #1258 Manchester coding
* Preparation for GitHub pages

* #1324 Manchester documentation
* Some small fixes

---------

Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>

* Moved and split has_size_and_data in span.h to has_size & has_data in type_traits.h

* Removed has_size_and_data traits, and move to type_traits.h

Added ETL_ASSERT for for fixed extent constructors from iterator range and begin/size

* Added macro ETL_NOEXCEPT_IF that takes a compile time boolean expression

* Changed two fixed span constructors to ETL_CONSTEXPR14 due to ETL_ASSERT in the constructor bodies

Added ETL_NOEXCEPT_IF for simpler boolean conditions
Added tests for construction from mismatched sizes

* Added definition for ETL_NOEXCEPT_IF in no C++11 path

* Changes  to disable construction from rvalue temporaries

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Niu Zhihong <zhihong@nzhnb.com>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: Timon Zijnge <47081647+tzijnge@users.noreply.github.com>
Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>
2026-03-12 17:08:02 +00:00
Niu Zhihong
8ce59792fd
Add ETL_FORMAT_NO_FLOATING_POINT control macro for etl::format (#1329)
When ETL_FORMAT_NO_FLOATING_POINT is defined, all floating-point formatting support (float, double, long double) is excluded from etl::format. This reduces code size on targets that do not require floating-point formatting.

Guarded sections:

- #include <cmath>

- float/double/long double in supported_format_types variant

- float/double/long double constructors in basic_format_arg

- format_floating_* functions and format_aligned_floating

- formatter<float>, formatter<double>, formatter<long double>

- Floating-point test cases in test_format.cpp

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-06 22:04:32 +00:00
Drew Rife
4cf97675bd Add ref-qualifiers to basic_format_spec (#1292)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* feat: use ref-qualifiers for basic_format_spec

Converted the l-value methods to ref-qualified and also added r-value ref-qualified methods.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-09 11:07:12 +00:00
Christoph Rüthing
b2a4b4410c Spare more Resources for non-verbose Errors (#1214)
* Spare more Resources for non-verbose Errors

At the moment we only remove the __FILE__ in case ETL_VERBOSE_ERRORS is
not set. However, we also want to remove the error text which can
consume quite some resources and without the file name the line number
is also not very useful.

* Introduce separate ETL_MINIMAL_ERRORS to keep backwards compatability

To not break runtime backwards compatability, instead of removing the
text in case of ETL_VERBOSE_ERRORS not defined, we introduce a second
flag ETL_MINIMAL_ERRORS which is mutually exclusive. The semantic is as
follows:

- ETL_VERBOSE_ERRORS: We use verbose text, file names and line numbers.
- ETL_MINIMAL_ERRORS: We do not use anything.
- ETL_VERBOSE_ERRORS and ETL_MINIMAL_ERRORS: Issue an error.
- non defined: We use terse text without file names nor line numbers.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-12-22 10:04:12 +00:00
Iványi Béla
0d792ef13b Exception std based option (#1232)
* Add ability to derive etl::exception from std::exception

* Only add test for exception std base when using STL

* Use ETL_NOEXCEPT macro to define a function as noexcept

* Rename macro to keep in line with common style

* Add using_std_exception to etl::traits

---------

Co-authored-by: Béla Iványi <bela.ivanyi@idata.hu>
2025-12-22 10:04:07 +00:00
John Wellbelove
31b658ba81 Improve implementation of traits for functions 2025-12-08 09:11:25 +00:00
John Wellbelove
27a19f5c52 Restore ETL_NOEXCEPT_FROM missing from merges 2025-10-04 08:02:17 +01:00
John Wellbelove
d0feb3d175 Added and fixed noexcept attributes
Added ETL_NOEXCEPT_FROM to set noexcept attributes based on an object or function.

# Conflicts:
#	include/etl/platform.h
2025-10-03 10:49:43 +01:00
John Wellbelove
b90bcaaaab Minor layout changes 2025-10-03 10:49:25 +01:00
David Ockey
0323dabeff Added conditional support of noexcept to fix IAR support (#1195) 2025-10-03 10:49:24 +01:00
mike919192
999c210d28
Debug assert (#1175)
* debug assert POC

* Swith to ETL_CONSTEXPR14

* Finish TODO checks

* First and last can be equal

* Add ETL_DEBUG_THROW_EXCEPTIONS

* Try allowing c++11 constexpr

* Add macro for throwing from c++11 constexpr

* Remove braces

* Add extra asserts in size_t overload functions

* Fill out debug asserts

* Line up comments
2025-09-10 10:52:22 +01:00
John Wellbelove
2fa82d579e Macro changes to fix issues 2025-09-06 20:51:12 +01:00
John Wellbelove
0326edef42 Replaced ETL_NOEXCEPT_IF_NO_THROW with ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS) 2025-09-06 20:51:10 +01:00
John Wellbelove
4d5cb98d29 Fixed ETL_NOEXCEPT_IF_NO_THROW and #define ETL_NOEXCEPT_IF_NO_THROW_EXPR(...) for C++03
Updated example

Added releaser and destroyer functors to etl::ipool to simplify integration with etl::unique_ptr
2025-08-19 13:18:21 +01:00
John Wellbelove
3a25d5934a Added constexpr. Removed some member functions. Removed 'move' member functions for etl::not_null<etl::unique_ptr<T, TDeleter>> 2025-08-18 16:51:49 +01:00
John Wellbelove
b77698810f hotfix #1154-etl-20.42.2-not-compiling-with-IAR-Arm-compiler-v9.20 2025-07-24 15:40:10 +01:00
John Wellbelove
3dce945223 Added ETL_NOEXCEPT to etl::delegate 2025-07-10 14:30:18 +01:00
John Wellbelove
f2d9ec18a4 Changed name of macro
Added macro to etl traits
2025-07-06 23:46:52 +01:00
Roland Reichwein
185557db59 Fix usage of template keyword (#1131)
For non-GCC-compilers, the template keyword is being used in
parameter_pack.h for referring to a template template member.

However, clang 19 and 20 don't accept this.

It should be verified which compiler really needs the template
keyword here at all. If not, the if-branch can be removed.

Removed redundant ETL_USING_WIDE_CHARACTERS

Added using_libc_wchar_h to ETL traits

#1127 type_traits.h and C++03

Changed many instances of mem_copy to mem_move
2025-06-22 11:13:43 +01:00
John Wellbelove
a037af120b Merge branch 'hotfix/Accomodate-libc++-with-disabled-wchar_t-features' into development
# Conflicts:
#	include/etl/basic_string.h
2025-06-12 13:15:38 +01:00
Roland Reichwein
a1367fc05f
Conditionally use wchar.h (#1115) 2025-06-04 19:05:41 +01:00
John Wellbelove
cd273e777d Initial solution 2025-06-04 10:12:01 +01:00
John Wellbelove
d04ee8c5e7 Added configuration for selection of STL-like or ETL-verbose chrono literals 2025-05-17 11:46:52 +01:00
John Wellbelove
270cb33338 Merge updates 2025-05-13 08:32:59 +01:00
John Wellbelove
071a983cba Added ETL_HAS_ATOMIC_ALWAYS_LOCK_FREE macro and has_atomic_always_lock_free trait
Fixed coditional unit tests in test_atomic
2025-03-03 10:03:42 +00:00
John Wellbelove
6c6c7b00a5 Remove redundant ETL_FORCE_NO_ADVANCED_CPP macro 2025-01-22 14:51:18 +00:00
John Wellbelove
71268c4cf3 Updated packed macro 2025-01-21 17:47:31 +00:00
John Wellbelove
f9b2494ec9 Merge branch 'pull-request/#989-Packed-unaligned_type' into development 2024-12-16 14:58:57 +00:00
John Wellbelove
05682930e1 Make 'packed' have better cross platform functionality 2024-12-16 14:58:16 +00:00
rolandreichweinbmw
84eea5bb1f
Packed unaligned_type (#989)
This way, unaligned_types like etl::be_uint32_t can be used in places where POD types are expected.
2024-12-14 21:36:15 +00:00
John Wellbelove
907d38f728 Redefined ETL_DEPRECATED 2024-11-10 18:00:00 +00:00
Drew Rife
211b8c2e90
fix: determine legacy variant after determining compiler version (#938) 2024-07-30 19:36:46 +01:00
John Wellbelove
b3cba2f256 Merge branch 'pull-request/#935-added-20-bit-integral-limits' into development
# Conflicts:
#	support/Release notes.txt
2024-07-30 14:48:44 +01:00
John Wellbelove
75f2e7b392 Added support for 20bit types for integral_limits 2024-07-30 14:46:50 +01:00
John Wellbelove
9b8c7780a4 Fixed legacy variant macro 2024-07-30 13:35:08 +01:00
John Wellbelove
24824d2095 Added ETL_USING_LEGACY_VARIANT & ETL_NOT_USING_LEGACY_VARIANT
Added some legacy API member functions to new variant type.
2024-07-28 16:47:12 +01:00
jaskij
64f620c1a8
fix c++20-compat false positive (#909)
* fix c++20-compat false positive

* move the c++20 compat warning suppression to a separate header

* fix GCC/clang in private/diagnostic_cxx_20_compat_push.h

---------

Co-authored-by: Jan Dorniak <jdorniak@ultima-automatyka.pl>
2024-07-02 09:35:24 +01:00
John Wellbelove
94ee20e2fd Fix C++ standard syntax compatibility for repair() 2024-01-20 18:10:34 +00:00
John Wellbelove
8f6055e99b Removed ETL_STATIC_CONSTANT 2024-01-13 11:44:59 +00:00
John Wellbelove
b6650120f8 Added u8string + utilities
Changed char types to unsigned 'least' types
2023-11-14 00:06:57 +00:00
John Wellbelove
94654689e8 Removed semicolon warnings 2023-08-29 09:25:58 +01:00
John Wellbelove
45fb06af3f Changes require for non-virtual messages 2023-08-18 20:51:36 +01:00
John Wellbelove
2d41441f02 Added ETL_CONSTEXPR11 as a synonym for ETL_CONSTEXPR 2023-07-04 11:45:11 +01:00
Michael Morgan
5ddc11b57d Add rvalue accessors to expected and optional, and update constructors. (#690)
* Add rvalue methods to optional and expected.

* Fix constructors in expected.h.

* Fix sanity checks.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2023-05-20 11:43:49 +01:00
John Wellbelove
8ddf0935d3 Array bounds and maybe-uninitialized warning fixes 2023-02-28 18:33:49 +00:00
John Wellbelove
17edf62869 Work-In-Progress 2022-10-19 19:33:20 +01:00
David Hebbeker
aa2d249fdc Move __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS before #include <stdint.h>. (#601)
Macros must be defined before first include of stdint.h. Else they have no effect.
2022-10-19 12:20:42 +01:00