clover: Delete copy constructors and assignment operators in all non-copiable objects.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 17 Sep 2013 04:44:36 +0000 (21:44 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Mon, 21 Oct 2013 17:47:03 +0000 (10:47 -0700)
Tested-by: Tom Stellard <thomas.stellard@amd.com>
src/gallium/state_trackers/clover/core/context.hpp
src/gallium/state_trackers/clover/core/device.cpp
src/gallium/state_trackers/clover/core/device.hpp
src/gallium/state_trackers/clover/core/event.hpp
src/gallium/state_trackers/clover/core/kernel.hpp
src/gallium/state_trackers/clover/core/memory.hpp
src/gallium/state_trackers/clover/core/platform.hpp
src/gallium/state_trackers/clover/core/program.hpp
src/gallium/state_trackers/clover/core/queue.hpp
src/gallium/state_trackers/clover/core/resource.hpp
src/gallium/state_trackers/clover/core/sampler.hpp

index 576e95281be361c9324a7fc60c65585f35acddb4..e739f5e2ec23910cdad1861f5cee9e6ca70f8cdf 100644 (file)
@@ -36,6 +36,8 @@ namespace clover {
       context(const property_list &props, const ref_vector<device> &devs);
 
       context(const context &ctx) = delete;
+      context &
+      operator=(const context &ctx) = delete;
 
       bool has_device(device &dev) const;
 
index 39322707b36d572d1c95453add6cee4f14fde0fc..e5e429a44714436548112137588d633f077a76e8 100644 (file)
@@ -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;
index fd6b4570f139bd4e2c7c5ea024f56bc6cb215d55..433ac814c2194b0700a75a007d54b0e2211cbe7c 100644 (file)
@@ -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;
index ee25d19c1e58972f03a43de11009edba32b8ebf4..05bdd2f961f00e3552a068fc85f595093510b1e5 100644 (file)
@@ -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;
index e469108d4be97c8a0cf1474661b9d75ab940a5b9..907a9fdfbc5efafaddfcd1c0291eb8b9c556fb5c 100644 (file)
@@ -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<module::argument> &margs);
 
+      kernel(const kernel &kern) = delete;
+      kernel &
+      operator=(const kernel &kern) = delete;
+
       void launch(command_queue &q,
                   const std::vector<size_t> &grid_offset,
                   const std::vector<size_t> &grid_size,
index 86f7ddaca3a53be27aaf662a86ef6204ed3caf77..5b179ac8413e3e8a21a2849785cba66803b091e2 100644 (file)
@@ -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();
index 83f0cab35e949e511642b842b6e9d2363be81771..c16229a7512daf87fb68f6eaa214900d68351bb3 100644 (file)
@@ -36,6 +36,10 @@ namespace clover {
    public:
       platform();
 
+      platform(const platform &platform) = delete;
+      platform &
+      operator=(const platform &platform) = delete;
+
    protected:
       std::vector<ref_ptr<device>> devs;
    };
index fa1afa7c66e23dcc00eede3d7cd85fcadea62c0e..b8531bce1e8e8426d7508c2110bb48b1648d5077 100644 (file)
@@ -38,6 +38,10 @@ namespace clover {
               const ref_vector<device> &devs,
               const std::vector<module> &binaries);
 
+      program(const program &prog) = delete;
+      program &
+      operator=(const program &prog) = delete;
+
       void build(const ref_vector<device> &devs, const char *opts);
 
       const std::string &source() const;
index 4618a1bde02c1094abd9cd2e92b4fa3a6597c5df..671eaf7bddfde2bd0577b3d6fa17575af85e3afd 100644 (file)
@@ -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;
index 99e509a63b16d339c8c06a8f4cebb01ebf883e0b..f447088055a234a865738a5aaa35c93ca77e4ae2 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <list>
 
-#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<size_t, 3> 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 &region,
                 resource &src_resource, const vector &src_origin);
 
index 3d2acaa9be186a8aefa3917053f8f6ab143b77ac..98d9550a6ec325a33fe33c51b0ce3e4148e0ebe6 100644 (file)
@@ -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();