diff --git a/include/etl/atomic/atomic_std.h b/include/etl/atomic/atomic_std.h index 06fcef6c..76a22c93 100644 --- a/include/etl/atomic/atomic_std.h +++ b/include/etl/atomic/atomic_std.h @@ -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; using atomic_char = etl::atomic; diff --git a/include/etl/basic_format_spec.h b/include/etl/basic_format_spec.h index dc198f54..cd8b3e33 100644 --- a/include/etl/basic_format_spec.h +++ b/include/etl/basic_format_spec.h @@ -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 - static ETL_CONSTEXPR private_basic_format_spec::fill_spec setfill(TChar fill) + ETL_CONSTEXPR private_basic_format_spec::fill_spec setfill(TChar fill) { return private_basic_format_spec::fill_spec(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 diff --git a/include/etl/index_of_type.h b/include/etl/index_of_type.h index 2d799832..7471ef22 100644 --- a/include/etl/index_of_type.h +++ b/include/etl/index_of_type.h @@ -41,7 +41,7 @@ namespace etl //*************************************************************************** /// Defines a no-position constant. //*************************************************************************** - static ETL_CONSTANT size_t index_of_type_npos = etl::integral_limits::max; + ETL_INLINE_VAR ETL_CONSTANT size_t index_of_type_npos = etl::integral_limits::max; //*************************************************************************** /// Finds the index of a type in a variadic type parameter. diff --git a/include/etl/private/dynamic_extent.h b/include/etl/private/dynamic_extent.h index afcc9687..cd34d3c1 100644 --- a/include/etl/private/dynamic_extent.h +++ b/include/etl/private/dynamic_extent.h @@ -36,7 +36,10 @@ SOFTWARE. namespace etl { - static ETL_CONSTANT size_t dynamic_extent = etl::integral_limits::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::max; } #endif diff --git a/include/etl/private/variant_variadic.h b/include/etl/private/variant_variadic.h index aaedb064..924d73a3 100644 --- a/include/etl/private/variant_variadic.h +++ b/include/etl/private/variant_variadic.h @@ -314,7 +314,7 @@ namespace etl } // namespace private_variant /// Definition of variant_npos. - constexpr size_t variant_npos = etl::integral_limits::max; + ETL_INLINE_VAR constexpr size_t variant_npos = etl::integral_limits::max; //*********************************** // variant. Forward declaration diff --git a/include/etl/type_list.h b/include/etl/type_list.h index 7cfdfaa0..0a79c964 100644 --- a/include/etl/type_list.h +++ b/include/etl/type_list.h @@ -44,7 +44,7 @@ namespace etl //*************************************************************************** /// Defines a no-position constant. //*************************************************************************** - static ETL_CONSTANT size_t type_list_npos = etl::integral_limits::max; + ETL_INLINE_VAR ETL_CONSTANT size_t type_list_npos = etl::integral_limits::max; //*************************************************************************** // Type list forward declaration.