Fix some gcc warnings

This commit is contained in:
Megamouse 2026-05-30 22:22:59 +02:00
parent 8c82ce8bed
commit 1bd246d2d3
10 changed files with 22 additions and 13 deletions

View File

@ -39,7 +39,7 @@ namespace aarch64
if (head->magic == ESR_CTX_MAGIC) if (head->magic == ESR_CTX_MAGIC)
{ {
return reinterpret_cast<const aarch64_esr_ctx*>(head); return utils::bless<const aarch64_esr_ctx>(head);
} }
offset += head->size; offset += head->size;

View File

@ -81,6 +81,8 @@
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
#pragma push_macro("FORCE_INLINE") #pragma push_macro("FORCE_INLINE")
#pragma push_macro("ALIGN_STRUCT") #pragma push_macro("ALIGN_STRUCT")
#undef FORCE_INLINE
#undef ALIGN_STRUCT
#define FORCE_INLINE static inline __attribute__((always_inline)) #define FORCE_INLINE static inline __attribute__((always_inline))
#define ALIGN_STRUCT(x) __attribute__((aligned(x))) #define ALIGN_STRUCT(x) __attribute__((aligned(x)))
#define _sse2neon_likely(x) __builtin_expect(!!(x), 1) #define _sse2neon_likely(x) __builtin_expect(!!(x), 1)

View File

@ -336,7 +336,7 @@ namespace vm
// Perform reinterpret cast // Perform reinterpret cast
template <typename CT, typename T, typename AT> template <typename CT, typename T, typename AT>
requires requires(T* t) { reinterpret_cast<to_be_t<CT>*>(t); } requires std::is_object_v<T> && std::is_object_v<to_be_t<CT>>
inline _ptr_base<to_be_t<CT>, u32> unsafe_ptr_cast(const _ptr_base<T, AT>& other) inline _ptr_base<to_be_t<CT>, u32> unsafe_ptr_cast(const _ptr_base<T, AT>& other)
{ {
return vm::cast(other.addr()); return vm::cast(other.addr());

View File

@ -199,7 +199,10 @@ namespace rsx
if (!is_compiled()) if (!is_compiled())
{ {
auto renderer = get_font(); auto renderer = get_font();
const auto& [caret_x, caret_y] = renderer->get_char_offset(text.c_str(), caret_position, clip_text ? w : -1, wrap_text);
f32 caret_x {};
f32 caret_y {};
renderer->get_char_offset(caret_x, caret_y, text.c_str(), caret_position, clip_text ? w : -1, wrap_text);
overlay_element caret; overlay_element caret;
caret.set_pos(static_cast<u16>(caret_x) + padding_left + x, static_cast<u16>(caret_y) + padding_top + y); caret.set_pos(static_cast<u16>(caret_x) + padding_left + x, static_cast<u16>(caret_y) + padding_top + y);

View File

@ -457,12 +457,9 @@ namespace rsx
return render_text_ex(unused_x, unused_y, text, -1, max_width, wrap); return render_text_ex(unused_x, unused_y, text, -1, max_width, wrap);
} }
std::pair<f32, f32> font::get_char_offset(const char32_t* text, usz max_length, u16 max_width, bool wrap) void font::get_char_offset(f32& loc_x, f32& loc_y, const char32_t* text, usz max_length, u16 max_width, bool wrap)
{ {
f32 loc_x, loc_y;
render_text_ex(loc_x, loc_y, text, max_length, max_width, wrap); render_text_ex(loc_x, loc_y, text, max_length, max_width, wrap);
return {loc_x, loc_y};
} }
const std::vector<u8>& font::get_glyph_data() const const std::vector<u8>& font::get_glyph_data() const

View File

@ -78,7 +78,7 @@ namespace rsx
std::vector<vertex> render_text(const char32_t* text, u16 max_width = -1, bool wrap = false); std::vector<vertex> render_text(const char32_t* text, u16 max_width = -1, bool wrap = false);
std::pair<f32, f32> get_char_offset(const char32_t* text, usz max_length, u16 max_width = -1, bool wrap = false); void get_char_offset(f32& loc_x, f32& loc_y, const char32_t* text, usz max_length, u16 max_width = -1, bool wrap = false);
bool matches(std::string_view name, int size) const { return static_cast<int>(size_pt) == size && font_name == name; } bool matches(std::string_view name, int size) const { return static_cast<int>(size_pt) == size && font_name == name; }
std::string_view get_name() const { return font_name; } std::string_view get_name() const { return font_name; }

View File

@ -171,7 +171,7 @@ namespace rsx::assembler
for (const auto& inst : m_instructions) for (const auto& inst : m_instructions)
{ {
const auto src = reinterpret_cast<const be_t<u16>*>(inst.bytecode); const auto src = utils::bless<const be_t<u16>>(&inst.bytecode[0]);
for (u32 j = 0; j < inst.length; ++j) for (u32 j = 0; j < inst.length; ++j)
{ {
const u16 low = src[j * 2]; const u16 low = src[j * 2];

View File

@ -859,14 +859,14 @@ static std::optional<iso_fs_metadata> iso_read_directory_entry(fs::file& entry,
else if (names_in_ucs2) // For strings in joliet descriptor else if (names_in_ucs2) // For strings in joliet descriptor
{ {
// Characters are stored in big endian format // Characters are stored in big endian format
const u16* raw = reinterpret_cast<const u16*>(file_name.data()); const be_t<u16>* raw = utils::bless<const be_t<u16>>(file_name.data());
std::u16string utf16; std::u16string utf16;
utf16.resize(header.file_name_length / 2); utf16.resize(header.file_name_length / 2);
for (usz i = 0; i < utf16.size(); i++, raw++) for (usz i = 0; i < utf16.size(); i++)
{ {
utf16[i] = *reinterpret_cast<const be_t<u16>*>(raw); utf16[i] = raw[i];
} }
file_name = utf16_to_utf8(utf16); file_name = utf16_to_utf8(utf16);

View File

@ -1,10 +1,13 @@
#include "gamemode_control.h" #include "gamemode_control.h"
#ifdef GAMEMODE_AVAILABLE #ifdef GAMEMODE_AVAILABLE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
extern "C" { extern "C" {
#include "3rdparty/feralinteractive/feralinteractive/lib/gamemode_client.h" #include "3rdparty/feralinteractive/feralinteractive/lib/gamemode_client.h"
} }
#pragma GCC diagnostic pop
#endif #endif
// Enables and Disables GameMode based on user settings and system // Enables and Disables GameMode based on user settings and system

View File

@ -418,8 +418,12 @@ namespace rsx
{ {
auto ptr = rsx::aligned_allocator::malloc<256>(16); auto ptr = rsx::aligned_allocator::malloc<256>(16);
auto ptr2 = rsx::aligned_allocator::realloc<256>(ptr, 16, 8); auto ptr2 = rsx::aligned_allocator::realloc<256>(ptr, 16, 8);
const auto ptr_value = reinterpret_cast<uintptr_t>(ptr);
const auto ptr2_value = reinterpret_cast<uintptr_t>(ptr2);
rsx::aligned_allocator::free(ptr2); rsx::aligned_allocator::free(ptr2);
EXPECT_EQ(ptr, ptr2); EXPECT_EQ(ptr_value, ptr2_value);
} }
} }