jerry_Exit - exit function that under !JERRY_NDEBUG, in case status code is non-zero, prints exit status as string and calls handler of failed assertion.

This commit is contained in:
Ruben Ayrapetyan
2014-07-10 21:52:15 +04:00
parent f9ee8960c7
commit e6b3be5dfc
2 changed files with 100 additions and 11 deletions
+20 -11
View File
@@ -48,18 +48,22 @@ typedef enum {
#define JERRY_BITSINBYTE 8
/**
* Errors
* Error codes
*/
#define ERR_IO (-1)
#define ERR_BUFFER_SIZE (-2)
#define ERR_SEVERAL_FILES (-3)
#define ERR_NO_FILES (-4)
#define ERR_NON_CHAR (-5)
#define ERR_UNCLOSED (-6)
#define ERR_INT_LITERAL (-7)
#define ERR_STRING (-8)
#define ERR_PARSER (-9)
#define ERR_GENERAL (-255)
typedef enum
{
ERR_OK = 0,
ERR_IO = -1,
ERR_BUFFER_SIZE = -2,
ERR_SEVERAL_FILES = -3,
ERR_NO_FILES = -4,
ERR_NON_CHAR = -5,
ERR_UNCLOSED = -6,
ERR_INT_LITERAL = -7,
ERR_STRING = -8,
ERR_PARSER = -9,
ERR_GENERAL = -255
} jerry_Status_t;
/**
* Asserts
@@ -98,6 +102,11 @@ extern void __noreturn jerry_AssertFail( const char *assertion, const char *file
#define JERRY_UNREACHABLE() do { JERRY_ASSERT( false); __builtin_trap(); } while (0)
#define JERRY_UNIMPLEMENTED() JERRY_UNREACHABLE()
/**
* Exit
*/
extern void __noreturn jerry_Exit( jerry_Status_t code);
/**
* sizeof, offsetof, ...
*/