fix: clang is too stupid to provide a deprecation warning for text_encoding

This commit is contained in:
Mateusz Pusz
2024-11-21 11:25:57 +01:00
parent c745e90dfd
commit 0c09008671
3 changed files with 20 additions and 10 deletions
@@ -220,13 +220,18 @@ template<std::intmax_t Num, std::intmax_t Den = 1, Dimension D>
[[nodiscard]] consteval Dimension auto cbrt(Dimension auto d) { return pow<1, 3>(d); }
MP_UNITS_DIAGNOSTIC_PUSH
MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED
struct dimension_symbol_formatting {
#if MP_UNITS_COMP_CLANG
// TODO prevents the deprecated usage in implicit copy constructor warning
character_set char_set = character_set::default_character_set;
#else
[[deprecated("Use `char_set` instead")]] character_set encoding = character_set::default_character_set;
MP_UNITS_DIAGNOSTIC_PUSH
MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED
character_set char_set = encoding;
MP_UNITS_DIAGNOSTIC_POP
#endif
};
MP_UNITS_DIAGNOSTIC_POP
MP_UNITS_EXPORT_END
@@ -53,15 +53,20 @@ enum class unit_symbol_separator : std::int8_t {
default_separator = space
};
MP_UNITS_DIAGNOSTIC_PUSH
MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED
struct unit_symbol_formatting {
#if MP_UNITS_COMP_CLANG
// TODO prevents the deprecated usage in implicit copy constructor warning
character_set char_set = character_set::default_character_set;
#else
[[deprecated("Use `char_set` instead")]] character_set encoding = character_set::default_character_set;
MP_UNITS_DIAGNOSTIC_PUSH
MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED
character_set char_set = encoding;
MP_UNITS_DIAGNOSTIC_POP
#endif
unit_symbol_solidus solidus = unit_symbol_solidus::default_denominator;
unit_symbol_separator separator = unit_symbol_separator::default_separator;
};
MP_UNITS_DIAGNOSTIC_POP
} // namespace mp_units