[Bf-blender-cvs] [92774ff] master: Cycles: Use explicit qualifier for single-argument constructors

Sergey Sharybin noreply at git.blender.org
Wed May 11 16:51:14 CEST 2016


Commit: 92774ff792a6c474df2a40c13204da4975de0c09
Author: Sergey Sharybin
Date:   Wed May 11 16:50:10 2016 +0200
Branches: master
https://developer.blender.org/rB92774ff792a6c474df2a40c13204da4975de0c09

Cycles: Use explicit qualifier for single-argument constructors

Almost in all cases we want such constructors to be explicit, there are
exceptions but only in few places.

===================================================================

M	intern/cycles/bvh/bvh_node.h
M	intern/cycles/bvh/bvh_sort.cpp
M	intern/cycles/device/device_multi.cpp
M	intern/cycles/device/device_network.h
M	intern/cycles/device/device_task.h
M	intern/cycles/render/attribute.h
M	intern/cycles/render/buffers.h
M	intern/cycles/render/graph.h
M	intern/cycles/render/image.h
M	intern/cycles/render/nodes.h
M	intern/cycles/render/session.h
M	intern/cycles/render/svm.h
M	intern/cycles/subd/subd_dice.h
M	intern/cycles/subd/subd_mesh.cpp
M	intern/cycles/subd/subd_split.h
M	intern/cycles/util/util_debug.h
M	intern/cycles/util/util_path.cpp
M	intern/cycles/util/util_task.h
M	intern/cycles/util/util_time.h
M	intern/cycles/util/util_vector.h

===================================================================

diff --git a/intern/cycles/bvh/bvh_node.h b/intern/cycles/bvh/bvh_node.h
index 44f5518..d476fb9 100644
--- a/intern/cycles/bvh/bvh_node.h
+++ b/intern/cycles/bvh/bvh_node.h
@@ -75,7 +75,7 @@ public:
 			m_visibility = 0; /* happens on build cancel */
 	}
 
