diff options
author | t-harvey <t-harvey@ti.com> | 2017-01-23 05:19:35 -0600 |
---|---|---|
committer | Tilmann Scheller <t.scheller@samsung.com> | 2017-01-23 12:19:35 +0100 |
commit | 94b6aae52c1188657ac488557277a55ea1a78b9d (patch) | |
tree | 4020712a2a906953bc6fb928e488c30a326af901 /jerry-libc | |
parent | 5d7972d05332c376dfcde13fb61e9303dcb1a4bb (diff) |
Added #if control around GCC built-in functions so that the code can be (#1483)
compiled using non-GCC compilers.
This included adding an initialization to a variable that looks(!)
like it can reach a use before being initialized (b/c we turned
JERRY_UNREACHABLE into a nop) -- an example:
int foo;
switch (value_can_only_be_one_or_two)
case 1:
case 2:
foo = 5;
default:
JERRY_UNREACHABLE();
x = foo +1;
...the compiler assumes that the path can go through the default case,
which leaves the value of foo undefined.
JerryScript-DCO-1.0-Signed-off-by: Timothy Harvey t-harvey@ti.com
Diffstat (limited to 'jerry-libc')
-rw-r--r-- | jerry-libc/include/assert.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/jerry-libc/include/assert.h b/jerry-libc/include/assert.h index d4942a0d..8e438496 100644 --- a/jerry-libc/include/assert.h +++ b/jerry-libc/include/assert.h @@ -28,7 +28,7 @@ extern "C" #define assert(x) \ do \ { \ - if (__builtin_expect (!(x), 0)) \ + if (!(x)) \ { \ fprintf (stderr, "%s:%d: %s: Assertion `%s' failed.", __FILE__, __LINE__, __func__, #x); \ abort (); \ |