Skip to content

Commit 4badf64

Browse files
diablodalealalek
authored andcommitted
add noexcept to default constructors of cv::ocl
- follows iso c++ guideline C.44 - enables default compiler-created constructors to also be noexcept original commit: 77e26a7 - handled KernelArg, Image2D
1 parent 8f6ba5a commit 4badf64

File tree

3 files changed

+33
-30
lines changed

3 files changed

+33
-30
lines changed

modules/core/include/opencv2/core/ocl.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class CV_EXPORTS Image2D;
7070
class CV_EXPORTS_W_SIMPLE Device
7171
{
7272
public:
73-
CV_WRAP Device();
73+
CV_WRAP Device() CV_NOEXCEPT;
7474
explicit Device(void* d);
7575
Device(const Device& d);
7676
Device& operator = (const Device& d);
@@ -238,7 +238,7 @@ class CV_EXPORTS_W_SIMPLE Device
238238
class CV_EXPORTS Context
239239
{
240240
public:
241-
Context();
241+
Context() CV_NOEXCEPT;
242242
explicit Context(int dtype);
243243
~Context();
244244
Context(const Context& c);
@@ -269,7 +269,7 @@ class CV_EXPORTS Context
269269
class CV_EXPORTS Platform
270270
{
271271
public:
272-
Platform();
272+
Platform() CV_NOEXCEPT;
273273
~Platform();
274274
Platform(const Platform& p);
275275
Platform& operator = (const Platform& p);
@@ -324,7 +324,7 @@ void initializeContextFromHandle(Context& ctx, void* platform, void* context, vo
324324
class CV_EXPORTS Queue
325325
{
326326
public:
327-
Queue();
327+
Queue() CV_NOEXCEPT;
328328
explicit Queue(const Context& c, const Device& d=Device());
329329
~Queue();
330330
Queue(const Queue& q);
@@ -350,7 +350,7 @@ class CV_EXPORTS KernelArg
350350
public:
351351
enum { LOCAL=1, READ_ONLY=2, WRITE_ONLY=4, READ_WRITE=6, CONSTANT=8, PTR_ONLY = 16, NO_SIZE=256 };
352352
KernelArg(int _flags, UMat* _m, int wscale=1, int iwscale=1, const void* _obj=0, size_t _sz=0);
353-
KernelArg();
353+
KernelArg() CV_NOEXCEPT;
354354

355355
static KernelArg Local(size_t localMemSize)
356356
{ return KernelArg(LOCAL, 0, 1, 1, 0, localMemSize); }
@@ -387,7 +387,7 @@ class CV_EXPORTS KernelArg
387387
class CV_EXPORTS Kernel
388388
{
389389
public:
390-
Kernel();
390+
Kernel() CV_NOEXCEPT;
391391
Kernel(const char* kname, const Program& prog);
392392
Kernel(const char* kname, const ProgramSource& prog,
393393
const String& buildopts = String(), String* errmsg=0);
@@ -597,7 +597,7 @@ class CV_EXPORTS Kernel
597597
class CV_EXPORTS Program
598598
{
599599
public:
600-
Program();
600+
Program() CV_NOEXCEPT;
601601
Program(const ProgramSource& src,
602602
const String& buildflags, String& errmsg);
603603
Program(const Program& prog);
@@ -642,7 +642,7 @@ class CV_EXPORTS ProgramSource
642642
public:
643643
typedef uint64 hash_t; // deprecated
644644

645-
ProgramSource();
645+
ProgramSource() CV_NOEXCEPT;
646646
explicit ProgramSource(const String& module, const String& name, const String& codeStr, const String& codeHash);
647647
explicit ProgramSource(const String& prog); // deprecated
648648
explicit ProgramSource(const char* prog); // deprecated
@@ -711,7 +711,7 @@ class CV_EXPORTS ProgramSource
711711
class CV_EXPORTS PlatformInfo
712712
{
713713
public:
714-
PlatformInfo();
714+
PlatformInfo() CV_NOEXCEPT;
715715
explicit PlatformInfo(void* id);
716716
~PlatformInfo();
717717

@@ -776,7 +776,7 @@ CV_EXPORTS void buildOptionsAddMatrixDescription(String& buildOptions, const Str
776776
class CV_EXPORTS Image2D
777777
{
778778
public:
779-
Image2D();
779+
Image2D() CV_NOEXCEPT;
780780

781781
/**
782782
@param src UMat object from which to get image properties and data

modules/core/src/ocl.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ struct Platform::Impl
11141114
bool initialized;
11151115
};
11161116

1117-
Platform::Platform()
1117+
Platform::Platform() CV_NOEXCEPT
11181118
{
11191119
p = 0;
11201120
}
@@ -1310,7 +1310,7 @@ struct Device::Impl
13101310
};
13111311

13121312

1313-
Device::Device()
1313+
Device::Device() CV_NOEXCEPT
13141314
{
13151315
p = 0;
13161316
}
@@ -2283,7 +2283,7 @@ struct Context::Impl
22832283
};
22842284

22852285

2286-
Context::Context()
2286+
Context::Context() CV_NOEXCEPT
22872287
{
22882288
p = 0;
22892289
}
@@ -2654,7 +2654,7 @@ struct Queue::Impl
26542654
cv::ocl::Queue profiling_queue_;
26552655
};
26562656

2657-
Queue::Queue()
2657+
Queue::Queue() CV_NOEXCEPT
26582658
{
26592659
p = 0;
26602660
}
@@ -2734,7 +2734,7 @@ static cl_command_queue getQueue(const Queue& q)
27342734

27352735
/////////////////////////////////////////// KernelArg /////////////////////////////////////////////
27362736

2737-
KernelArg::KernelArg()
2737+
KernelArg::KernelArg() CV_NOEXCEPT
27382738
: flags(0), m(0), obj(0), sz(0), wscale(1), iwscale(1)
27392739
{
27402740
}
@@ -2876,7 +2876,7 @@ static void CL_CALLBACK oclCleanupCallback(cl_event e, cl_int, void *p)
28762876

28772877
namespace cv { namespace ocl {
28782878

2879-
Kernel::Kernel()
2879+
Kernel::Kernel() CV_NOEXCEPT
28802880
{
28812881
p = 0;
28822882
}
@@ -3466,7 +3466,7 @@ struct ProgramSource::Impl
34663466
};
34673467

34683468

3469-
ProgramSource::ProgramSource()
3469+
ProgramSource::ProgramSource() CV_NOEXCEPT
34703470
{
34713471
p = 0;
34723472
}
@@ -3975,7 +3975,10 @@ struct Program::Impl
39753975
};
39763976

39773977

3978-
Program::Program() { p = 0; }
3978+
Program::Program() CV_NOEXCEPT
3979+
{
3980+
p = 0;
3981+
}
39793982

39803983
Program::Program(const ProgramSource& src,
39813984
const String& buildflags, String& errmsg)
@@ -5999,7 +6002,7 @@ struct PlatformInfo::Impl
59996002
int versionMinor_;
60006003
};
60016004

6002-
PlatformInfo::PlatformInfo()
6005+
PlatformInfo::PlatformInfo() CV_NOEXCEPT
60036006
{
60046007
p = 0;
60056008
}
@@ -6566,7 +6569,7 @@ struct Image2D::Impl
65666569
cl_mem handle;
65676570
};
65686571

6569-
Image2D::Image2D()
6572+
Image2D::Image2D() CV_NOEXCEPT
65706573
{
65716574
p = NULL;
65726575
}

modules/core/src/ocl_disabled.impl.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CV_EXPORTS_W void finish() { /* nothing */ }
3434

3535
CV_EXPORTS bool haveSVM() { return false; }
3636

37-
Device::Device() : p(NULL) { }
37+
Device::Device() CV_NOEXCEPT : p(NULL) { }
3838
Device::Device(void* d) : p(NULL) { OCL_NOT_AVAILABLE(); }
3939
Device::Device(const Device& d) : p(NULL) { }
4040
Device& Device::operator=(const Device& d) { return *this; }
@@ -145,7 +145,7 @@ const Device& Device::getDefault()
145145
}
146146

147147

148-
Context::Context() : p(NULL) { }
148+
Context::Context() CV_NOEXCEPT : p(NULL) { }
149149
Context::Context(int dtype) : p(NULL) { }
150150
Context::~Context() { }
151151
Context::Context(const Context& c) : p(NULL) { }
@@ -169,7 +169,7 @@ void* Context::ptr() const { return NULL; }
169169
bool Context::useSVM() const { return false; }
170170
void Context::setUseSVM(bool enabled) { }
171171

172-
Platform::Platform() : p(NULL) { }
172+
Platform::Platform() CV_NOEXCEPT : p(NULL) { }
173173
Platform::~Platform() { }
174174
Platform::Platform(const Platform&) : p(NULL) { }
175175
Platform& Platform::operator=(const Platform&) { return *this; }
@@ -189,7 +189,7 @@ void convertFromImage(void* cl_mem_image, UMat& dst) { OCL_NOT_AVAILABLE(); }
189189

190190
void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device) { OCL_NOT_AVAILABLE(); }
191191

192-
Queue::Queue() : p(NULL) { }
192+
Queue::Queue() CV_NOEXCEPT : p(NULL) { }
193193
Queue::Queue(const Context& c, const Device& d) : p(NULL) { OCL_NOT_AVAILABLE(); }
194194
Queue::~Queue() { }
195195
Queue::Queue(const Queue& q) {}
@@ -209,7 +209,7 @@ Queue& Queue::getDefault()
209209
const Queue& Queue::getProfilingQueue() const { OCL_NOT_AVAILABLE(); }
210210

211211

212-
KernelArg::KernelArg()
212+
KernelArg::KernelArg() CV_NOEXCEPT
213213
: flags(0), m(0), obj(0), sz(0), wscale(1), iwscale(1)
214214
{
215215
}
@@ -226,7 +226,7 @@ KernelArg KernelArg::Constant(const Mat& m)
226226
}
227227

228228

229-
Kernel::Kernel() : p(NULL) { }
229+
Kernel::Kernel() CV_NOEXCEPT : p(NULL) { }
230230
Kernel::Kernel(const char* kname, const Program& prog) : p(NULL) { OCL_NOT_AVAILABLE(); }
231231
Kernel::Kernel(const char* kname, const ProgramSource& prog, const String& buildopts, String* errmsg) : p(NULL) { OCL_NOT_AVAILABLE(); }
232232
Kernel::~Kernel() { }
@@ -255,7 +255,7 @@ size_t Kernel::localMemSize() const { OCL_NOT_AVAILABLE(); }
255255
void* Kernel::ptr() const { return NULL; }
256256

257257

258-
Program::Program() : p(NULL) { }
258+
Program::Program() CV_NOEXCEPT : p(NULL) { }
259259
Program::Program(const ProgramSource& src, const String& buildflags, String& errmsg) : p(NULL) { OCL_NOT_AVAILABLE(); }
260260
Program::Program(const Program& prog) : p(NULL) { }
261261
Program& Program::operator=(const Program& prog) { return *this; }
@@ -274,7 +274,7 @@ String Program::getPrefix() const { OCL_NOT_AVAILABLE(); }
274274
/* static */ String Program::getPrefix(const String& buildflags) { OCL_NOT_AVAILABLE(); }
275275

276276

277-
ProgramSource::ProgramSource() : p(NULL) { }
277+
ProgramSource::ProgramSource() CV_NOEXCEPT : p(NULL) { }
278278
ProgramSource::ProgramSource(const String& module, const String& name, const String& codeStr, const String& codeHash) : p(NULL) { }
279279
ProgramSource::ProgramSource(const String& prog) : p(NULL) { }
280280
ProgramSource::ProgramSource(const char* prog) : p(NULL) { }
@@ -289,7 +289,7 @@ ProgramSource::hash_t ProgramSource::hash() const { OCL_NOT_AVAILABLE(); }
289289
/* static */ ProgramSource ProgramSource::fromSPIR(const String& module, const String& name, const unsigned char* binary, const size_t size, const cv::String& buildOptions) { OCL_NOT_AVAILABLE(); }
290290

291291

292-
PlatformInfo::PlatformInfo() : p(NULL) { }
292+
PlatformInfo::PlatformInfo() CV_NOEXCEPT : p(NULL) { }
293293
PlatformInfo::PlatformInfo(void* id) : p(NULL) { OCL_NOT_AVAILABLE(); }
294294
PlatformInfo::~PlatformInfo() { }
295295

@@ -332,7 +332,7 @@ int predictOptimalVectorWidthMax(InputArray src1, InputArray src2, InputArray sr
332332
void buildOptionsAddMatrixDescription(String& buildOptions, const String& name, InputArray _m) { OCL_NOT_AVAILABLE(); }
333333

334334

335-
Image2D::Image2D() : p(NULL) { }
335+
Image2D::Image2D() CV_NOEXCEPT : p(NULL) { }
336336
Image2D::Image2D(const UMat &src, bool norm, bool alias) { OCL_NOT_AVAILABLE(); }
337337
Image2D::Image2D(const Image2D & i) : p(NULL) { OCL_NOT_AVAILABLE(); }
338338
Image2D::~Image2D() { }

0 commit comments

Comments
 (0)