4 /* Auxiliary PDCLib code <_PDCLIB_aux.h>
6 This file is part of the Public Domain C Library (PDCLib).
7 Permission is granted to use, modify, and / or redistribute at will.
10 /* -------------------------------------------------------------------------- */
11 /* You should not have to edit anything in this file; if you DO have to, it */
12 /* would be considered a bug / missing feature: notify the author(s). */
13 /* -------------------------------------------------------------------------- */
15 /* -------------------------------------------------------------------------- */
16 /* Standard Version */
17 /* -------------------------------------------------------------------------- */
19 /* Many a compiler gets this wrong, so you might have to hardcode it instead. */
22 #error Compiler does not define _ _STDC_ _ to 1 (not standard-compliant)!
25 #if defined(_PDCLIB_C_VERSION)
26 /* Pass - conditional simplification case */
27 #elif !defined(__STDC_VERSION__)
28 #define _PDCLIB_C_VERSION 1990
29 #elif __STDC_VERSION__ == 199409L
30 #define _PDCLIB_C_VERSION 1995
31 #elif __STDC_VERSION__ == 199901L
32 #define _PDCLIB_C_VERSION 1999
33 #elif __STDC_VERSION__ == 201112L
34 #define _PDCLIB_C_VERSION 2011
36 #error Unsupported _ _STDC_VERSION_ _ (__STDC_VERSION__) (supported: ISO/IEC 9899:1990, 9899/AMD1:1995, 9899:1999, 9899:2011).
39 #if !defined(__cplusplus) || defined(_PDCLIB_CXX_VERSION)
40 /* Pass - conditional simplification case */
41 #elif __cplusplus == 201103L
42 #define _PDCLIB_CXX_VERSION 2011
43 #if _PDCLIB_C_VERSION < 2011
44 #undef _PDCLIB_C_VERSION
45 #define _PDCLIB_C_VERSION 2011
47 #elif __cplusplus == 199711L
48 #define _PDCLIB_CXX_VERSION 1997
50 #error Unsupported _ _cplusplus (__cplusplus) (supported: ISO/IEC 14882:1997, ISO/IEC 14882:2011).
53 #if _PDCLIB_C_VERSION >= 1999 || defined(__cplusplus)
55 #define _PDCLIB_restrict restrict
57 #define _PDCLIB_inline inline
60 #if _PDCLIB_CXX_VERSION >= 2011
61 #define _PDCLIB_noreturn [[noreturn]]
62 #elif _PDCLIB_C_VERSION >= 2011
63 #define _PDCLIB_noreturn _Noreturn
67 #ifndef _PDCLIB_restrict
68 #define _PDCLIB_restrict __restrict
71 #ifndef _PDCLIB_inline
72 #define _PDCLIB_inline __inline
75 #ifndef _PDCLIB_noreturn
76 #define _PDCLIB_noreturn __attribute__((noreturn))
80 #ifndef _PDCLIB_restrict
81 #define _PDCLIB_restrict
84 #ifndef _PDCLIB_inline
85 #define _PDCLIB_inline
88 #ifndef _PDCLIB_noreturn
89 #define _PDCLIB_noreturn
92 #ifndef __STDC_HOSTED__
93 #error Compiler does not define _ _STDC_HOSTED_ _ (not standard-compliant)!
94 #elif __STDC_HOSTED__ == 0
95 #define _PDCLIB_HOSTED 0
96 #elif __STDC_HOSTED__ == 1
97 #define _PDCLIB_HOSTED 1
99 #error Compiler does not define _ _STDC_HOSTED_ _ to 0 or 1 (not standard-compliant)!
103 #define _PDCLIB_BEGIN_EXTERN_C extern "C" {
104 #define _PDCLIB_END_EXTERN_C }
106 #define _PDCLIB_BEGIN_EXTERN_C
107 #define _PDCLIB_END_EXTERN_C
110 /*#if _PDCLIB_C_VERSION != 1999
111 #error PDCLib might not be fully conforming to either C89 or C95 prior to v2.x.
114 /* -------------------------------------------------------------------------- */
116 /* _PDCLIB_cc( x, y ) concatenates two preprocessor tokens without extending */
117 /* _PDCLIB_concat( x, y ) concatenates two preprocessor tokens with extending */
118 /* -------------------------------------------------------------------------- */
120 #define _PDCLIB_cc( x, y ) x ## y
121 #define _PDCLIB_concat( x, y ) _PDCLIB_cc( x, y )
123 #define _PDCLIB_symbol2value( x ) #x
124 #define _PDCLIB_symbol2string( x ) _PDCLIB_symbol2value( x )
126 #ifndef __PDCLIB_PURE
127 #define __PDCLIB_PURE 0
130 #ifndef _PDCLIB_POSIX_EX
131 #define _PDCLIB_POSIX_EX (!__PDCLIB_PURE)