Adding jerry_unreachable and jerry_unimplemented routines that print file name and line for corresponding unreachable, unimplemented marks.

This commit is contained in:
Ruben Ayrapetyan
2014-09-18 17:08:32 +04:00
parent 55d9b12176
commit d9e0f2936d
4 changed files with 78 additions and 10 deletions
+5 -5
View File
@@ -98,6 +98,8 @@ typedef enum
extern uint32_t jerry_unreferenced_expression;
extern void __noreturn jerry_assert_fail (const char *assertion, const char *file, const uint32_t line);
extern void __noreturn jerry_unreachable (const char *comment, const char *file, const uint32_t line);
extern void __noreturn jerry_unimplemented (const char *comment, const char *file, const uint32_t line);
#ifndef JERRY_NDEBUG
#define JERRY_ASSERT(x) do { if (__builtin_expect (!(x), 0)) { jerry_assert_fail (#x, __FILE__, __LINE__); } } while (0)
@@ -112,21 +114,19 @@ extern void jerry_ref_unused_variables (int unused_variables_follow, ...);
#define JERRY_UNREACHABLE() \
do \
{ \
JERRY_ASSERT (false); \
jerry_exit (ERR_FAILED_INTERNAL_ASSERTION); \
jerry_unreachable (NULL, __FILE__, __LINE__); \
} while (0)
#define JERRY_UNIMPLEMENTED() \
do \
{ \
JERRY_ASSERT (false); \
jerry_exit (ERR_UNIMPLEMENTED_CASE); \
jerry_unimplemented (NULL, __FILE__, __LINE__); \
} while (0)
#define JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(...) \
do \
{ \
JERRY_UNIMPLEMENTED (); \
jerry_unimplemented (NULL, __FILE__, __LINE__); \
if (false) \
{ \
jerry_ref_unused_variables (0, __VA_ARGS__); \