Skip to content

Fix some warnings - #17703

Merged
elad335 merged 4 commits into
RPCS3:masterfrom
Megamouse:configgs
Nov 17, 2025
Merged

elad335 merged 4 commits into
RPCS3:masterfrom
Megamouse:configgs

Conversation

@Megamouse

Copy link
Copy Markdown
Contributor
  • Fixes some compiler warnings
  • Forward declare gui_settings

@Megamouse Megamouse added the Refactoring Refactors or simplifies existing code label Nov 16, 2025
Comment thread rpcs3/Emu/RSX/VK/VKCompute.cpp Outdated
{
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
.stage = {
.stage = VkPipelineShaderStageCreateInfo{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? What speaks against it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me and my hatred for extra keystrokes. It's not like stage can be anything else other than VkPipelineShaderStageCreateInfo.

{
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);
const auto& [caret_x, caret_y] = renderer->get_char_offset(text.c_str(), caret_position, clip_text ? w : -1, wrap_text);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the get_char_offset returns a temp var. Why would you take a reference to that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a performance warning on gcc arm if I saw correctly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is weird, but shouldn't crash either way. I'm not sure why arm would refuse to ellide the copy on return there but the compiler people must have had their reasons I guess.

@oltolm

oltolm commented Nov 16, 2025

Copy link
Copy Markdown
Contributor

While you are fixing warnings, can you also fix these 2?

n file included from C:/src/rpcs3/rpcs3/Emu/Cell/SPULLVMRecompiler.cpp:30:
C:/src/rpcs3/rpcs3/Emu/../Emu/CPU/CPUTranslator.h:4010:30: warning: 'ArrayRef' is deprecated: Use {} or ArrayRef<T>() instead [-Wdeprecated-declarations]
 4010 |         llvm::ArrayRef<llvm::Type*> types_ref = std::nullopt;
      |                                     ^~~~~~~~~
      |                                     {}
C:/msys64/clang64/include/llvm/ADT/ArrayRef.h:70:18: note: 'ArrayRef' has been explicitly marked deprecated here
   70 |     /*implicit*/ LLVM_DEPRECATED("Use {} or ArrayRef<T>() instead", "{}")
      |                  ^
C:/msys64/clang64/include/llvm/Support/Compiler.h:250:50: note: expanded from macro 'LLVM_DEPRECATED'
  250 | #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
      |                                                  ^
diff --git a/rpcs3/Emu/CPU/CPUTranslator.h b/rpcs3/Emu/CPU/CPUTranslator.h
index 8d1a5d42a..a2f6a58e1 100644
--- a/rpcs3/Emu/CPU/CPUTranslator.h
+++ b/rpcs3/Emu/CPU/CPUTranslator.h
@@ -4007,7 +4007,7 @@ llvm::CallInst* llvm_asm(
 	const std::string& constraints,
 	llvm::LLVMContext& context)
 {
-	llvm::ArrayRef<llvm::Type*> types_ref = std::nullopt;
+	llvm::ArrayRef<llvm::Type*> types_ref{};
 	std::vector<llvm::Type*> types;
 	types.reserve(args.size());

and this one

C:/src/rpcs3/rpcs3/util/sysinfo.cpp:78:13: warning: unused variable 'read_reg_dword' [-Wunused-const-variable]
   78 |         const auto read_reg_dword = [](HKEY hKey, std::string_view value_name) -> std::pair<bool, DWORD>
      |                    ^~~~~~~~~~~~~~
C:/src/rpcs3/rpcs3/util/sysinfo.cpp:89:13: warning: unused variable 'read_reg_sz' [-Wunused-const-variable]
   89 |         const auto read_reg_sz = [](HKEY hKey, std::string_view value_name) -> std::pair<bool, std::string>
      |                    ^~~~~~~~~~~
2 warnings generated.
diff --git a/rpcs3/util/sysinfo.cpp b/rpcs3/util/sysinfo.cpp
index 52bb6f27b..28c68c867 100755
--- a/rpcs3/util/sysinfo.cpp
+++ b/rpcs3/util/sysinfo.cpp
@@ -74,6 +74,7 @@ namespace Darwin_ProcessInfo
 namespace utils
 {
 #ifdef _WIN32
+#if !defined(ARCH_X64)
 	// Some helpers for sanity
 	const auto read_reg_dword = [](HKEY hKey, std::string_view value_name) -> std::pair<bool, DWORD>
 	{
@@ -110,7 +111,6 @@ namespace utils
 		return { true, sz };
 	};
 
-#if !defined(ARCH_X64)
 	// Alternative way to read OS version using the registry.
 	static std::string get_fallback_windows_version()
 	{

@elad335
elad335 merged commit 42177ad into RPCS3:master Nov 17, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactoring Refactors or simplifies existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants