Files
jerryscript/jerry-libc/jerry-libc-defs.h
T
Akos Kiss a7f015ef47 Implement raise () in libc
The core functionality (i.e., the equivalent of `kill (getpid (), sig);`)
was already there in the implementation of `abort ()`. Now, it got
factored out to `raise ()` so that others (most importantly,
`__aeabi_ldiv0`) can call and link to it as well.

Also, removed `LIBC_UNREACHABLE_STUB_FOR` macro, as it is not used anymore.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-12 22:45:01 +02:00

58 lines
1.6 KiB
C

/* Copyright 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DEFS_H
#define DEFS_H
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
/**
* Attributes
*/
#define __attr_unused___ __attribute__((unused))
#define __attr_used___ __attribute__((used))
#define __attr_noreturn___ __attribute__((noreturn))
#define __attr_noinline___ __attribute__((noinline))
/**
* Assertions
*/
extern void __attr_noreturn___
libc_fatal (const char *msg,
const char *file_name,
const char *function_name,
const unsigned int line_number);
#ifndef LIBC_NDEBUG
# define LIBC_ASSERT(x) do { if (__builtin_expect (!(x), 0)) { \
libc_fatal (#x, __FILE__, __func__, __LINE__); } } while (0)
# define LIBC_UNREACHABLE() \
do \
{ \
libc_fatal ("Code is unreachable", __FILE__, __func__, __LINE__); \
} while (0)
#else /* !LIBC_NDEBUG */
# define LIBC_ASSERT(x) do { if (false) { (void) (x); } } while (0)
# define LIBC_UNREACHABLE() \
do \
{ \
libc_fatal (NULL, NULL, NULL, 0); \
} while (0)
#endif /* !LIBC_NDEBUG */
#endif /* !DEFS_H */