-	InnerNode(const BoundBox& bounds)
+	explicit InnerNode(const BoundBox& bounds)
 	{
 		m_bounds = bounds;
 		m_visibility = 0;
diff --git a/intern/cycles/bvh/bvh_sort.cpp b/intern/cycles/bvh/bvh_sort.cpp
index c127519..f6bbdb2 100644
--- a/intern/cycles/bvh/bvh_sort.cpp
+++ b/intern/cycles/bvh/bvh_sort.cpp
@@ -40,7 +40,7 @@ struct BVHReferenceCompare {
 public:
 	int dim;
 
-	BVHReferenceCompare(int dim_)
+	explicit BVHReferenceCompare(int dim_)
 	{
 		dim = dim_;
 	}
@@ -184,7 +184,7 @@ void bvh_reference_sort(int start, int end, BVHReference *data, int dim)
 	}
 	else {
 		TaskPool task_pool;
-		bvh_reference_sort_threaded(&task_pool, data, start, end - 1, dim);
+		bvh_reference_sort_threaded(&task_pool, data, start, end - 1, compare);
 		task_pool.wait_work();
 	}
 }
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 069305e..6141f9a 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -35,7 +35,7 @@ class MultiDevice : public Device
 {
 public:
 	struct SubDevice {
-		SubDevice(Device *device_)
+		explicit SubDevice(Device *device_)
 		: device(device_) {}
 
 		Device *device;
diff --git a/intern/cycles/device/device_network.h b/intern/cycles/device/device_network.h
index 60ecc1d..d28cfe3 100644
--- a/intern/cycles/device/device_network.h
+++ b/intern/cycles/device/device_network.h
@@ -322,7 +322,7 @@ protected:
 
 class ServerDiscovery {
 public:
-	ServerDiscovery(bool discover = false)
+	explicit ServerDiscovery(bool discover = false)
 	: listen_socket(io_service), collect_servers(false)
 	{
 		/* setup listen socket */
diff --git a/intern/cycles/device/device_task.h b/intern/cycles/device/device_task.h
index d7912f3..8423e83 100644
--- a/intern/cycles/device/device_task.h
+++ b/intern/cycles/device/device_task.h
@@ -51,7 +51,7 @@ public:
 	int shader_filter;
 	int shader_x, shader_w;
 
-	DeviceTask(Type type = PATH_TRACE);
+	explicit DeviceTask(Type type = PATH_TRACE);
 
 	int get_subtask_count(int num, int max_size = 0);
 	void split(list<DeviceTask>& tasks, int num, int max_size = 0);
diff --git a/intern/cycles/render/attribute.h b/intern/cycles/render/attribute.h
index bbc6cf7..01102d2 100644
--- a/intern/cycles/render/attribute.h
+++ b/intern/cycles/render/attribute.h
@@ -134,8 +134,8 @@ public:
 	AttributeElement triangle_element, curve_element;
 	int triangle_offset, curve_offset;
 
-	AttributeRequest(ustring name_);
-	AttributeRequest(AttributeStandard std);
+	explicit AttributeRequest(ustring name_);
+	explicit AttributeRequest(AttributeStandard std);
 };
 
 /* AttributeRequestSet
diff --git a/intern/cycles/render/buffers.h b/intern/cycles/render/buffers.h
index 4fa1c51..57ffd96 100644
--- a/intern/cycles/render/buffers.h
+++ b/intern/cycles/render/buffers.h
@@ -73,7 +73,7 @@ public:
 	/* random number generator state */
 	device_vector<uint> rng_state;
 
-	RenderBuffers(Device *device);
+	explicit RenderBuffers(Device *device);
 	~RenderBuffers();
 
 	void reset(Device *device, BufferParams& params);
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index 6619fca..b1ebdbf 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -177,7 +177,7 @@ public:
 
 class ShaderNode {
 public:
-	ShaderNode(const char *name);
+	explicit ShaderNode(const char *name);
 	virtual ~ShaderNode();
 
 	ShaderInput *input(const char *name);
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 1bb9987..02dc189 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -32,7 +32,7 @@ class Progress;
 
 class ImageManager {
 public:
-	ImageManager(const DeviceInfo& info);
+	explicit ImageManager(const DeviceInfo& info);
 	~ImageManager();
 
 	enum ImageDataType {
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 7ae37a6..ccfea03 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -75,7 +75,7 @@ public:
 
 class TextureNode : public ShaderNode {
 public:
-	TextureNode(const char *name_) : ShaderNode(name_) {}
+	explicit TextureNode(const char *name_) : ShaderNode(name_) {}
 	TextureMapping tex_mapping;
 
 	virtual bool equals(const ShaderNode *other) {
@@ -87,7 +87,7 @@ public:
 /* Any node which uses image manager's slot should be a subclass of this one. */
 class ImageSlotTextureNode : public TextureNode {
 public:
-	ImageSlotTextureNode(const char *name_) : TextureNode(name_) {
+	explicit ImageSlotTextureNode(const char *name_) : TextureNode(name_) {
 		special_type = SHADER_SPECIAL_TYPE_IMAGE_SLOT;
 	}
 	int slot;
@@ -379,7 +379,7 @@ public:
 
 class BsdfNode : public ShaderNode {
 public:
-	BsdfNode(bool scattering = false);
+	explicit BsdfNode(bool scattering = false);
 	SHADER_NODE_BASE_CLASS(BsdfNode);
 
 	bool has_spatial_varying() { return true; }
diff --git a/intern/cycles/render/session.h b/intern/cycles/render/session.h
index 02d97ce..8bff0f9 100644
--- a/intern/cycles/render/session.h
+++ b/intern/cycles/render/session.h
@@ -129,7 +129,7 @@ public:
 	function<void(RenderTile&)> write_render_tile_cb;
 	function<void(RenderTile&)> update_render_tile_cb;
 
-	Session(const SessionParams& params);
+	explicit Session(const SessionParams& params);
 	~Session();
 
 	void start();
diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h
index f4777de..5ff98ac 100644
--- a/intern/cycles/render/svm.h
+++ b/intern/cycles/render/svm.h
@@ -150,7 +150,7 @@ protected:
 
 	/* Global state of the compiler accessible from the compilation routines. */
 	struct CompilerState {
-		CompilerState(ShaderGraph *graph);
+		explicit CompilerState(ShaderGraph *graph);
 
 		/* ** Global state, used by various compilation steps. ** */
 
diff --git a/intern/cycles/subd/subd_dice.h b/intern/cycles/subd/subd_dice.h
index 8450a43..49f786e 100644
--- a/intern/cycles/subd/subd_dice.h
+++ b/intern/cycles/subd/subd_dice.h
@@ -70,7 +70,7 @@ public:
 	size_t vert_offset;
 	size_t tri_offset;
 
-	EdgeDice(const SubdParams& params);
+	explicit EdgeDice(const SubdParams& params);
 
 	void reserve(int num_verts, int num_tris);
 
@@ -111,7 +111,7 @@ public:
 		int tv1;
 	};
 
-	QuadDice(const SubdParams& params);
+	explicit QuadDice(const SubdParams& params);
 
 	void reserve(EdgeFactors& ef, int Mu, int Mv);
 	float3 eval_projected(SubPatch& sub, float u, float v);
@@ -165,7 +165,7 @@ public:
 		int tw;
 	};
 
-	TriangleDice(const SubdParams& params);
+	explicit TriangleDice(const SubdParams& params);
 
 	void reserve(EdgeFactors& ef, int M);
 
diff --git a/intern/cycles/subd/subd_mesh.cpp b/intern/cycles/subd/subd_mesh.cpp
index d7cb7b9..56d7d2b 100644
--- a/intern/cycles/subd/subd_mesh.cpp
+++ b/intern/cycles/subd/subd_mesh.cpp
@@ -291,7 +291,7 @@ public:
 	int id;
 	float3 co;
 	
-	SubdVert(int id_)
+	explicit SubdVert(int id_)
 	{
 		id = id_;
 		co = make_float3(0.0f, 0.0f, 0.0f);
@@ -307,7 +307,7 @@ public:
 	int numverts;
 	int verts[4];
 
-	SubdFace(int id_)
+	explicit SubdFace(int id_)
 	{
 		id = id_;
 		numverts = 0;
diff --git a/intern/cycles/subd/subd_split.h b/intern/cycles/subd/subd_split.h
index f04c51d..bbe921f 100644
--- a/intern/cycles/subd/subd_split.h
+++ b/intern/cycles/subd/subd_split.h
@@ -43,7 +43,7 @@ public:
 
 	SubdParams params;
 
-	DiagSplit(const SubdParams& params);
+	explicit DiagSplit(const SubdParams& params);
 
 	float3 to_world(Patch *patch, float2 uv);
 	int T(Patch *patch, float2 Pstart, float2 Pend);
diff --git a/intern/cycles/util/util_debug.h b/intern/cycles/util/util_debug.h
index 641abcc..1787ff6 100644
--- a/intern/cycles/util/util_debug.h
+++ b/intern/cycles/util/util_debug.h
@@ -130,11 +130,11 @@ private:
 
 #if (__cplusplus > 199711L)
 public:
-	DebugFlags(DebugFlags const& /*other*/)     = delete;
+	explicit DebugFlags(DebugFlags const& /*other*/)     = delete;
 	void operator=(DebugFlags const& /*other*/) = delete;
 #else
 private:
-	DebugFlags(DebugFlags const& /*other*/);
+	explicit DebugFlags(DebugFlags const& /*other*/);
 	void operator=(DebugFlags const& /*other*/);
 #endif
 };
diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp
index 8375472..0c848be 100644
--- a/intern/cycles/util/util_path.cpp
+++ b/intern/cycles/util/util_path.cpp
@@ -92,7 +92,7 @@ public:
 	{
 	}
 
-	directory_iterator(const string& path)
+	explicit directory_iterator(const string& path)
 	: path_(path),
 	  path_info_(path, find_data_)
 	{
@@ -176,7 +176,7 @@ class directory_iterator {
 public:
 	class path_info {
 	public:
-		path_info(const string& path)
+		explicit path_info(const string& path)
 		: path_(path),
 		  entry_(NULL)
 		{
@@ -203,7 +203,7 @@ public:
 	{
 	}
 
-	directory_iterator(const string& path)
+	explicit directory_iterator(const string& path)
 	: path_(path),
 	  path_info_(path_),
 	  cur_entry_(0)
diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h
index d697ebf..0b82f14 100644
--- a/intern/cycles/util/util_task.h
+++ b/intern/cycles/util/util_task.h
@@ -52,7 +52,7 @@ class Task
 {
 public:
 	Task() {};
-	Task(const TaskRunFunction& run_) : run(run_) {}
+	explicit Task(const TaskRunFunction& run_) : run(run_) {}
 
 	virtual ~Task() {}
 
diff --git a/intern/cycles/util/util_time.h b/intern/cycles/util/util_time.h
index 9cd52d5..a5b074b 100644
--- a/intern/cycles/util/util_time.h
+++ b/intern/cycles/util/util_time.h
@@ -29,7 +29,7 @@ void time_sleep(double t);
 
 class scoped_timer {
 public:
-	scoped_timer(double *value) : value_(value)
+	explicit scoped_timer(double *value) : value_(value)
 	{
 		time_start_ = time_dt();
 	}
diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h
index ad579da..b5ee7f9 100644
--- a/intern/cycles/util/util_vector.h
+++ b/intern/cycles/util/util_vector.h
@@ -98,7 +98,7 @@ public:
 	  capacity_(0)
 	{}
 
-	array(size_t newsize)
+	explicit array(size_t newsize)
 	{
 		if(newsize == 0) {
 			data_ = NULL;




More information about the Bf-blender-cvs mailing list