Annotation of parser3/src/include/pa_config_includes.h, revision 1.57
1.5 paf 1: /** @file
2: Parser: includes all Configure-d headers
3:
1.51 moko 4: Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com)
1.17 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.5 paf 6:
7: when used Configure [HAVE_CONFIG_H] it uses defines from Configure,
8: fixed otherwise.
9: */
1.10 parser 10:
1.25 paf 11: #ifndef PA_CONFIG_INCLUDES_H
12: #define PA_CONFIG_INCLUDES_H
13:
1.1 paf 14: #if HAVE_CONFIG_H
1.37 moko 15: # include "pa_config_auto.h"
1.1 paf 16: #else
1.37 moko 17: # include "pa_config_fixed.h"
1.6 paf 18: #endif
19:
1.37 moko 20: // AC_INCLUDES_DEFAULT
21:
22: #ifdef HAVE_STDIO_H
23: # include <stdio.h>
1.1 paf 24: #endif
25:
1.37 moko 26: #ifdef HAVE_SYS_TYPES_H
27: # include <sys/types.h>
1.25 paf 28: #endif
29:
1.37 moko 30: #ifdef HAVE_SYS_STAT_H
31: # include <sys/stat.h>
1.3 paf 32: #endif
33:
1.43 moko 34: #ifdef HAVE_STDLIB_H
1.37 moko 35: # include <stdlib.h>
1.43 moko 36: #endif
37:
38: #ifdef HAVE_STDDEF_H
1.37 moko 39: # include <stddef.h>
1.3 paf 40: #endif
41:
1.37 moko 42: #ifdef HAVE_STRING_H
43: # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
44: # include <memory.h>
45: # endif
46: # include <string.h>
1.3 paf 47: #endif
48:
1.37 moko 49: #ifdef HAVE_STRINGS_H
50: # include <strings.h>
1.3 paf 51: #endif
52:
1.37 moko 53: #ifdef HAVE_INTTYPES_H
54: # include <inttypes.h>
1.3 paf 55: #endif
56:
1.37 moko 57: #ifdef HAVE_STDINT_H
58: # include <stdint.h>
1.1 paf 59: #endif
60:
1.37 moko 61: #ifdef HAVE_UNISTD_H
62: # include <unistd.h>
1.8 parser 63: #endif
64:
1.37 moko 65: // other includes
66:
67: #ifdef HAVE_ASSERT_H
68: # include <assert.h>
1.3 paf 69: #endif
70:
1.37 moko 71: #ifdef HAVE_LIMITS_H
72: # include <limits.h>
1.3 paf 73: #endif
74:
1.37 moko 75: #ifdef HAVE_CTYPE_H
76: # include <ctype.h>
1.1 paf 77: #endif
1.3 paf 78:
79: #ifdef HAVE_MATH_H
1.37 moko 80: # include <math.h>
1.3 paf 81: #endif
82:
1.37 moko 83: #ifdef HAVE_PROCESS_H
84: # include <process.h>
85: #endif
1.3 paf 86:
1.37 moko 87: #ifdef HAVE_STDARG_H
88: # include <stdarg.h>
1.3 paf 89: #endif
90:
1.37 moko 91: #ifdef HAVE_SETJMP_H
92: # include <setjmp.h>
1.35 moko 93: #endif
94:
1.37 moko 95: #ifdef HAVE_SIGNAL_H
96: # include <signal.h>
1.8 parser 97: #endif
98:
1.37 moko 99: #ifdef HAVE_ERRNO_H
100: # include <errno.h>
1.9 parser 101: #endif
102:
1.39 moko 103: #ifdef HAVE_DIRENT_H
104: # include <dirent.h>
105: #endif
106:
1.37 moko 107: #ifdef HAVE_FCNTL_H
108: # include <fcntl.h>
1.13 paf 109: #endif
110:
1.37 moko 111: #ifdef HAVE_IO_H
112: # include <io.h>
1.14 paf 113: #endif
114:
115: #ifdef HAVE_SYS_FILE_H
1.37 moko 116: # include <sys/file.h>
1.14 paf 117: #endif
118:
119: #ifdef HAVE_SYS_LOCKING_H
1.37 moko 120: # include <sys/locking.h>
1.14 paf 121: #endif
122:
1.37 moko 123: #ifdef HAVE_SYS_SELECT_H
124: # include <sys/select.h>
1.15 paf 125: #endif
126:
1.37 moko 127: #ifdef HAVE_SYS_RESOURCE_H
128: # include <sys/resource.h>
1.4 paf 129: #endif
1.21 paf 130:
1.42 moko 131: #ifdef HAVE_SYS_WAIT_H
132: # include <sys/wait.h>
133: #endif
134:
1.21 paf 135:
1.22 paf 136: #ifdef HAVE_SYS_SOCKET_H
1.37 moko 137: # include <sys/socket.h>
1.41 moko 138: #endif
139:
1.22 paf 140: #ifdef HAVE_NETINET_IN_H
1.37 moko 141: # include <netinet/in.h>
1.22 paf 142: #endif
143:
144: #ifdef HAVE_ARPA_INET_H
1.37 moko 145: # include <arpa/inet.h>
1.22 paf 146: #endif
147:
148: #ifdef HAVE_NETDB_H
1.37 moko 149: # include <netdb.h>
1.22 paf 150: #endif
1.24 paf 151:
1.37 moko 152:
153: #if TIME_WITH_SYS_TIME
154: # include <sys/time.h>
155: # include <time.h>
156: #else
157: # ifdef HAVE_SYS_TIME_H
158: # include <sys/time.h>
159: # else
160: # include <time.h>
161: # endif
162: #endif
1.25 paf 163:
164: // math function replacements
165:
1.26 paf 166: #ifdef __cplusplus
167:
1.25 paf 168: #ifndef HAVE_TRUNC
169: inline double trunc(double param) { return param > 0? floor(param) : ceil(param); }
170: #endif
171:
172: #ifndef HAVE_ROUND
173: inline double round(double param) { return floor(param+0.5); }
174: #endif
175:
176: #ifndef HAVE_SIGN
177: inline double sign(double param) { return param > 0 ? 1 : ( param < 0 ? -1 : 0 ); }
178: #endif
179:
180: #if !defined(max)
1.24 paf 181: inline int max(int a, int b) { return a>b?a:b; }
182: inline int min(int a, int b){ return a<b?a:b; }
183: inline size_t max(size_t a, size_t b) { return a>b?a:b; }
184: inline size_t min(size_t a, size_t b){ return a<b?a:b; }
1.26 paf 185: #endif
186:
1.55 moko 187: #endif // __cplusplus
188:
189: // libgc usage configuration
190: //#define PA_DEBUG_DISABLE_GC
191:
192: #ifdef PA_DEBUG_DISABLE_GC
193:
194: #define GC_MALLOC(size) memset(malloc(size), 0 , size)
195: #define GC_MALLOC_ATOMIC(size) memset(malloc(size), 0 , size)
196: #define GC_REALLOC(ptr, size) realloc(ptr, size)
197: #define GC_FREE(ptr) free(ptr)
198:
199: #define GC_NEW(t) (t *)GC_MALLOC(sizeof (t))
200: #define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t))
201:
202: #else
203:
1.56 moko 204: // allows to backtrace pointers
205: //#define GC_DEBUG
206:
1.57 ! moko 207: #include "../lib/gc/include/gc.h"
1.55 moko 208:
209: #endif // PA_DEBUG_DISABLE_GC
210:
1.25 paf 211:
1.53 moko 212: #ifdef __GNUC__
1.50 moko 213: # define PA_ATTR_UNUSED __attribute__((unused))
214: #else
215: # define PA_ATTR_UNUSED
216: #endif
217:
1.33 moko 218: #ifdef WIN32
219: #define THREAD_LOCAL __declspec(thread)
220: #else
221: #define THREAD_LOCAL // __thread // multithreading support required only for apache2 module
222: #endif
1.27 paf 223:
1.53 moko 224: #ifdef __clang__
1.45 moko 225: #pragma clang diagnostic ignored "-Wparentheses" // if(a=b)
1.53 moko 226: #pragma clang diagnostic ignored "-Wpointer-sign" // CORD (unsigned char *) to char * in libcord
1.54 moko 227: #pragma clang diagnostic ignored "-Winline-new-delete" // test for regular new/delete usage in memory.h
1.47 moko 228: #endif
1.45 moko 229:
1.52 moko 230: #ifdef _MSC_VER
1.37 moko 231: #pragma warning(disable:4355) // using this in calls to parent constructors
232: #pragma warning(disable:4291) // no matching operator delete found; memory will not be freed if initialization throws an exception
233: #pragma warning(disable:4512) // assignment operator could not be generated
234: #pragma warning(disable:4505) // unreferenced local function has been removed
235: #pragma warning(disable:4127) // conditional expression is constant; while(true) OK
236: #pragma warning(disable:4706) // assignment within conditional expression if(type var=somethig) OK
237: #pragma warning(disable:4996) // memcpy deprecation
1.44 moko 238: #pragma warning(disable:4702) // unreachable code
1.48 moko 239: #pragma warning(disable:4511) // copy constructor could not be generated (vs2003 specific)
1.27 paf 240: #endif
241:
1.24 paf 242: #endif
E-mail: