Fix symbols to be exportable from C++20 named modules (#1582)

Fixes #1543

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
This commit is contained in:
Roland Reichwein 2026-09-01 21:25:31 +02:00 committed by GitHub
parent c896d2d7dd
commit 2f338411a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 29 additions and 26 deletions

View File

@ -135,12 +135,12 @@ namespace etl
using memory_order = std::memory_order;
static ETL_CONSTANT etl::memory_order memory_order_relaxed = std::memory_order_relaxed;
static ETL_CONSTANT etl::memory_order memory_order_consume = std::memory_order_consume;
static ETL_CONSTANT etl::memory_order memory_order_acquire = std::memory_order_acquire;
static ETL_CONSTANT etl::memory_order memory_order_release = std::memory_order_release;
static ETL_CONSTANT etl::memory_order memory_order_acq_rel = std::memory_order_acq_rel;
static ETL_CONSTANT etl::memory_order memory_order_seq_cst = std::memory_order_seq_cst;
ETL_INLINE_VAR ETL_CONSTANT etl::memory_order memory_order_relaxed = std::memory_order_relaxed;
ETL_INLINE_VAR ETL_CONSTANT etl::memory_order memory_order_consume = std::memory_order_consume;
ETL_INLINE_VAR ETL_CONSTANT etl::memory_order memory_order_acquire = std::memory_order_acquire;
ETL_INLINE_VAR ETL_CONSTANT etl::memory_order memory_order_release = std::memory_order_release;
ETL_INLINE_VAR ETL_CONSTANT etl::memory_order memory_order_acq_rel = std::memory_order_acq_rel;
ETL_INLINE_VAR ETL_CONSTANT etl::memory_order memory_order_seq_cst = std::memory_order_seq_cst;
using atomic_bool = etl::atomic<bool>;
using atomic_char = etl::atomic<char>;

View File

@ -135,65 +135,65 @@ namespace etl
//***************************************************************************
// Stream formatting manipulators.
//***************************************************************************
static ETL_CONSTEXPR private_basic_format_spec::base_spec setbase(uint32_t base)
inline ETL_CONSTEXPR private_basic_format_spec::base_spec setbase(uint32_t base)
{
return private_basic_format_spec::base_spec(base);
}
//*********************************
static ETL_CONSTEXPR private_basic_format_spec::width_spec setw(uint32_t width)
inline ETL_CONSTEXPR private_basic_format_spec::width_spec setw(uint32_t width)
{
return private_basic_format_spec::width_spec(width);
}
//*********************************
template <typename TChar>
static ETL_CONSTEXPR private_basic_format_spec::fill_spec<TChar> setfill(TChar fill)
ETL_CONSTEXPR private_basic_format_spec::fill_spec<TChar> setfill(TChar fill)
{
return private_basic_format_spec::fill_spec<TChar>(fill);
}
//*********************************
static ETL_CONSTEXPR private_basic_format_spec::precision_spec setprecision(uint32_t precision)
inline ETL_CONSTEXPR private_basic_format_spec::precision_spec setprecision(uint32_t precision)
{
return private_basic_format_spec::precision_spec(precision);
}
//*********************************
static ETL_CONSTANT private_basic_format_spec::base_spec bin(2U);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::base_spec bin(2U);
//*********************************
static ETL_CONSTANT private_basic_format_spec::base_spec oct(8U);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::base_spec oct(8U);
//*********************************
static ETL_CONSTANT private_basic_format_spec::base_spec dec(10U);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::base_spec dec(10U);
//*********************************
static ETL_CONSTANT private_basic_format_spec::base_spec hex(16U);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::base_spec hex(16U);
//*********************************
static ETL_CONSTANT private_basic_format_spec::left_spec left = private_basic_format_spec::left_spec();
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::left_spec left = private_basic_format_spec::left_spec();
//*********************************
static ETL_CONSTANT private_basic_format_spec::right_spec right = private_basic_format_spec::right_spec();
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::right_spec right = private_basic_format_spec::right_spec();
//*********************************
static ETL_CONSTANT private_basic_format_spec::boolalpha_spec boolalpha(true);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::boolalpha_spec boolalpha(true);
//*********************************
static ETL_CONSTANT private_basic_format_spec::boolalpha_spec noboolalpha(false);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::boolalpha_spec noboolalpha(false);
//*********************************
static ETL_CONSTANT private_basic_format_spec::uppercase_spec uppercase(true);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::uppercase_spec uppercase(true);
//*********************************
static ETL_CONSTANT private_basic_format_spec::uppercase_spec nouppercase(false);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::uppercase_spec nouppercase(false);
//*********************************
static ETL_CONSTANT private_basic_format_spec::showbase_spec showbase(true);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::showbase_spec showbase(true);
//*********************************
static ETL_CONSTANT private_basic_format_spec::showbase_spec noshowbase(false);
ETL_INLINE_VAR ETL_CONSTANT private_basic_format_spec::showbase_spec noshowbase(false);
//***************************************************************************
/// basic_format_spec

View File

@ -41,7 +41,7 @@ namespace etl
//***************************************************************************
/// Defines a no-position constant.
//***************************************************************************
static ETL_CONSTANT size_t index_of_type_npos = etl::integral_limits<size_t>::max;
ETL_INLINE_VAR ETL_CONSTANT size_t index_of_type_npos = etl::integral_limits<size_t>::max;
//***************************************************************************
/// Finds the index of a type in a variadic type parameter.

View File

@ -36,7 +36,10 @@ SOFTWARE.
namespace etl
{
static ETL_CONSTANT size_t dynamic_extent = etl::integral_limits<size_t>::max;
// ETL_INLINE_VAR gives external linkage in C++17 and later, so that etl::span,
// which references dynamic_extent in its public interface, can be exported from
// a C++20 named module without exposing a TU-local entity. See issue #1543.
ETL_INLINE_VAR ETL_CONSTANT size_t dynamic_extent = etl::integral_limits<size_t>::max;
}
#endif

View File

@ -314,7 +314,7 @@ namespace etl
} // namespace private_variant
/// Definition of variant_npos.
constexpr size_t variant_npos = etl::integral_limits<size_t>::max;
ETL_INLINE_VAR constexpr size_t variant_npos = etl::integral_limits<size_t>::max;
//***********************************
// variant. Forward declaration

View File

@ -44,7 +44,7 @@ namespace etl
//***************************************************************************
/// Defines a no-position constant.
//***************************************************************************
static ETL_CONSTANT size_t type_list_npos = etl::integral_limits<size_t>::max;
ETL_INLINE_VAR ETL_CONSTANT size_t type_list_npos = etl::integral_limits<size_t>::max;
//***************************************************************************
// Type list forward declaration.