From: Francisco Jerez Date: Tue, 17 Sep 2013 04:44:36 +0000 (-0700) Subject: clover: Delete copy constructors and assignment operators in all non-copiable objects. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5226eacf8d4ea395062bf594079acc747bcd6e97;p=mesa.git clover: Delete copy constructors and assignment operators in all non-copiable objects. Tested-by: Tom Stellard --- diff --git a/src/gallium/state_trackers/clover/core/context.hpp b/src/gallium/state_trackers/clover/core/context.hpp index 576e95281be..e739f5e2ec2 100644 --- a/src/gallium/state_trackers/clover/core/context.hpp +++ b/src/gallium/state_trackers/clover/core/context.hpp @@ -36,6 +36,8 @@ namespace clover { context(const property_list &props, const ref_vector &devs); context(const context &ctx) = delete; + context & + operator=(const context &ctx) = delete; bool has_device(device &dev) const; diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index 39322707b36..e5e429a4471 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -45,12 +45,6 @@ device::device(clover::platform &platform, pipe_loader_device *ldev) : throw error(CL_INVALID_DEVICE); } -device::device(device &&dev) : - platform(dev.platform), pipe(dev.pipe), ldev(dev.ldev) { - dev.pipe = NULL; - dev.ldev = NULL; -} - device::~device() { if (pipe) pipe->destroy(pipe); @@ -58,16 +52,6 @@ device::~device() { pipe_loader_release(&ldev, 1); } -device & -device::operator=(device dev) { - assert(&platform == &dev.platform); - - std::swap(pipe, dev.pipe); - std::swap(ldev, dev.ldev); - - return *this; -} - bool device::operator==(const device &dev) const { return this == &dev; diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp index fd6b4570f13..433ac814c21 100644 --- a/src/gallium/state_trackers/clover/core/device.hpp +++ b/src/gallium/state_trackers/clover/core/device.hpp @@ -38,11 +38,11 @@ namespace clover { class device : public ref_counter, public _cl_device_id { public: device(clover::platform &platform, pipe_loader_device *ldev); - device(device &&dev); - device(const device &dev) = delete; ~device(); - device &operator=(device dev); + device(const device &dev) = delete; + device & + operator=(const device &dev) = delete; bool operator==(const device &dev) const; diff --git a/src/gallium/state_trackers/clover/core/event.hpp b/src/gallium/state_trackers/clover/core/event.hpp index ee25d19c1e5..05bdd2f961f 100644 --- a/src/gallium/state_trackers/clover/core/event.hpp +++ b/src/gallium/state_trackers/clover/core/event.hpp @@ -57,6 +57,10 @@ namespace clover { action action_ok, action action_fail); virtual ~event(); + event(const event &ev) = delete; + event & + operator=(const event &ev) = delete; + void trigger(); void abort(cl_int status); bool signalled() const; diff --git a/src/gallium/state_trackers/clover/core/kernel.hpp b/src/gallium/state_trackers/clover/core/kernel.hpp index e469108d4be..907a9fdfbc5 100644 --- a/src/gallium/state_trackers/clover/core/kernel.hpp +++ b/src/gallium/state_trackers/clover/core/kernel.hpp @@ -42,6 +42,10 @@ namespace clover { exec_context(kernel &kern); ~exec_context(); + exec_context(const exec_context &) = delete; + exec_context & + operator=(const exec_context &) = delete; + void *bind(command_queue *q); void unbind(); @@ -66,6 +70,10 @@ namespace clover { public: argument(); + argument(const argument &arg) = delete; + argument & + operator=(const argument &arg) = delete; + /// \a true if the argument has been set. bool set() const; @@ -91,6 +99,10 @@ namespace clover { const std::string &name, const std::vector &margs); + kernel(const kernel &kern) = delete; + kernel & + operator=(const kernel &kern) = delete; + void launch(command_queue &q, const std::vector &grid_offset, const std::vector &grid_size, diff --git a/src/gallium/state_trackers/clover/core/memory.hpp b/src/gallium/state_trackers/clover/core/memory.hpp index 86f7ddaca3a..5b179ac8413 100644 --- a/src/gallium/state_trackers/clover/core/memory.hpp +++ b/src/gallium/state_trackers/clover/core/memory.hpp @@ -38,7 +38,10 @@ namespace clover { protected: memory_obj(context &ctx, cl_mem_flags flags, size_t size, void *host_ptr); + memory_obj(const memory_obj &obj) = delete; + memory_obj & + operator=(const memory_obj &obj) = delete; public: virtual ~memory_obj(); diff --git a/src/gallium/state_trackers/clover/core/platform.hpp b/src/gallium/state_trackers/clover/core/platform.hpp index 83f0cab35e9..c16229a7512 100644 --- a/src/gallium/state_trackers/clover/core/platform.hpp +++ b/src/gallium/state_trackers/clover/core/platform.hpp @@ -36,6 +36,10 @@ namespace clover { public: platform(); + platform(const platform &platform) = delete; + platform & + operator=(const platform &platform) = delete; + protected: std::vector> devs; }; diff --git a/src/gallium/state_trackers/clover/core/program.hpp b/src/gallium/state_trackers/clover/core/program.hpp index fa1afa7c66e..b8531bce1e8 100644 --- a/src/gallium/state_trackers/clover/core/program.hpp +++ b/src/gallium/state_trackers/clover/core/program.hpp @@ -38,6 +38,10 @@ namespace clover { const ref_vector &devs, const std::vector &binaries); + program(const program &prog) = delete; + program & + operator=(const program &prog) = delete; + void build(const ref_vector &devs, const char *opts); const std::string &source() const; diff --git a/src/gallium/state_trackers/clover/core/queue.hpp b/src/gallium/state_trackers/clover/core/queue.hpp index 4618a1bde02..671eaf7bddf 100644 --- a/src/gallium/state_trackers/clover/core/queue.hpp +++ b/src/gallium/state_trackers/clover/core/queue.hpp @@ -37,9 +37,12 @@ namespace clover { public: command_queue(context &ctx, device &dev, cl_command_queue_properties props); - command_queue(const command_queue &q) = delete; ~command_queue(); + command_queue(const command_queue &q) = delete; + command_queue & + operator=(const command_queue &q) = delete; + void flush(); cl_command_queue_properties props() const; diff --git a/src/gallium/state_trackers/clover/core/resource.hpp b/src/gallium/state_trackers/clover/core/resource.hpp index 99e509a63b1..f447088055a 100644 --- a/src/gallium/state_trackers/clover/core/resource.hpp +++ b/src/gallium/state_trackers/clover/core/resource.hpp @@ -25,7 +25,6 @@ #include -#include "core/object.hpp" #include "core/memory.hpp" #include "util/algebra.hpp" #include "pipe/p_state.h" @@ -41,9 +40,12 @@ namespace clover { public: typedef std::array vector; - resource(const resource &r) = delete; virtual ~resource(); + resource(const resource &r) = delete; + resource & + operator=(const resource &r) = delete; + void copy(command_queue &q, const vector &origin, const vector ®ion, resource &src_resource, const vector &src_origin); diff --git a/src/gallium/state_trackers/clover/core/sampler.hpp b/src/gallium/state_trackers/clover/core/sampler.hpp index 3d2acaa9be1..98d9550a6ec 100644 --- a/src/gallium/state_trackers/clover/core/sampler.hpp +++ b/src/gallium/state_trackers/clover/core/sampler.hpp @@ -33,6 +33,10 @@ namespace clover { cl_addressing_mode addr_mode, cl_filter_mode filter_mode); + sampler(const sampler &s) = delete; + sampler & + operator=(const sampler &s) = delete; + bool norm_mode(); cl_addressing_mode addr_mode(); cl_filter_mode filter_mode();