Skip to content

rsx: fix some warnings - #17687

Merged
elad335 merged 6 commits into
RPCS3:masterfrom
Megamouse:warnigs
Nov 15, 2025
Merged

elad335 merged 6 commits into
RPCS3:masterfrom
Megamouse:warnigs

Conversation

@Megamouse

Copy link
Copy Markdown
Contributor

No description provided.

@Megamouse Megamouse added the RSX label Nov 11, 2025
@Megamouse
Megamouse requested a review from kd-11 November 11, 2025 07:22
Comment thread rpcs3/Emu/RSX/Common/simple_array.hpp Outdated
std::memcpy(that._data, _data, size_bytes());
std::memcpy(_data, _stack_alloc, that.size_bytes());
}
else

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.

i think it makes more sense to add trivially_copyable as a Ty constraint on the entire class. None of the other methods cater to the edge case of non-copyables and the user should probably use std::vector for those.
is there a piece of code actually using this path at the moment?

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.

My reasoning is that, the container was already written to hyper-optimize common operations without typical C++ restrictions such as this one and the destructible one to speed up push/pop/swap.

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.

I added the constraint.
Maybe I still have to add a static cast to fix the warning, we'll see

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.

I guess it only works for windows xD

/rpcs3/rpcs3/Emu/RSX/Common/simple_array.hpp:19:52: note: 'std::pair<unsigned int, bool>' is not trivially copyable
/rpcs3/rpcs3/Emu/RSX/Common/simple_array.hpp:19:52: note: because it has a user provided copy assignment operator
/rpcs3/rpcs3/Emu/RSX/Common/simple_array.hpp:19:52: note: because it has a user provided move assignment operator
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_pair.h:187:12: note: 'pair<unsigned int, bool>' defined here
187 | struct pair

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.

Add an exception for std::pair and std::tuple. This is a known silly thing with std::pair and std::tuple.
Now that I think about it, this was the reason I didn't add the constraint in the first place.

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.

But then again that won't help with the "warning" despite it being harmless. The whole class has a lot of 'trust me I know what I'm doing' scenarios, especially before we had proper concepts for defining constraints. All I know is that component-wise transfer does not belong here.
Option2 - we roll a custom pair<T, U> only possible when T and U are builtin types. That should cover 99% of valid pair usages in the code which is to just avoid creating small structs to hold result values.

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.

At this point we might reimplement std::pair and not use std::tuple with simple_array.

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.

std::pair also has savestate serialization issues for the same reason so maybe we should implement a replacement class.

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.

Huh, I wasn't aware it was such a widespread pain-point but it makes sense to roll a custom one in that case.
Let's leave the constraint in place and roll a utils::pair and utils::tuple at least for use with basic types and go from there.

Comment thread rpcs3/Emu/RSX/Common/simple_array.hpp Outdated
@Megamouse
Megamouse force-pushed the warnigs branch 7 times, most recently from b7d2bf8 to c48640c Compare November 12, 2025 23:36

@PZerua PZerua left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You meant is_trivially_copyable<T2> in pair.hpp line 8?

Pd: Sorry doing this with my phone and messed up, meant to comment directly on the code.

@Megamouse
Megamouse force-pushed the warnigs branch 2 times, most recently from ce17007 to 8c76980 Compare November 14, 2025 12:10
@elad335
elad335 merged commit 18111ac into RPCS3:master Nov 15, 2025
8 of 9 checks passed
@Megamouse
Megamouse deleted the warnigs branch November 16, 2025 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants