1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Enable -Wdeprecated-copy

Some classes violated the Rule of 3(5) in their special operator definitions.
This commit is contained in:
Nekotekina 2021-03-29 16:20:10 +03:00
parent 870224cde0
commit deacf05769
4 changed files with 55 additions and 8 deletions

View File

@ -242,6 +242,18 @@ struct RSXFragmentProgram
}
data_storage_helper(const data_storage_helper& other)
{
this->operator=(other);
}
data_storage_helper(data_storage_helper&& other)
: data_ptr(other.data_ptr)
, local_storage(std::move(other.local_storage))
{
other.data_ptr = nullptr;
}
data_storage_helper& operator=(const data_storage_helper& other)
{
if (other.data_ptr == other.local_storage.data())
{
@ -253,6 +265,20 @@ struct RSXFragmentProgram
data_ptr = other.data_ptr;
local_storage.clear();
}
return *this;
}
data_storage_helper& operator=(data_storage_helper&& other)
{
if (this != &other)
{
data_ptr = other.data_ptr;
local_storage = std::move(other.local_storage);
other.data_ptr = nullptr;
}
return *this;
}
void deep_copy(u32 max_length)

View File

@ -390,11 +390,11 @@ namespace rsx
void thread::capture_frame(const std::string &name)
{
frame_trace_data::draw_state draw_state = {};
frame_trace_data::draw_state draw_state{};
draw_state.programs = get_programs();
draw_state.name = name;
frame_debug.draw_calls.push_back(draw_state);
frame_debug.draw_calls.emplace_back(std::move(draw_state));
}
void thread::begin()

View File

@ -475,7 +475,7 @@ namespace rsx
return decoded_type<opcode>(register_value);
}
rsx_state &operator=(const rsx_state& in)
rsx_state& operator=(const rsx_state& in)
{
registers = in.registers;
transform_program = in.transform_program;
@ -484,6 +484,15 @@ namespace rsx
return *this;
}
rsx_state& operator=(rsx_state&& in)
{
registers = std::move(in.registers);
transform_program = std::move(in.transform_program);
transform_constants = std::move(in.transform_constants);
register_vertex_info = std::move(in.register_vertex_info);
return *this;
}
std::array<fragment_texture, 16> fragment_textures;
std::array<vertex_texture, 4> vertex_textures;
@ -521,13 +530,25 @@ namespace rsx
}
public:
rsx_state() :
fragment_textures(fill_array<fragment_texture>(registers, std::make_index_sequence<16>())),
vertex_textures(fill_array<vertex_texture>(registers, std::make_index_sequence<4>())),
vertex_arrays_info(fill_array<data_array_format_info>(registers, std::make_index_sequence<16>()))
rsx_state()
: fragment_textures(fill_array<fragment_texture>(registers, std::make_index_sequence<16>()))
, vertex_textures(fill_array<vertex_texture>(registers, std::make_index_sequence<4>()))
, vertex_arrays_info(fill_array<data_array_format_info>(registers, std::make_index_sequence<16>()))
{
}
rsx_state(const rsx_state& other)
: rsx_state()
{
this->operator=(other);
}
rsx_state(rsx_state&& other)
: rsx_state()
{
this->operator=(std::move(other));
}
~rsx_state() = default;
void decode(u32 reg, u32 value);

View File

@ -36,7 +36,7 @@ else()
add_compile_options(-Wignored-qualifiers)
add_compile_options(-Wredundant-move)
add_compile_options(-Wcast-qual)
#add_compile_options(-Wdeprecated-copy)
add_compile_options(-Wdeprecated-copy)
add_compile_options(-Wtautological-compare)
#add_compile_options(-Wshadow)
#add_compile_options(-Wconversion)