mkxp-z/subprojects/packagefiles/openal-soft-constexpr.patch

64 lines
2.9 KiB
Diff

# Fixes problems in the code that cause compilation errors due to stricter handling of constexpr in old versions of GCC.
# When building for PlayStation 3, we use an old enough version of GCC for this to be a problem.
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -243,7 +243,7 @@ constexpr auto EffectSlotTypeFromEnum(ALenum type) noexcept -> EffectSlotType
case AL_EFFECT_DEDICATED_DIALOGUE: return EffectSlotType::Dedicated;
case AL_EFFECT_CONVOLUTION_SOFT: return EffectSlotType::Convolution;
}
- ERR("Unhandled effect enum: {:#04x}", as_unsigned(type));
+
return EffectSlotType::None;
}
--- a/common/alstring.h
+++ b/common/alstring.h
@@ -22,15 +22,15 @@ auto sizei(const std::basic_string<Ts...> &str) noexcept -> int
[[nodiscard]]
-constexpr bool contains(const std::string_view str0, const std::string_view str1) noexcept
+inline bool contains(const std::string_view str0, const std::string_view str1) noexcept
{ return str0.find(str1) != std::string_view::npos; }
[[nodiscard]]
-constexpr bool starts_with(const std::string_view str0, const std::string_view str1) noexcept
+inline bool starts_with(const std::string_view str0, const std::string_view str1) noexcept
{ return str0.substr(0, std::min(str0.size(), str1.size())) == str1; }
[[nodiscard]]
-constexpr bool ends_with(const std::string_view str0, const std::string_view str1) noexcept
+inline bool ends_with(const std::string_view str0, const std::string_view str1) noexcept
{ return str0.substr(str0.size() - std::min(str0.size(), str1.size())) == str1; }
[[nodiscard]]
--- a/fmt-11.1.1/include/fmt/format.h
+++ b/fmt-11.1.1/include/fmt/format.h
@@ -1211,7 +1211,7 @@ FMT_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits)
return out;
}
// Buffer is large enough to hold all digits (digits10 + 1).
- char buffer[digits10<UInt>() + 1];
+ char buffer[digits10<UInt>() + 1] = {};
if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0');
do_format_decimal(buffer, value, num_digits);
return copy_noinline<Char>(buffer, buffer + num_digits, out);
@@ -1248,7 +1248,7 @@ FMT_CONSTEXPR inline auto format_base2e(int base_bits, OutputIt out, UInt value,
return out;
}
// Make buffer large enough for any base.
- char buffer[num_bits<UInt>()];
+ char buffer[num_bits<UInt>()] = {};
if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0');
format_base2e(base_bits, buffer, value, num_digits, upper);
return detail::copy_noinline<Char>(buffer, buffer + num_digits, out);
@@ -2015,7 +2015,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, "");
constexpr int buffer_size = num_bits<T>();
- char buffer[buffer_size];
+ char buffer[buffer_size] = {};
if (is_constant_evaluated()) fill_n(buffer, buffer_size, '\0');
const char* begin = nullptr;
const char* end = buffer + buffer_size;