Disabling output of file name, function name and line on abnormal engine termination under JERRY_NDEBUG.
This commit is contained in:
@@ -116,6 +116,7 @@ extern void __noreturn jerry_unimplemented (const char *comment, const char *fil
|
|||||||
* Mark for unreachable points and unimplemented cases
|
* Mark for unreachable points and unimplemented cases
|
||||||
*/
|
*/
|
||||||
extern void jerry_ref_unused_variables (int unused_variables_follow, ...);
|
extern void jerry_ref_unused_variables (int unused_variables_follow, ...);
|
||||||
|
#ifndef JERRY_NDEBUG
|
||||||
#define JERRY_UNREACHABLE() \
|
#define JERRY_UNREACHABLE() \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@@ -137,7 +138,29 @@ extern void jerry_ref_unused_variables (int unused_variables_follow, ...);
|
|||||||
jerry_ref_unused_variables (0, __VA_ARGS__); \
|
jerry_ref_unused_variables (0, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
#else /* !JERRY_NDEBUG */
|
||||||
|
#define JERRY_UNREACHABLE() \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
jerry_unreachable (NULL, NULL, NULL, 0); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define JERRY_UNIMPLEMENTED() \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
jerry_unimplemented (NULL, NULL, NULL, 0); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(...) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
jerry_unimplemented (NULL, NULL, NULL, 0); \
|
||||||
|
if (false) \
|
||||||
|
{ \
|
||||||
|
jerry_ref_unused_variables (0, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
#endif /* JERRY_NDEBUG */
|
||||||
/**
|
/**
|
||||||
* Conditions' likeliness, unlikeliness.
|
* Conditions' likeliness, unlikeliness.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,8 +25,15 @@ jerry_assert_fail (const char *assertion, /**< assertion condition string */
|
|||||||
const char *function, /**< function name */
|
const char *function, /**< function name */
|
||||||
const uint32_t line) /** line */
|
const uint32_t line) /** line */
|
||||||
{
|
{
|
||||||
|
#ifndef JERRY_NDEBUG
|
||||||
__printf ("ICE: Assertion '%s' failed at %s(%s):%u.\n",
|
__printf ("ICE: Assertion '%s' failed at %s(%s):%u.\n",
|
||||||
assertion, file, function, line);
|
assertion, file, function, line);
|
||||||
|
#else /* !JERRY_NDEBUG */
|
||||||
|
(void) assertion;
|
||||||
|
(void) file;
|
||||||
|
(void) function;
|
||||||
|
(void) line;
|
||||||
|
#endif /* JERRY_NDEBUG */
|
||||||
|
|
||||||
__exit (-ERR_FAILED_INTERNAL_ASSERTION);
|
__exit (-ERR_FAILED_INTERNAL_ASSERTION);
|
||||||
} /* jerry_assert_fail */
|
} /* jerry_assert_fail */
|
||||||
@@ -41,7 +48,14 @@ jerry_unreachable (const char *comment, /**< comment to unreachable mark if exis
|
|||||||
const char *function, /**< function name */
|
const char *function, /**< function name */
|
||||||
const uint32_t line) /**< line */
|
const uint32_t line) /**< line */
|
||||||
{
|
{
|
||||||
|
#ifndef JERRY_NDEBUG
|
||||||
__printf ("ICE: Unreachable control path at %s(%s):%u was executed", file, function, line);
|
__printf ("ICE: Unreachable control path at %s(%s):%u was executed", file, function, line);
|
||||||
|
#else /* !JERRY_NDEBUG */
|
||||||
|
(void) file;
|
||||||
|
(void) function;
|
||||||
|
(void) line;
|
||||||
|
#endif /* JERRY_NDEBUG */
|
||||||
|
|
||||||
if (comment != NULL)
|
if (comment != NULL)
|
||||||
{
|
{
|
||||||
__printf ("(%s)", comment);
|
__printf ("(%s)", comment);
|
||||||
@@ -61,7 +75,14 @@ jerry_unimplemented (const char *comment, /**< comment to unimplemented mark if
|
|||||||
const char *function, /**< function name */
|
const char *function, /**< function name */
|
||||||
const uint32_t line) /**< line */
|
const uint32_t line) /**< line */
|
||||||
{
|
{
|
||||||
|
#ifndef JERRY_NDEBUG
|
||||||
__printf ("SORRY: Unimplemented case at %s(%s):%u was executed", file, function, line);
|
__printf ("SORRY: Unimplemented case at %s(%s):%u was executed", file, function, line);
|
||||||
|
#else /* !JERRY_NDEBUG */
|
||||||
|
(void) file;
|
||||||
|
(void) function;
|
||||||
|
(void) line;
|
||||||
|
#endif /* JERRY_NDEBUG */
|
||||||
|
|
||||||
if (comment != NULL)
|
if (comment != NULL)
|
||||||
{
|
{
|
||||||
__printf ("(%s)", comment);
|
__printf ("(%s)", comment);
|
||||||
|
|||||||
Reference in New Issue
Block a user