Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
d7db2875
Commit
d7db2875
authored
Jun 18, 2023
by
Artur Wojcik
Browse files
remove migraphx_test_private_disable_execption_catch() from a production build
parent
a745939c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
CMakeLists.txt
CMakeLists.txt
+4
-0
src/api/api.cpp
src/api/api.cpp
+6
-0
tools/api/api.cpp
tools/api/api.cpp
+6
-0
No files found.
CMakeLists.txt
View file @
d7db2875
...
@@ -263,6 +263,10 @@ enable_testing()
...
@@ -263,6 +263,10 @@ enable_testing()
include
(
ROCMCreatePackage
)
include
(
ROCMCreatePackage
)
if
(
BUILD_TESTING
)
add_compile_definitions
(
$<$<COMPILE_LANGUAGE:C,CXX>:MIGRAPHX_BUILD_TESTING>
)
endif
()
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/lib
)
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/lib
)
set
(
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/lib
)
set
(
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/lib
)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/bin
)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/bin
)
...
...
src/api/api.cpp
View file @
d7db2875
...
@@ -41,24 +41,28 @@
...
@@ -41,24 +41,28 @@
#include <algorithm>
#include <algorithm>
#include <cstdarg>
#include <cstdarg>
#ifdef MIGRAPHX_BUILD_TESTING
static
thread_local
bool
disable_exception_catch
=
false
;
// NOLINT
static
thread_local
bool
disable_exception_catch
=
false
;
// NOLINT
extern
"C"
MIGRAPHX_C_EXPORT
void
migraphx_test_private_disable_exception_catch
(
bool
b
)
extern
"C"
MIGRAPHX_C_EXPORT
void
migraphx_test_private_disable_exception_catch
(
bool
b
)
{
{
disable_exception_catch
=
b
;
disable_exception_catch
=
b
;
}
}
#endif
namespace
migraphx
{
namespace
migraphx
{
template
<
class
F
>
template
<
class
F
>
migraphx_status
try_
(
F
f
,
bool
output
=
true
)
// NOLINT
migraphx_status
try_
(
F
f
,
bool
output
=
true
)
// NOLINT
{
{
#ifdef MIGRAPHX_BUILD_TESTING
if
(
disable_exception_catch
)
if
(
disable_exception_catch
)
{
{
f
();
f
();
}
}
else
else
{
{
#endif
try
try
{
{
f
();
f
();
...
@@ -82,7 +86,9 @@ migraphx_status try_(F f, bool output = true) // NOLINT
...
@@ -82,7 +86,9 @@ migraphx_status try_(F f, bool output = true) // NOLINT
{
{
return
migraphx_status_unknown_error
;
return
migraphx_status_unknown_error
;
}
}
#ifdef MIGRAPHX_BUILD_TESTING
}
}
#endif
return
migraphx_status_success
;
return
migraphx_status_success
;
}
}
...
...
tools/api/api.cpp
View file @
d7db2875
...
@@ -41,24 +41,28 @@
...
@@ -41,24 +41,28 @@
#include <algorithm>
#include <algorithm>
#include <cstdarg>
#include <cstdarg>
#ifdef MIGRAPHX_BUILD_TESTING
static
thread_local
bool
disable_exception_catch
=
false
;
// NOLINT
static
thread_local
bool
disable_exception_catch
=
false
;
// NOLINT
extern
"C"
MIGRAPHX_C_EXPORT
void
migraphx_test_private_disable_exception_catch
(
bool
b
)
extern
"C"
MIGRAPHX_C_EXPORT
void
migraphx_test_private_disable_exception_catch
(
bool
b
)
{
{
disable_exception_catch
=
b
;
disable_exception_catch
=
b
;
}
}
#endif
namespace
migraphx
{
namespace
migraphx
{
template
<
class
F
>
template
<
class
F
>
migraphx_status
try_
(
F
f
,
bool
output
=
true
)
// NOLINT
migraphx_status
try_
(
F
f
,
bool
output
=
true
)
// NOLINT
{
{
#ifdef MIGRAPHX_BUILD_TESTING
if
(
disable_exception_catch
)
if
(
disable_exception_catch
)
{
{
f
();
f
();
}
}
else
else
{
{
#endif
try
try
{
{
f
();
f
();
...
@@ -82,7 +86,9 @@ migraphx_status try_(F f, bool output = true) // NOLINT
...
@@ -82,7 +86,9 @@ migraphx_status try_(F f, bool output = true) // NOLINT
{
{
return
migraphx_status_unknown_error
;
return
migraphx_status_unknown_error
;
}
}
#ifdef MIGRAPHX_BUILD_TESTING
}
}
#endif
return
migraphx_status_success
;
return
migraphx_status_success
;
}
}
...
...
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