"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "2d2e2bfe9fc054806fc2845cecf38aa7114507ef"
Commit d7db2875 authored by Artur Wojcik's avatar Artur Wojcik
Browse files

remove migraphx_test_private_disable_execption_catch() from a production build

parent a745939c
...@@ -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)
......
...@@ -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;
} }
......
...@@ -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;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment