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 #define _PDCLIB_EXPORT __declspec(dllexport)
68 #define _PDCLIB_IMPORT __declspec(dllimport)
72 #ifndef _PDCLIB_EXPORT
73 #define _PDCLIB_EXPORT __attribute__((__visibility__("protected")))
76 #ifndef _PDCLIB_IMPORT
77 #define _PDCLIB_IMPORT
80 #ifndef _PDCLIB_HIDDEN
81 #define _PDCLIB_HIDDEN __attribute__((__visibility__("hidden")))
84 #ifndef _PDCLIB_restrict
85 #define _PDCLIB_restrict __restrict
88 #ifndef _PDCLIB_inline
89 #define _PDCLIB_inline __inline
92 #ifndef _PDCLIB_noreturn
93 #define _PDCLIB_noreturn __attribute__((noreturn))
97 #ifndef _PDCLIB_EXPORT
98 #define _PDCLIB_EXPORT
100 #ifndef _PDCLIB_IMPORT
101 #define _PDCLIB_IMPORT
103 #ifndef _PDCLIB_HIDDEN
104 #define _PDCLIB_HIDDEN
107 #if defined(_PDCLIB_SHARED)
108 #if defined(_PDCLIB_BUILD)
109 #define _PDCLIB_API _PDCLIB_EXPORT
111 #define _PDCLIB_API _PDCLIB_IMPORT
114 #define _PDCLIB_API _PDCLIB_HIDDEN
117 #ifndef _PDCLIB_restrict
118 #define _PDCLIB_restrict
121 #ifndef _PDCLIB_inline
122 #define _PDCLIB_inline
125 #ifndef _PDCLIB_noreturn
126 #define _PDCLIB_noreturn
129 #ifndef __STDC_HOSTED__
130 #error Compiler does not define _ _STDC_HOSTED_ _ (not standard-compliant)!
131 #elif __STDC_HOSTED__ == 0
132 #define _PDCLIB_HOSTED 0
133 #elif __STDC_HOSTED__ == 1
134 #define _PDCLIB_HOSTED 1
136 #error Compiler does not define _ _STDC_HOSTED_ _ to 0 or 1 (not standard-compliant)!
140 #define _PDCLIB_BEGIN_EXTERN_C extern "C" {
141 #define _PDCLIB_END_EXTERN_C }
143 #define _PDCLIB_BEGIN_EXTERN_C
144 #define _PDCLIB_END_EXTERN_C
147 /*#if _PDCLIB_C_VERSION != 1999
148 #error PDCLib might not be fully conforming to either C89 or C95 prior to v2.x.
151 /* -------------------------------------------------------------------------- */
153 /* _PDCLIB_cc( x, y ) concatenates two preprocessor tokens without extending */
154 /* _PDCLIB_concat( x, y ) concatenates two preprocessor tokens with extending */
155 /* -------------------------------------------------------------------------- */
157 #define _PDCLIB_cc( x, y ) x ## y
158 #define _PDCLIB_concat( x, y ) _PDCLIB_cc( x, y )
160 #define _PDCLIB_symbol2value( x ) #x
161 #define _PDCLIB_symbol2string( x ) _PDCLIB_symbol2value( x )
163 #ifndef __PDCLIB_PURE
164 #define __PDCLIB_PURE 0
167 #ifndef _PDCLIB_POSIX_EX
168 #define _PDCLIB_POSIX_EX (!__PDCLIB_PURE)