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) 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()) if (other.data_ptr == other.local_storage.data())
{ {
@ -253,6 +265,20 @@ struct RSXFragmentProgram
data_ptr = other.data_ptr; data_ptr = other.data_ptr;
local_storage.clear(); 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) void deep_copy(u32 max_length)

View file

@ -390,11 +390,11 @@ namespace rsx
void thread::capture_frame(const std::string &name) 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.programs = get_programs();
draw_state.name = name; 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() void thread::begin()

View file

@ -484,6 +484,15 @@ namespace rsx
return *this; 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<fragment_texture, 16> fragment_textures;
std::array<vertex_texture, 4> vertex_textures; std::array<vertex_texture, 4> vertex_textures;
@ -521,13 +530,25 @@ namespace rsx
} }
public: public:
rsx_state() : rsx_state()
fragment_textures(fill_array<fragment_texture>(registers, std::make_index_sequence<16>())), : 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_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>())) , 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; ~rsx_state() = default;
void decode(u32 reg, u32 value); void decode(u32 reg, u32 value);

View file

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