feat: deprecation messages now provide the release version where the deprecation happened

This commit is contained in:
Mateusz Pusz
2025-02-11 10:07:34 +01:00
parent ea06827f27
commit fa482c9246
10 changed files with 64 additions and 53 deletions

View File

@@ -65,7 +65,7 @@ template<Reference auto R>
constexpr point_<MP_UNITS_REMOVE_CONST(decltype(R))> point{};
template<Reference auto R>
[[deprecated("Use `point` instead")]] constexpr point_<MP_UNITS_REMOVE_CONST(decltype(R))> absolute{};
[[deprecated("2.5.0: Use `point` instead")]] constexpr point_<MP_UNITS_REMOVE_CONST(decltype(R))> absolute{};
MP_UNITS_EXPORT_END

View File

@@ -61,19 +61,19 @@ constexpr bool treat_as_floating_point =
#endif
template<typename Rep>
[[deprecated("`is_scalar` is no longer necessary and can simply be removed")]]
[[deprecated("2.5.0: `is_scalar` is no longer necessary and can simply be removed")]]
constexpr bool is_scalar = false;
template<typename Rep>
[[deprecated("`is_complex` is no longer necessary and can simply be removed")]]
[[deprecated("2.5.0: `is_complex` is no longer necessary and can simply be removed")]]
constexpr bool is_complex = false;
template<typename Rep>
[[deprecated("`is_vector` is no longer necessary and can simply be removed")]]
[[deprecated("2.5.0: `is_vector` is no longer necessary and can simply be removed")]]
constexpr bool is_vector = false;
template<typename Rep>
[[deprecated("`is_tensor` is no longer necessary and can simply be removed")]]
[[deprecated("2.5.0: `is_tensor` is no longer necessary and can simply be removed")]]
constexpr bool is_tensor = false;
/**
@@ -121,7 +121,7 @@ struct representation_values {
};
template<typename Rep>
using quantity_values [[deprecated("Use `representation_values` instead")]] = representation_values<Rep>;
using quantity_values [[deprecated("2.5.0: Use `representation_values` instead")]] = representation_values<Rep>;
/**
* @brief Provides support for external quantity-like types

View File

@@ -217,7 +217,7 @@ struct dimension_symbol_formatting {
// 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;
[[deprecated("2.5.0: 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;

View File

@@ -207,7 +207,7 @@ template<typename FwdRep, Reference R, RepresentationOf<get_quantity_spec(R{})>
template<typename FwdRep, Reference R, RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires detail::OffsetUnit<decltype(get_unit(R{}))>
[[deprecated(
"References using offset units (e.g., temperatures) should be constructed with the `delta` or `point` "
"2.3.0: References using offset units (e.g., temperatures) should be constructed with the `delta` or `point` "
"helpers")]] constexpr auto
operator*(FwdRep&& lhs, R r)
{
@@ -217,7 +217,7 @@ operator*(FwdRep&& lhs, R r)
template<typename FwdRep, Reference R, RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires detail::OffsetUnit<decltype(get_unit(R{}))>
[[deprecated(
"References using offset units (e.g., temperatures) should be constructed with the `delta` or `point` "
"2.3.0: References using offset units (e.g., temperatures) should be constructed with the `delta` or `point` "
"helpers")]] constexpr auto
operator/(FwdRep&& lhs, R)
{

View File

@@ -46,14 +46,14 @@ namespace mp_units {
// NOLINTNEXTLINE(readability-enum-initial-value)
MP_UNITS_EXPORT enum class character_set : std::int8_t {
utf8, // µs; m³; L²MT⁻³
unicode [[deprecated("Use `utf8` instead")]] = utf8,
unicode [[deprecated("2.4.0: Use `utf8` instead")]] = utf8,
portable, // us; m^3; L^2MT^-3
ascii [[deprecated("Use `portable` instead")]] = portable,
ascii [[deprecated("2.4.0: Use `portable` instead")]] = portable,
default_character_set = utf8,
default_encoding [[deprecated("Use `default_character_set` instead")]] = default_character_set
default_encoding [[deprecated("2.5.0: Use `default_character_set` instead")]] = default_character_set
};
using text_encoding [[deprecated("Use `character_set` instead")]] = character_set;
using text_encoding [[deprecated("2.5.0: Use `character_set` instead")]] = character_set;
namespace detail {
@@ -137,8 +137,8 @@ public:
[[nodiscard]] constexpr const auto& utf8() const { return utf8_; }
[[nodiscard]] constexpr const auto& portable() const { return portable_; }
[[deprecated("Use `utf8()` instead")]] constexpr const auto& unicode() const { return utf8(); }
[[deprecated("Use `portable()` instead")]] constexpr const auto& ascii() const { return portable(); }
[[deprecated("2.4.0: Use `utf8()` instead")]] constexpr const auto& unicode() const { return utf8(); }
[[deprecated("2.4.0: Use `portable()` instead")]] constexpr const auto& ascii() const { return portable(); }
[[nodiscard]] constexpr bool empty() const
{

View File

@@ -64,7 +64,7 @@ struct mag_constant {
// `mag()` implementation.
template<std::intmax_t N>
[[deprecated("`known_first_factor` is no longer necessary and can simply be removed")]]
[[deprecated("2.5.0: `known_first_factor` is no longer necessary and can simply be removed")]]
constexpr std::optional<std::intmax_t>
known_first_factor = std::nullopt;
@@ -96,7 +96,7 @@ inline constexpr struct pi final :
} pi;
inline constexpr auto π /* U+03C0 GREEK SMALL LETTER PI */ = pi;
[[deprecated("Use `mag<pi>` instead")]] inline constexpr UnitMagnitude auto mag_pi = mag<pi>;
[[deprecated("2.3.0: Use `mag<pi>` instead")]] inline constexpr UnitMagnitude auto mag_pi = mag<pi>;
MP_UNITS_EXPORT_END

View File

@@ -58,7 +58,7 @@ struct unit_symbol_formatting {
// 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;
[[deprecated("2.5.0: 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;

View File

@@ -320,7 +320,8 @@ template<auto R1, typename Rep1, auto R2, typename Rep2>
*/
template<Representation Rep, Reference R>
requires requires { std::numeric_limits<Rep>::epsilon(); }
[[deprecated("Use `std::numeric_limits<Quantity>::epsilon()` instead")]] [[nodiscard]] constexpr quantity<R{}, Rep>
[[deprecated(
"2.5.0: Use `std::numeric_limits<Quantity>::epsilon()` instead")]] [[nodiscard]] constexpr quantity<R{}, Rep>
epsilon(R r) noexcept
{
return {static_cast<Rep>(std::numeric_limits<Rep>::epsilon()), r};

View File

@@ -27,62 +27,72 @@
MP_UNITS_EXPORT
namespace mp_units::iec {
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto dim_traffic_intensity =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto dim_traffic_intensity =
isq::dim_traffic_intensity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto traffic_intensity =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto traffic_intensity =
isq::traffic_intensity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto traffic_offered_intensity =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto traffic_offered_intensity =
isq::traffic_offered_intensity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto traffic_carried_intensity =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto traffic_carried_intensity =
isq::traffic_carried_intensity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto traffic_load =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto traffic_load =
isq::traffic_carried_intensity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto mean_queue_length =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto mean_queue_length =
isq::mean_queue_length;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto loss_probability =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto loss_probability =
isq::loss_probability;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto waiting_probability =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto waiting_probability =
isq::waiting_probability;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto call_intensity = isq::call_intensity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto calling_rate = isq::call_intensity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto completed_call_intensity =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto call_intensity =
isq::call_intensity;
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto calling_rate =
isq::call_intensity;
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto completed_call_intensity =
isq::completed_call_intensity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto storage_capacity =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto storage_capacity =
isq::storage_capacity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto storage_size = isq::storage_capacity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto equivalent_binary_storage_capacity =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto storage_size =
isq::storage_capacity;
[[deprecated(
"2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto equivalent_binary_storage_capacity =
isq::equivalent_binary_storage_capacity;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto transfer_rate = isq::transfer_rate;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto period_of_data_elements =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto transfer_rate =
isq::transfer_rate;
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto period_of_data_elements =
isq::period_of_data_elements;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto binary_digit_rate =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto binary_digit_rate =
isq::binary_digit_rate;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto bit_rate = isq::binary_digit_rate;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto period_of_binary_digits =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto bit_rate =
isq::binary_digit_rate;
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto period_of_binary_digits =
isq::period_of_binary_digits;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto bit_period =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto bit_period =
isq::period_of_binary_digits;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto equivalent_binary_digit_rate =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto equivalent_binary_digit_rate =
isq::equivalent_binary_digit_rate;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto equivalent_bit_rate = isq::bit_rate;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto modulation_rate =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto equivalent_bit_rate =
isq::bit_rate;
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto modulation_rate =
isq::modulation_rate;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto line_digit_rate =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto line_digit_rate =
isq::modulation_rate;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto quantizing_distortion_power =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto quantizing_distortion_power =
isq::quantizing_distortion_power;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto carrier_power = isq::carrier_power;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto signal_energy_per_binary_digit =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto carrier_power =
isq::carrier_power;
[[deprecated(
"2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto signal_energy_per_binary_digit =
isq::signal_energy_per_binary_digit;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto error_probability =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto error_probability =
isq::error_probability;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto Hamming_distance =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto Hamming_distance =
isq::Hamming_distance;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto clock_frequency =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto clock_frequency =
isq::clock_frequency;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto clock_rate = isq::clock_frequency;
[[deprecated("Quantity type moved to the `isq` namespace")]] inline constexpr auto decision_content =
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto clock_rate =
isq::clock_frequency;
[[deprecated("2.4.0: Quantity type moved to the `isq` namespace")]] inline constexpr auto decision_content =
isq::decision_content;
} // namespace mp_units::iec

View File

@@ -29,9 +29,9 @@
namespace mp_units {
MP_UNITS_EXPORT
namespace [[deprecated("Use `mp_units::iec` namespace from iec.h instead")]] iec80000 {
namespace [[deprecated("2.3.0: Use `mp_units::iec` namespace from iec.h instead")]] iec80000 {
namespace [[deprecated("Use `mp_units::iec::unit_symbols` namespace from iec.h instead")]] unit_symbols {
namespace [[deprecated("2.3.0: Use `mp_units::iec::unit_symbols` namespace from iec.h instead")]] unit_symbols {
using namespace iec::unit_symbols;