From fa482c92467e2600f8b8d2d16edbbbec98985b6d Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 11 Feb 2025 10:07:34 +0100 Subject: [PATCH] feat: deprecation messages now provide the release version where the deprecation happened --- .../mp-units/framework/construction_helpers.h | 2 +- .../mp-units/framework/customization_points.h | 10 +-- .../include/mp-units/framework/dimension.h | 2 +- .../include/mp-units/framework/reference.h | 4 +- .../include/mp-units/framework/symbol_text.h | 12 +-- .../mp-units/framework/unit_magnitude.h | 4 +- .../framework/unit_symbol_formatting.h | 2 +- src/core/include/mp-units/math.h | 3 +- .../include/mp-units/systems/iec/quantities.h | 74 +++++++++++-------- .../include/mp-units/systems/iec80000.h | 4 +- 10 files changed, 64 insertions(+), 53 deletions(-) diff --git a/src/core/include/mp-units/framework/construction_helpers.h b/src/core/include/mp-units/framework/construction_helpers.h index fd962086..63b933b0 100644 --- a/src/core/include/mp-units/framework/construction_helpers.h +++ b/src/core/include/mp-units/framework/construction_helpers.h @@ -65,7 +65,7 @@ template constexpr point_ point{}; template -[[deprecated("Use `point` instead")]] constexpr point_ absolute{}; +[[deprecated("2.5.0: Use `point` instead")]] constexpr point_ absolute{}; MP_UNITS_EXPORT_END diff --git a/src/core/include/mp-units/framework/customization_points.h b/src/core/include/mp-units/framework/customization_points.h index d33b111d..34c3103a 100644 --- a/src/core/include/mp-units/framework/customization_points.h +++ b/src/core/include/mp-units/framework/customization_points.h @@ -61,19 +61,19 @@ constexpr bool treat_as_floating_point = #endif template -[[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 -[[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 -[[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 -[[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 -using quantity_values [[deprecated("Use `representation_values` instead")]] = representation_values; +using quantity_values [[deprecated("2.5.0: Use `representation_values` instead")]] = representation_values; /** * @brief Provides support for external quantity-like types diff --git a/src/core/include/mp-units/framework/dimension.h b/src/core/include/mp-units/framework/dimension.h index c08fbefa..287b0593 100644 --- a/src/core/include/mp-units/framework/dimension.h +++ b/src/core/include/mp-units/framework/dimension.h @@ -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; diff --git a/src/core/include/mp-units/framework/reference.h b/src/core/include/mp-units/framework/reference.h index 1856fcda..0f767f0b 100644 --- a/src/core/include/mp-units/framework/reference.h +++ b/src/core/include/mp-units/framework/reference.h @@ -207,7 +207,7 @@ template template Rep = std::remove_cvref_t> requires detail::OffsetUnit [[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 Rep = std::remove_cvref_t> requires detail::OffsetUnit [[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) { diff --git a/src/core/include/mp-units/framework/symbol_text.h b/src/core/include/mp-units/framework/symbol_text.h index af3a8452..175e28a5 100644 --- a/src/core/include/mp-units/framework/symbol_text.h +++ b/src/core/include/mp-units/framework/symbol_text.h @@ -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 { diff --git a/src/core/include/mp-units/framework/unit_magnitude.h b/src/core/include/mp-units/framework/unit_magnitude.h index 2086c34e..17a21855 100644 --- a/src/core/include/mp-units/framework/unit_magnitude.h +++ b/src/core/include/mp-units/framework/unit_magnitude.h @@ -64,7 +64,7 @@ struct mag_constant { // `mag()` implementation. template -[[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 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` instead")]] inline constexpr UnitMagnitude auto mag_pi = mag; +[[deprecated("2.3.0: Use `mag` instead")]] inline constexpr UnitMagnitude auto mag_pi = mag; MP_UNITS_EXPORT_END diff --git a/src/core/include/mp-units/framework/unit_symbol_formatting.h b/src/core/include/mp-units/framework/unit_symbol_formatting.h index 04e4954f..9183b4f3 100644 --- a/src/core/include/mp-units/framework/unit_symbol_formatting.h +++ b/src/core/include/mp-units/framework/unit_symbol_formatting.h @@ -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; diff --git a/src/core/include/mp-units/math.h b/src/core/include/mp-units/math.h index 62186c98..b5838b76 100644 --- a/src/core/include/mp-units/math.h +++ b/src/core/include/mp-units/math.h @@ -320,7 +320,8 @@ template */ template requires requires { std::numeric_limits::epsilon(); } -[[deprecated("Use `std::numeric_limits::epsilon()` instead")]] [[nodiscard]] constexpr quantity +[[deprecated( + "2.5.0: Use `std::numeric_limits::epsilon()` instead")]] [[nodiscard]] constexpr quantity epsilon(R r) noexcept { return {static_cast(std::numeric_limits::epsilon()), r}; diff --git a/src/systems/include/mp-units/systems/iec/quantities.h b/src/systems/include/mp-units/systems/iec/quantities.h index da411ff5..0343af93 100644 --- a/src/systems/include/mp-units/systems/iec/quantities.h +++ b/src/systems/include/mp-units/systems/iec/quantities.h @@ -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 diff --git a/src/systems/include/mp-units/systems/iec80000.h b/src/systems/include/mp-units/systems/iec80000.h index 2a75cf92..7bbd537e 100644 --- a/src/systems/include/mp-units/systems/iec80000.h +++ b/src/systems/include/mp-units/systems/iec80000.h @@ -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;