Annotation of parser3/src/include/pa_config_includes.h, revision 1.35
1.5 paf 1: /** @file
2: Parser: includes all Configure-d headers
3:
1.34 moko 4: Copyright (c) 2001-2012 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.10 parser 14: #if _MSC_VER
15: # pragma warning(disable:4291) // disable warning
16: // "no matching operator delete found; memory will not be freed if initialization throws an exception
17: #endif
1.5 paf 18:
1.1 paf 19: #if HAVE_CONFIG_H
20: # include "pa_config_auto.h"
21: #else
22: # include "pa_config_fixed.h"
1.6 paf 23: #endif
24:
1.7 paf 25: #ifdef __cplusplus
26: # undef inline
1.1 paf 27: #endif
28:
1.25 paf 29: #ifdef HAVE_ASSERT_H
30: # include <assert.h>
31: #endif
32:
1.3 paf 33: #ifdef HAVE_CTYPE_H
34: # include <ctype.h>
35: #endif
36:
37: #ifdef HAVE_ERRNO_H
38: # include <errno.h>
39: #endif
40:
41: #ifdef HAVE_FCNTL_H
42: # include <fcntl.h>
43: #endif
44:
45: #ifdef HAVE_IO_H
46: # include <io.h>
47: #endif
48:
49: #ifdef HAVE_PROCESS_H
50: # include <process.h>
51: #endif
52:
1.1 paf 53: #ifdef HAVE_STDARG_H
54: # include <stdarg.h>
55: #endif
56:
1.8 parser 57: #ifdef HAVE_STDDEF_H
58: # include <stddef.h>
59: #endif
60:
1.3 paf 61: #ifdef HAVE_STDIO_H
62: # include <stdio.h>
63: #endif
64:
65: #ifdef HAVE_SYS_STAT_H
66: # include <sys/stat.h>
67: #endif
68:
69: #if defined(HAVE_UNISTD_H) && !defined(NO_UNISTD_H)
1.1 paf 70: # include <unistd.h>
71: #endif
1.3 paf 72:
73: #ifdef HAVE_MATH_H
74: # include <math.h>
75: #endif
76:
1.25 paf 77: #include <stdlib.h>
1.3 paf 78:
79: #ifdef HAVE_STRING_H
80: # include <string.h>
81: #endif
82:
1.35 ! moko 83: #ifdef HAVE_LIMITS_H
! 84: #include <limits.h>
! 85: #endif
! 86:
1.4 paf 87: #ifdef HAVE_DIRECT_H
88: # include <direct.h>
1.8 parser 89: #endif
90:
91: #ifdef HAVE_SETJMP_H
92: # include <setjmp.h>
1.9 parser 93: #endif
94:
95: #ifdef HAVE_MEMORY_H
96: # include <memory.h>
1.13 paf 97: #endif
98:
99: #ifdef HAVE_NEW
100: #include <new>
1.14 paf 101: #endif
102:
103: #ifdef HAVE_SYS_FILE_H
104: #include <sys/file.h>
105: #endif
106:
107: #ifdef HAVE_SYS_LOCKING_H
108: #include <sys/locking.h>
109: #endif
110:
111: #ifdef HAVE_SYS_TYPES_H
112: #include <sys/types.h>
1.15 paf 113: #endif
114:
115: #ifdef HAVE_SYS_SELECT_H
116: #include <sys/select.h>
1.4 paf 117: #endif
1.21 paf 118:
119: #ifdef HAVE_SIGNAL_H
120: #include <signal.h>
121: #endif
122:
1.22 paf 123: #ifdef HAVE_SYS_SOCKET_H
1.25 paf 124: # include <sys/socket.h>
125: #else
126: # if defined(HAVE_WINSOCK_H) && !defined(_MSC_VER) && !defined(CYGWIN)
127: # include <winsock.h>
128: # endif
1.22 paf 129: #endif
130:
1.25 paf 131: // must go anywhere after winsock [cygwin time.h checks for already inclusion of winsock.h]
132: #if TIME_WITH_SYS_TIME
133: # include <sys/time.h>
134: # include <time.h>
135: #else
136: # ifdef HAVE_SYS_TIME_H
137: # include <sys/time.h>
138: # else
139: # include <time.h>
140: # endif
141: #endif
142:
143:
1.22 paf 144: #ifdef HAVE_NETINET_IN_H
145: #include <netinet/in.h>
146: #endif
147:
148: #ifdef HAVE_ARPA_INET_H
149: #include <arpa/inet.h>
150: #endif
151:
152: #ifdef HAVE_NETDB_H
153: #include <netdb.h>
154: #endif
1.24 paf 155:
1.25 paf 156:
157: // math function replacements
158:
1.26 paf 159: #ifdef __cplusplus
160:
1.25 paf 161: #ifndef HAVE_TRUNC
162: inline double trunc(double param) { return param > 0? floor(param) : ceil(param); }
163: #endif
164:
165: #ifndef HAVE_ROUND
166: inline double round(double param) { return floor(param+0.5); }
167: #endif
168:
169: #ifndef HAVE_SIGN
170: inline double sign(double param) { return param > 0 ? 1 : ( param < 0 ? -1 : 0 ); }
171: #endif
172:
173: #if !defined(max)
1.24 paf 174: inline int max(int a, int b) { return a>b?a:b; }
175: inline int min(int a, int b){ return a<b?a:b; }
176: inline size_t max(size_t a, size_t b) { return a>b?a:b; }
177: inline size_t min(size_t a, size_t b){ return a<b?a:b; }
1.26 paf 178: #endif
179:
1.25 paf 180: #endif
181:
1.33 moko 182: #ifdef WIN32
183: #define THREAD_LOCAL __declspec(thread)
184: #else
185: #define THREAD_LOCAL // __thread // multithreading support required only for apache2 module
186: #endif
1.27 paf 187:
188: #if _MSC_VER
189: // using this in calls to parent constructors
190: #pragma warning(disable:4355)
191:
192: //# pragma warning(disable:4065) // switch statement contains 'default'
193: // but no 'case' labels
194: //# pragma warning(disable:4800) // (bool)(1&2)
195:
196: // assignment operator could not be generated
197: //#pragma warning(disable:4512)
198:
199: // identifier was truncated to '255' characters in the debug information
200: #pragma warning(disable:4786)
201:
202: // copy constructor could not be generated
203: #pragma warning(disable:4511)
204:
205: // assignment operator could not be generated
206: #pragma warning(disable:4512)
207:
208: // unreferenced local function has been removed
209: #pragma warning(disable:4505)
210:
211: // conditional expression is constant; while(true) OK
212: #pragma warning(disable:4127)
213:
214: // assignment within conditional expression if(type var=somethig) OK
215: #pragma warning(disable:4706)
216:
1.29 paf 217: // memcpy deprecation
218: #pragma warning(disable:4996)
219:
1.27 paf 220:
221: #if 0
222: #ifdef _DEBUG
223: # define _CRTDBG_MAP_ALLOC
224: // When the _CRTDBG_MAP_ALLOC flag is defined in the debug version of an application,
225: // the base version of the heap functions are directly mapped to their debug versions
226: #endif
227: #endif
228:
229: #endif
230:
1.30 paf 231: #ifdef PA_RELEASE_ASSERTS
232: // this helps to remove warnings on helper-to-assert variables
233: #undef NDEBUG
234: // pa_globals.C
235: void pa_release_assert(const char* str, const char* file, int line);
236: #undef assert
237: #define assert(exp) (void)( (exp) || (pa_release_assert(#exp, __FILE__, __LINE__), 0) )
238: #endif
239:
1.32 paf 240: /// to debug backtrace pointers switch this on:
241: #if defined(_DEBUG) || defined(PA_RELEASE_ASSERTS)
242: //// this switches on straightforward realloc implementation, bad for profiling
243: //// note: this is incompatible with -DGC_ASSERTIONS, which can be switched ON in win32/gc/NT_THREADS_MAKEFILE
244: #define GC_DEBUG
245: #endif
246:
1.24 paf 247: #endif
E-mail: