ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.24k stars 392 forks source link

Use standard feature testing #572

Open benedekkupper opened 2 years ago

benedekkupper commented 2 years ago

ETL is doing a lot of its own detection on which language features are supported. The problem is, it's not very accurate. I got here because by updating ETL in my C++20 project the build has failed. The problem boils down to the #define ETL_NO_SMALL_CHAR_SUPPORT ETL_CPP20_NOT_SUPPORTED line. This condition is correct as it is spelled out. However, GCC 10 sets __cplusplus to 201709L for -std=gnu++20, so the macro gets an incorrect value, compilation fails due to duplicate definition of char8_t.

A better way to deal with these issues (at least from C++20) is relying on the C++ standard feature tests. These same macros could be defined by ETL itself for earlier C++ versions, as long as the __cplusplus numbering pitfall mentioned above is handled well. (A big oversight from the feature test design is not adding a macro to check if feature test macros are available at all or not.)

benedekkupper commented 1 year ago

Any timeline for merging this branch? The later it gets done, the more additional work it generates.

jwellbelove commented 1 year ago

Between holidaying in Malta and catching a bad cold, I've not looked at the ETL for a few weeks. I have several things to work on for the ETL, so I'm going to have to try to work through them over xmas as I get the free time.