Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
4e83f4c5
Commit
4e83f4c5
authored
Apr 23, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: drop cv::errorNoReturn()
replaced to cv::error()
parent
cd2b188c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
55 deletions
+47
-55
core.hpp
modules/core/include/opencv2/core.hpp
+1
-1
base.hpp
modules/core/include/opencv2/core/base.hpp
+10
-41
check.cpp
modules/core/src/check.cpp
+6
-6
opengl.cpp
modules/core/src/opengl.cpp
+1
-1
persistence.cpp
modules/core/src/persistence.cpp
+1
-1
system.cpp
modules/core/src/system.cpp
+27
-0
dnn.inl.hpp
modules/dnn/include/opencv2/dnn/dnn.inl.hpp
+0
-4
window.cpp
modules/highgui/src/window.cpp
+1
-1
No files found.
modules/core/include/opencv2/core.hpp
View file @
4e83f4c5
...
@@ -144,7 +144,7 @@ It is possible to alternate error processing by using #redirectError().
...
@@ -144,7 +144,7 @@ It is possible to alternate error processing by using #redirectError().
@param exc the exception raisen.
@param exc the exception raisen.
@deprecated drop this version
@deprecated drop this version
*/
*/
CV_EXPORTS
void
error
(
const
Exception
&
exc
);
CV_EXPORTS
CV_NORETURN
void
error
(
const
Exception
&
exc
);
enum
SortFlags
{
SORT_EVERY_ROW
=
0
,
//!< each matrix row is sorted independently
enum
SortFlags
{
SORT_EVERY_ROW
=
0
,
//!< each matrix row is sorted independently
SORT_EVERY_COLUMN
=
1
,
//!< each matrix column is sorted
SORT_EVERY_COLUMN
=
1
,
//!< each matrix column is sorted
...
...
modules/core/include/opencv2/core/base.hpp
View file @
4e83f4c5
...
@@ -373,32 +373,7 @@ It is possible to alternate error processing by using redirectError().
...
@@ -373,32 +373,7 @@ It is possible to alternate error processing by using redirectError().
@param _line - line number in the source file where the error has occurred
@param _line - line number in the source file where the error has occurred
@see CV_Error, CV_Error_, CV_Assert, CV_DbgAssert
@see CV_Error, CV_Error_, CV_Assert, CV_DbgAssert
*/
*/
CV_EXPORTS
void
error
(
int
_code
,
const
String
&
_err
,
const
char
*
_func
,
const
char
*
_file
,
int
_line
);
CV_EXPORTS
CV_NORETURN
void
error
(
int
_code
,
const
String
&
_err
,
const
char
*
_func
,
const
char
*
_file
,
int
_line
);
#ifdef __GNUC__
# if defined __clang__ || defined __APPLE__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Winvalid-noreturn"
# endif
#endif
/** same as cv::error, but does not return */
CV_INLINE
CV_NORETURN
void
errorNoReturn
(
int
_code
,
const
String
&
_err
,
const
char
*
_func
,
const
char
*
_file
,
int
_line
)
{
error
(
_code
,
_err
,
_func
,
_file
,
_line
);
#ifdef __GNUC__
# if !defined __clang__ && !defined __APPLE__
// this suppresses this warning: "noreturn" function does return [enabled by default]
__builtin_trap
();
// or use infinite loop: for (;;) {}
# endif
#endif
}
#ifdef __GNUC__
# if defined __clang__ || defined __APPLE__
# pragma GCC diagnostic pop
# endif
#endif
#if defined __GNUC__
#if defined __GNUC__
#define CV_Func __func__
#define CV_Func __func__
...
@@ -446,25 +421,19 @@ for example:
...
@@ -446,25 +421,19 @@ for example:
#define CV_Assert_1( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
#define CV_Assert_1( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
#endif // CV_STATIC_ANALYSIS
//! @cond IGNORED
//! @cond IGNORED
#define CV__ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
#if !defined(__OPENCV_BUILD) // TODO: backward compatibility only
#define CV__ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
#ifndef CV_ErrorNoReturn
#ifdef __OPENCV_BUILD
#define CV_ErrorNoReturn CV_Error
#undef CV_Error
#endif
#define CV_Error CV__ErrorNoReturn
#ifndef CV_ErrorNoReturn_
#undef CV_Error_
#define CV_ErrorNoReturn_ CV_Error_
#define CV_Error_ CV__ErrorNoReturn_
#endif
#undef CV_Assert_1
#define CV_Assert_1( expr ) if(!!(expr)) ; else cv::errorNoReturn( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
#else
// backward compatibility
#define CV_ErrorNoReturn CV__ErrorNoReturn
#define CV_ErrorNoReturn_ CV__ErrorNoReturn_
#endif
#endif
//! @endcond
//! @endcond
#endif // CV_STATIC_ANALYSIS
#define CV_Assert_2( expr1, expr2 ) CV_Assert_1(expr1); CV_Assert_1(expr2)
#define CV_Assert_2( expr1, expr2 ) CV_Assert_1(expr1); CV_Assert_1(expr2)
#define CV_Assert_3( expr1, expr2, expr3 ) CV_Assert_2(expr1, expr2); CV_Assert_1(expr3)
#define CV_Assert_3( expr1, expr2, expr3 ) CV_Assert_2(expr1, expr2); CV_Assert_1(expr3)
#define CV_Assert_4( expr1, expr2, expr3, expr4 ) CV_Assert_3(expr1, expr2, expr3); CV_Assert_1(expr4)
#define CV_Assert_4( expr1, expr2, expr3, expr4 ) CV_Assert_3(expr1, expr2, expr3); CV_Assert_1(expr4)
...
...
modules/core/src/check.cpp
View file @
4e83f4c5
...
@@ -67,7 +67,7 @@ void check_failed_auto_(const T& v1, const T& v2, const CheckContext& ctx)
...
@@ -67,7 +67,7 @@ void check_failed_auto_(const T& v1, const T& v2, const CheckContext& ctx)
ss
<<
"must be "
<<
getTestOpPhraseStr
(
ctx
.
testOp
)
<<
std
::
endl
;
ss
<<
"must be "
<<
getTestOpPhraseStr
(
ctx
.
testOp
)
<<
std
::
endl
;
}
}
ss
<<
" '"
<<
ctx
.
p2_str
<<
"' is "
<<
v2
;
ss
<<
" '"
<<
ctx
.
p2_str
<<
"' is "
<<
v2
;
cv
::
error
NoReturn
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
cv
::
error
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
}
}
void
check_failed_MatDepth
(
const
int
v1
,
const
int
v2
,
const
CheckContext
&
ctx
)
void
check_failed_MatDepth
(
const
int
v1
,
const
int
v2
,
const
CheckContext
&
ctx
)
{
{
...
@@ -79,7 +79,7 @@ void check_failed_MatDepth(const int v1, const int v2, const CheckContext& ctx)
...
@@ -79,7 +79,7 @@ void check_failed_MatDepth(const int v1, const int v2, const CheckContext& ctx)
ss
<<
"must be "
<<
getTestOpPhraseStr
(
ctx
.
testOp
)
<<
std
::
endl
;
ss
<<
"must be "
<<
getTestOpPhraseStr
(
ctx
.
testOp
)
<<
std
::
endl
;
}
}
ss
<<
" '"
<<
ctx
.
p2_str
<<
"' is "
<<
v2
<<
" ("
<<
depthToString
(
v2
)
<<
")"
;
ss
<<
" '"
<<
ctx
.
p2_str
<<
"' is "
<<
v2
<<
" ("
<<
depthToString
(
v2
)
<<
")"
;
cv
::
error
NoReturn
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
cv
::
error
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
}
}
void
check_failed_MatType
(
const
int
v1
,
const
int
v2
,
const
CheckContext
&
ctx
)
void
check_failed_MatType
(
const
int
v1
,
const
int
v2
,
const
CheckContext
&
ctx
)
{
{
...
@@ -91,7 +91,7 @@ void check_failed_MatType(const int v1, const int v2, const CheckContext& ctx)
...
@@ -91,7 +91,7 @@ void check_failed_MatType(const int v1, const int v2, const CheckContext& ctx)
ss
<<
"must be "
<<
getTestOpPhraseStr
(
ctx
.
testOp
)
<<
std
::
endl
;
ss
<<
"must be "
<<
getTestOpPhraseStr
(
ctx
.
testOp
)
<<
std
::
endl
;
}
}
ss
<<
" '"
<<
ctx
.
p2_str
<<
"' is "
<<
v2
<<
" ("
<<
typeToString
(
v2
)
<<
")"
;
ss
<<
" '"
<<
ctx
.
p2_str
<<
"' is "
<<
v2
<<
" ("
<<
typeToString
(
v2
)
<<
")"
;
cv
::
error
NoReturn
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
cv
::
error
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
}
}
void
check_failed_MatChannels
(
const
int
v1
,
const
int
v2
,
const
CheckContext
&
ctx
)
void
check_failed_MatChannels
(
const
int
v1
,
const
int
v2
,
const
CheckContext
&
ctx
)
{
{
...
@@ -119,7 +119,7 @@ void check_failed_auto_(const T& v, const CheckContext& ctx)
...
@@ -119,7 +119,7 @@ void check_failed_auto_(const T& v, const CheckContext& ctx)
<<
" '"
<<
ctx
.
p2_str
<<
"'"
<<
std
::
endl
<<
" '"
<<
ctx
.
p2_str
<<
"'"
<<
std
::
endl
<<
"where"
<<
std
::
endl
<<
"where"
<<
std
::
endl
<<
" '"
<<
ctx
.
p1_str
<<
"' is "
<<
v
;
<<
" '"
<<
ctx
.
p1_str
<<
"' is "
<<
v
;
cv
::
error
NoReturn
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
cv
::
error
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
}
}
void
check_failed_MatDepth
(
const
int
v
,
const
CheckContext
&
ctx
)
void
check_failed_MatDepth
(
const
int
v
,
const
CheckContext
&
ctx
)
{
{
...
@@ -128,7 +128,7 @@ void check_failed_MatDepth(const int v, const CheckContext& ctx)
...
@@ -128,7 +128,7 @@ void check_failed_MatDepth(const int v, const CheckContext& ctx)
<<
" '"
<<
ctx
.
p2_str
<<
"'"
<<
std
::
endl
<<
" '"
<<
ctx
.
p2_str
<<
"'"
<<
std
::
endl
<<
"where"
<<
std
::
endl
<<
"where"
<<
std
::
endl
<<
" '"
<<
ctx
.
p1_str
<<
"' is "
<<
v
<<
" ("
<<
depthToString
(
v
)
<<
")"
;
<<
" '"
<<
ctx
.
p1_str
<<
"' is "
<<
v
<<
" ("
<<
depthToString
(
v
)
<<
")"
;
cv
::
error
NoReturn
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
cv
::
error
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
}
}
void
check_failed_MatType
(
const
int
v
,
const
CheckContext
&
ctx
)
void
check_failed_MatType
(
const
int
v
,
const
CheckContext
&
ctx
)
{
{
...
@@ -137,7 +137,7 @@ void check_failed_MatType(const int v, const CheckContext& ctx)
...
@@ -137,7 +137,7 @@ void check_failed_MatType(const int v, const CheckContext& ctx)
<<
" '"
<<
ctx
.
p2_str
<<
"'"
<<
std
::
endl
<<
" '"
<<
ctx
.
p2_str
<<
"'"
<<
std
::
endl
<<
"where"
<<
std
::
endl
<<
"where"
<<
std
::
endl
<<
" '"
<<
ctx
.
p1_str
<<
"' is "
<<
v
<<
" ("
<<
typeToString
(
v
)
<<
")"
;
<<
" '"
<<
ctx
.
p1_str
<<
"' is "
<<
v
<<
" ("
<<
typeToString
(
v
)
<<
")"
;
cv
::
error
NoReturn
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
cv
::
error
(
cv
::
Error
::
StsError
,
ss
.
str
(),
ctx
.
func
,
ctx
.
file
,
ctx
.
line
);
}
}
void
check_failed_MatChannels
(
const
int
v
,
const
CheckContext
&
ctx
)
void
check_failed_MatChannels
(
const
int
v
,
const
CheckContext
&
ctx
)
{
{
...
...
modules/core/src/opengl.cpp
View file @
4e83f4c5
...
@@ -82,7 +82,7 @@ inline static bool checkError(const char* file, const int line, const char* func
...
@@ -82,7 +82,7 @@ inline static bool checkError(const char* file, const int line, const char* func
default
:
default
:
msg
=
"Unknown error"
;
msg
=
"Unknown error"
;
};
};
cv
::
error
NoReturn
(
Error
::
OpenGlApiCallError
,
func
,
msg
,
file
,
line
);
cv
::
error
(
Error
::
OpenGlApiCallError
,
func
,
msg
,
file
,
line
);
}
}
return
true
;
return
true
;
}
}
...
...
modules/core/src/persistence.cpp
View file @
4e83f4c5
...
@@ -149,7 +149,7 @@ void icvParseError( CvFileStorage* fs, const char* func_name,
...
@@ -149,7 +149,7 @@ void icvParseError( CvFileStorage* fs, const char* func_name,
const
char
*
err_msg
,
const
char
*
source_file
,
int
source_line
)
const
char
*
err_msg
,
const
char
*
source_file
,
int
source_line
)
{
{
cv
::
String
msg
=
cv
::
format
(
"%s(%d): %s"
,
fs
->
filename
,
fs
->
lineno
,
err_msg
);
cv
::
String
msg
=
cv
::
format
(
"%s(%d): %s"
,
fs
->
filename
,
fs
->
lineno
,
err_msg
);
cv
::
error
NoReturn
(
cv
::
Error
::
StsParseError
,
func_name
,
msg
.
c_str
(),
source_file
,
source_line
);
cv
::
error
(
cv
::
Error
::
StsParseError
,
func_name
,
msg
.
c_str
(),
source_file
,
source_line
);
}
}
void
icvFSCreateCollection
(
CvFileStorage
*
fs
,
int
tag
,
CvFileNode
*
collection
)
void
icvFSCreateCollection
(
CvFileStorage
*
fs
,
int
tag
,
CvFileNode
*
collection
)
...
...
modules/core/src/system.cpp
View file @
4e83f4c5
...
@@ -970,6 +970,13 @@ static void cv_terminate_handler() {
...
@@ -970,6 +970,13 @@ static void cv_terminate_handler() {
#endif
#endif
#ifdef __GNUC__
# if defined __clang__ || defined __APPLE__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Winvalid-noreturn"
# endif
#endif
void
error
(
const
Exception
&
exc
)
void
error
(
const
Exception
&
exc
)
{
{
#ifdef CV_ERROR_SET_TERMINATE_HANDLER
#ifdef CV_ERROR_SET_TERMINATE_HANDLER
...
@@ -1000,13 +1007,33 @@ void error( const Exception& exc )
...
@@ -1000,13 +1007,33 @@ void error( const Exception& exc )
}
}
CV_THROW
(
exc
);
CV_THROW
(
exc
);
#ifdef __GNUC__
# if !defined __clang__ && !defined __APPLE__
// this suppresses this warning: "noreturn" function does return [enabled by default]
__builtin_trap
();
// or use infinite loop: for (;;) {}
# endif
#endif
}
}
void
error
(
int
_code
,
const
String
&
_err
,
const
char
*
_func
,
const
char
*
_file
,
int
_line
)
void
error
(
int
_code
,
const
String
&
_err
,
const
char
*
_func
,
const
char
*
_file
,
int
_line
)
{
{
error
(
cv
::
Exception
(
_code
,
_err
,
_func
,
_file
,
_line
));
error
(
cv
::
Exception
(
_code
,
_err
,
_func
,
_file
,
_line
));
#ifdef __GNUC__
# if !defined __clang__ && !defined __APPLE__
// this suppresses this warning: "noreturn" function does return [enabled by default]
__builtin_trap
();
// or use infinite loop: for (;;) {}
# endif
#endif
}
}
#ifdef __GNUC__
# if defined __clang__ || defined __APPLE__
# pragma GCC diagnostic pop
# endif
#endif
ErrorCallback
ErrorCallback
redirectError
(
ErrorCallback
errCallback
,
void
*
userdata
,
void
**
prevUserdata
)
redirectError
(
ErrorCallback
errCallback
,
void
*
userdata
,
void
**
prevUserdata
)
...
...
modules/dnn/include/opencv2/dnn/dnn.inl.hpp
View file @
4e83f4c5
...
@@ -274,11 +274,7 @@ inline int DictValue::size() const
...
@@ -274,11 +274,7 @@ inline int DictValue::size() const
case
Param
:
:
REAL
:
case
Param
:
:
REAL
:
return
(
int
)
pd
->
size
();
return
(
int
)
pd
->
size
();
}
}
#ifdef __OPENCV_BUILD
CV_Error
(
Error
::
StsInternal
,
""
);
CV_Error
(
Error
::
StsInternal
,
""
);
#else
CV_ErrorNoReturn
(
Error
::
StsInternal
,
""
);
#endif
}
}
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
stream
,
const
DictValue
&
dictv
)
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
stream
,
const
DictValue
&
dictv
)
...
...
modules/highgui/src/window.cpp
View file @
4e83f4c5
...
@@ -603,7 +603,7 @@ void cv::setWindowTitle(const String&, const String&)
...
@@ -603,7 +603,7 @@ void cv::setWindowTitle(const String&, const String&)
}
}
#define CV_NO_GUI_ERROR(funcname) \
#define CV_NO_GUI_ERROR(funcname) \
cv::error
NoReturn
(cv::Error::StsError, \
cv::error(cv::Error::StsError, \
"The function is not implemented. " \
"The function is not implemented. " \
"Rebuild the library with Windows, GTK+ 2.x or Carbon support. "\
"Rebuild the library with Windows, GTK+ 2.x or Carbon support. "\
"If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script", \
"If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script", \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment