From a6a15f9d3a75262220c1d3e6f8f8e20759b9061a Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 16 Sep 2024 12:38:42 -0400 Subject: [PATCH] core: add missing types to return values Fixes build failing on Debian Buster (gcc 8.3.0) with: /build/subsurface-beta-202409160411/./core/units.h: In function 'duration_t operator""_sec(long long unsigned int)': /build/subsurface-beta-202409160411/./core/units.h:149:48: error: could not convert '{((int32_t)sec)}' from '' to 'duration_t' return { .seconds = static_cast(sec) }; Signed-off-by: Richard Fuchs --- core/units.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/core/units.h b/core/units.h index d9e31030d..d34d4deb5 100644 --- a/core/units.h +++ b/core/units.h @@ -146,11 +146,11 @@ struct duration_t : public unit_base }; static inline duration_t operator""_sec(unsigned long long sec) { - return { .seconds = static_cast(sec) }; + return duration_t { .seconds = static_cast(sec) }; } static inline duration_t operator""_min(unsigned long long min) { - return { .seconds = static_cast(min * 60) }; + return duration_t { .seconds = static_cast(min * 60) }; } struct offset_t : public unit_base @@ -164,15 +164,15 @@ struct depth_t : public unit_base // depth to 2000 km }; static inline depth_t operator""_mm(unsigned long long mm) { - return { .mm = static_cast(mm) }; + return depth_t { .mm = static_cast(mm) }; } static inline depth_t operator""_m(unsigned long long m) { - return { .mm = static_cast(m * 1000) }; + return depth_t { .mm = static_cast(m * 1000) }; } static inline depth_t operator""_ft(unsigned long long ft) { - return { .mm = static_cast(round(ft * 304.8)) }; + return depth_t { .mm = static_cast(round(ft * 304.8)) }; } struct pressure_t : public unit_base @@ -181,15 +181,15 @@ struct pressure_t : public unit_base }; static inline pressure_t operator""_mbar(unsigned long long mbar) { - return { .mbar = static_cast(mbar) }; + return pressure_t { .mbar = static_cast(mbar) }; } static inline pressure_t operator""_bar(unsigned long long bar) { - return { .mbar = static_cast(bar * 1000) }; + return pressure_t { .mbar = static_cast(bar * 1000) }; } static inline pressure_t operator""_atm(unsigned long long atm) { - return { .mbar = static_cast(round(atm * 1013.25)) }; + return pressure_t { .mbar = static_cast(round(atm * 1013.25)) }; } struct o2pressure_t : public unit_base @@ -198,7 +198,7 @@ struct o2pressure_t : public unit_base }; static inline o2pressure_t operator""_baro2(unsigned long long bar) { - return { .mbar = static_cast(bar * 1000) }; + return o2pressure_t { .mbar = static_cast(bar * 1000) }; } struct bearing_t : public unit_base @@ -212,7 +212,7 @@ struct temperature_t : public unit_base }; static inline temperature_t operator""_K(unsigned long long K) { - return { .mkelvin = static_cast(K * 1000) }; + return temperature_t { .mkelvin = static_cast(K * 1000) }; } struct temperature_sum_t : public unit_base @@ -226,11 +226,11 @@ struct volume_t : public unit_base }; static inline volume_t operator""_ml(unsigned long long ml) { - return { .mliter = static_cast(ml) }; + return volume_t { .mliter = static_cast(ml) }; } static inline volume_t operator""_l(unsigned long long l) { - return { .mliter = static_cast(l * 1000) }; + return volume_t { .mliter = static_cast(l * 1000) }; } struct fraction_t : public unit_base @@ -239,11 +239,11 @@ struct fraction_t : public unit_base }; static inline fraction_t operator""_permille(unsigned long long permille) { - return { .permille = static_cast(permille) }; + return fraction_t { .permille = static_cast(permille) }; } static inline fraction_t operator""_percent(unsigned long long percent) { - return { .permille = static_cast(percent * 10) }; + return fraction_t { .permille = static_cast(percent * 10) }; } struct weight_t : public unit_base