提交 b91903f8 编写于 作者: L liuruilong

rename assert

上级 06aee6a4
...@@ -51,14 +51,14 @@ struct PaddleMobileException : public std::exception { ...@@ -51,14 +51,14 @@ struct PaddleMobileException : public std::exception {
__FILE__, __LINE__); \ __FILE__, __LINE__); \
} }
#define PADDLE_MOBILE_ASSERT(stat, ...) \ #define PADDLE_MOBILE_ENFORCE(stat, ...) \
{ \ { \
if (stat) { \ if (stat) { \
} else { \ } else { \
char buffer[1000]; \ char buffer[1000]; \
snprintf(buffer, sizeof(buffer), __VA_ARGS__); \ snprintf(buffer, sizeof(buffer), __VA_ARGS__); \
std::string detail(buffer); \ std::string detail(buffer); \
throw paddle_mobile::PaddleMobileException("paddle-mobile assert", \ throw paddle_mobile::PaddleMobileException("paddle-mobile enforce", \
buffer, __FILE__, __LINE__); \ buffer, __FILE__, __LINE__); \
} \ } \
} }
......
...@@ -19,7 +19,7 @@ limitations under the License. */ ...@@ -19,7 +19,7 @@ limitations under the License. */
#include "framework/operator.h" #include "framework/operator.h"
#include "framework/program/program_desc.h" #include "framework/program/program_desc.h"
#include "node.h" #include "framework/program/program-optimize/node.h"
namespace paddle_mobile { namespace paddle_mobile {
......
...@@ -58,5 +58,5 @@ ADD_EXECUTABLE(test-gemm common/test_gemm.cpp) ...@@ -58,5 +58,5 @@ ADD_EXECUTABLE(test-gemm common/test_gemm.cpp)
target_link_libraries(test-gemm paddle-mobile) target_link_libraries(test-gemm paddle-mobile)
# gen test # gen test
ADD_EXECUTABLE(test-assert common/test_assert.cpp) ADD_EXECUTABLE(test-enforce common/test_enforce.cpp)
target_link_libraries(test-assert paddle-mobile) target_link_libraries(test-enforce paddle-mobile)
\ No newline at end of file \ No newline at end of file
...@@ -12,10 +12,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,10 +12,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "common/assert.h" #include "common/enforce.h"
int main() { int main() {
PADDLE_MOBILE_ASSERT(false, "assert"); PADDLE_MOBILE_ENFORCE(false, "enforce");
PADDLE_MOBILE_THROW_EXCEPTION("throw a exception"); PADDLE_MOBILE_THROW_EXCEPTION("throw a exception");
return 0; return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册