1 /*
2  * Copyright (c) 2018 Oticon A/S
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_ARCH_POSIX_INCLUDE_POSIX_ARCH_INTERNAL_H_
8 #define ZEPHYR_ARCH_POSIX_INCLUDE_POSIX_ARCH_INTERNAL_H_
9 
10 #include "toolchain.h"
11 
12 #define PC_SAFE_CALL(a) pc_safe_call(a, #a)
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
pc_safe_call(int test,const char * test_str)18 static inline void pc_safe_call(int test, const char *test_str)
19 {
20 	/* LCOV_EXCL_START */ /* See Note1 */
21 	if (unlikely(test)) {
22 		posix_print_error_and_exit("POSIX arch: Error on: %s\n",
23 					   test_str);
24 	}
25 	/* LCOV_EXCL_STOP */
26 }
27 
28 #ifdef __cplusplus
29 }
30 #endif
31 
32 #endif /* ZEPHYR_ARCH_POSIX_INCLUDE_POSIX_ARCH_INTERNAL_H_ */
33 
34 /*
35  * Note 1:
36  *
37  * All checks for the host pthreads functions which are wrapped by PC_SAFE_CALL
38  * are meant to never fail, and therefore will not be covered.
39  */
40