1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 #if !defined ENABLE_CHECKING && !defined NDEBUG
29 # define NDEBUG
30 #endif
31
32
33
34
35
36
37 #if defined WINDOWSNT && !defined DEFER_MS_W32_H
38 # include <ms-w32.h>
39 #endif
40
41
42
43 #ifndef __GNUC_MINOR__
44 # define GNUC_PREREQ(v, w, x) false
45 #elif ! defined __GNUC_PATCHLEVEL__
46 # define GNUC_PREREQ(v, w, x) \
47 ((v) < __GNUC__ + ((w) < __GNUC_MINOR__ + ((x) == 0))
48 #else
49 # define GNUC_PREREQ(v, w, x) \
50 ((v) < __GNUC__ + ((w) < __GNUC_MINOR__ + ((x) <= __GNUC_PATCHLEVEL__)))
51 #endif
52
53
54
55
56
57
58 #if NS_IMPL_GNUSTEP || defined __MINGW32__
59 typedef unsigned int bool_bf;
60 #else
61 typedef bool bool_bf;
62 #endif
63
64
65
66
67
68 #if (defined __has_attribute \
69 && (!defined __clang_minor__ \
70 || 3 < __clang_major__ + (5 <= __clang_minor__)))
71 # define HAS_ATTRIBUTE(a) __has_attribute (__##a##__)
72 #else
73 # define HAS_ATTRIBUTE(a) HAS_ATTR_##a
74 # define HAS_ATTR_cleanup GNUC_PREREQ (3, 4, 0)
75 # define HAS_ATTR_no_address_safety_analysis false
76 # define HAS_ATTR_no_sanitize false
77 # define HAS_ATTR_no_sanitize_address GNUC_PREREQ (4, 8, 0)
78 # define HAS_ATTR_no_sanitize_undefined GNUC_PREREQ (4, 9, 0)
79 #endif
80
81
82
83 #ifdef __has_feature
84 # define HAS_FEATURE(a) __has_feature (a)
85 #else
86 # define HAS_FEATURE(a) false
87 #endif
88
89
90 #if defined __SANITIZE_ADDRESS__ || HAS_FEATURE (address_sanitizer)
91 # define ADDRESS_SANITIZER true
92 #else
93 # define ADDRESS_SANITIZER false
94 #endif
95
96 #ifdef emacs
97
98
99
100
101 # if (defined DARWIN_OS && defined HAVE_UNEXEC) || defined HYBRID_MALLOC
102 # include <stdlib.h>
103 # endif
104 #endif
105
106 #if defined DARWIN_OS && defined emacs && defined HAVE_UNEXEC
107 # undef malloc
108 # define malloc unexec_malloc
109 # undef realloc
110 # define realloc unexec_realloc
111 # undef free
112 # define free unexec_free
113
114 extern void *unexec_malloc (size_t);
115 extern void *unexec_realloc (void *, size_t);
116 extern void unexec_free (void *);
117
118 #endif
119
120
121
122
123
124 #ifdef HYBRID_MALLOC
125 #ifdef emacs
126 #undef malloc
127 #define malloc hybrid_malloc
128 #undef realloc
129 #define realloc hybrid_realloc
130 #undef aligned_alloc
131 #define aligned_alloc hybrid_aligned_alloc
132 #undef calloc
133 #define calloc hybrid_calloc
134 #undef free
135 #define free hybrid_free
136
137 extern void *hybrid_malloc (size_t);
138 extern void *hybrid_calloc (size_t, size_t);
139 extern void hybrid_free (void *);
140 extern void *hybrid_aligned_alloc (size_t, size_t);
141 extern void *hybrid_realloc (void *, size_t);
142 #endif
143 #endif
144
145
146
147
148
149
150 #ifdef HPUX
151 #undef srandom
152 #undef random
153 #undef HAVE_RANDOM
154 #undef HAVE_RINT
155 #endif
156
157 #ifdef MSDOS
158 #ifndef __DJGPP__
159 You lose;
160 #endif
161 #define _NAIVE_DOS_REGS
162
163
164
165
166
167
168 #define strtold _strtold
169
170 #if __DJGPP__ > 2 || __DJGPP_MINOR__ > 3
171 # define HAVE_LSTAT 1
172 #else
173 # define lstat stat
174
175 # define EOVERFLOW ERANGE
176 # define SIZE_MAX 4294967295U
177 #endif
178
179
180
181 #define mbrtowc(pwc, s, n, ps) mbtowc ((pwc), (s), (n))
182 #define wcrtomb(s, wc, ps) wctomb ((s), (wc))
183 #define btowc(b) ((wchar_t) (b))
184 #define towupper(chr) toupper (chr)
185 #define towlower(chr) tolower (chr)
186 #define iswalnum(chr) isalnum (chr)
187 #define wctype(name) ((wctype_t) 0)
188 #define iswctype(wc, type) false
189 #define mbsinit(ps) 1
190
191
192 #define GNULIB_SUPPORT_ONLY_AT_FDCWD
193
194
195 #define EOPNOTSUPP EINVAL
196
197 #define MALLOC_0_IS_NONNULL 1
198
199
200
201 #define opendir sys_opendir
202
203
204
205 #define emacs_raise(sig) msdos_fatal_signal (sig)
206
207
208 #define DATA_START (&etext + 1)
209
210
211 #ifdef HAVE_X_WINDOWS
212
213
214
215 #define SYSTEM_PURESIZE_EXTRA (-170000+140000)
216 #else
217
218
219
220
221
222
223
224
225
226 #define SYSTEM_PURESIZE_EXTRA (-170000+90000)
227 #endif
228 #endif
229
230
231
232 #ifdef HAVE_NS
233 #if defined NS_IMPL_GNUSTEP
234 # define SYSTEM_PURESIZE_EXTRA 30000
235 #elif defined DARWIN_OS
236 # define SYSTEM_PURESIZE_EXTRA 200000
237 #endif
238 #endif
239
240 #ifdef CYGWIN
241 #define SYSTEM_PURESIZE_EXTRA 50000
242 #endif
243
244 #if defined HAVE_NTGUI && !defined DebPrint
245 # ifdef EMACSDEBUG
246 extern void _DebPrint (const char *fmt, ...);
247 # define DebPrint(stuff) _DebPrint stuff
248 # else
249 # define DebPrint(stuff) ((void) 0)
250 # endif
251 #endif
252
253 #if defined CYGWIN && defined HAVE_NTGUI
254 # define NTGUI_UNICODE
255 # define _WIN32_WINNT 0x500
256
257 #ifndef strnicmp
258 #define strnicmp strncasecmp
259 #endif
260 #endif
261
262 #ifdef emacs
263
264 #define RE_TRANSLATE_TYPE Lisp_Object
265 #define RE_TRANSLATE(TBL, C) char_table_translate (TBL, C)
266 #define RE_TRANSLATE_P(TBL) (!BASE_EQ (TBL, make_fixnum (0)))
267 #endif
268
269
270
271 #define getenv_TZ emacs_getenv_TZ
272 #define setenv_TZ emacs_setenv_TZ
273 extern char *emacs_getenv_TZ (void);
274 extern int emacs_setenv_TZ (char const *);
275
276 #define NO_INLINE _GL_ATTRIBUTE_NOINLINE
277 #define EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
278
279 #if GNUC_PREREQ (4, 4, 0) && defined __GLIBC_MINOR__
280 # define PRINTF_ARCHETYPE __gnu_printf__
281 #elif GNUC_PREREQ (4, 4, 0) && defined __MINGW32__
282 # ifdef MINGW_W64
283
284
285
286
287 # if __USE_MINGW_ANSI_STDIO
288 # define PRINTF_ARCHETYPE __gnu_printf__
289 # else
290 # define PRINTF_ARCHETYPE __ms_printf__
291 # endif
292 # else
293
294
295
296
297 # if GNUC_PREREQ (6, 0, 0) && __MINGW32_MAJOR_VERSION >= 5
298 # define PRINTF_ARCHETYPE __mingw_printf__
299 # else
300 # define PRINTF_ARCHETYPE __ms_printf__
301 # endif
302 # endif
303 #else
304 # define PRINTF_ARCHETYPE __printf__
305 #endif
306 #define ATTRIBUTE_FORMAT_PRINTF(string_index, first_to_check) \
307 _GL_ATTRIBUTE_FORMAT ((PRINTF_ARCHETYPE, string_index, first_to_check))
308
309 #define ARG_NONNULL _GL_ATTRIBUTE_NONNULL
310
311
312
313
314
315
316 #define DECLARE_POINTER_ALIAS(name, type, addr) \
317 type _GL_ATTRIBUTE_MAY_ALIAS *name = (type *) (addr)
318
319 #if 3 <= __GNUC__
320 # define ATTRIBUTE_SECTION(name) __attribute__((section (name)))
321 #else
322 # define ATTRIBUTE_SECTION(name)
323 #endif
324
325 #define ATTRIBUTE_MALLOC_SIZE(args) \
326 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE (args)
327
328
329
330
331
332 #if (! ADDRESS_SANITIZER \
333 || (GNUC_PREREQ (4, 9, 0) \
334 || 3 < __clang_major__ + (4 <= __clang_minor__)))
335 # define ADDRESS_SANITIZER_WORKAROUND
336 #else
337 # define ADDRESS_SANITIZER_WORKAROUND NO_INLINE
338 #endif
339
340
341
342
343 #if HAS_ATTRIBUTE (no_sanitize_address)
344 # define ATTRIBUTE_NO_SANITIZE_ADDRESS \
345 __attribute__ ((no_sanitize_address)) ADDRESS_SANITIZER_WORKAROUND
346 #elif HAS_ATTRIBUTE (no_address_safety_analysis)
347 # define ATTRIBUTE_NO_SANITIZE_ADDRESS \
348 __attribute__ ((no_address_safety_analysis)) ADDRESS_SANITIZER_WORKAROUND
349 #else
350 # define ATTRIBUTE_NO_SANITIZE_ADDRESS
351 #endif
352
353
354
355 #if HAS_ATTRIBUTE (no_sanitize_undefined)
356 # define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
357 #elif HAS_ATTRIBUTE (no_sanitize)
358 # define ATTRIBUTE_NO_SANITIZE_UNDEFINED \
359 __attribute__ ((no_sanitize ("undefined")))
360 #else
361 # define ATTRIBUTE_NO_SANITIZE_UNDEFINED
362 #endif
363
364
365
366
367 #if ADDRESS_SANITIZER && !defined vfork
368 # define vfork fork
369 #endif
370
371
372
373
374 #ifdef DARWIN_OS
375 #define VFORK() \
376 (_Pragma("clang diagnostic push") \
377 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
378 vfork () \
379 _Pragma("clang diagnostic pop"))
380 #else
381 #define VFORK() vfork ()
382 #endif
383
384 #if ! (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)
385 # undef PROFILING
386 #endif
387
388
389 #ifdef noinline
390 #undef noinline
391 #endif
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427 #ifdef EMACS_EXTERN_INLINE
428
429
430
431
432
433
434
435
436 # ifndef INLINE
437 # define INLINE _GL_INLINE
438 # endif
439 # define EXTERN_INLINE _GL_EXTERN_INLINE
440 # define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN
441 # define INLINE_HEADER_END _GL_INLINE_HEADER_END
442
443 #else
444
445
446
447
448 # ifndef INLINE
449 # define INLINE EXTERN_INLINE
450 # endif
451 # define EXTERN_INLINE static inline
452 # define INLINE_HEADER_BEGIN
453 # define INLINE_HEADER_END
454
455 #endif
456
457
458
459 #if defined GCC_LINT || defined lint
460 # define UNINIT = {0,}
461 #else
462 # define UNINIT
463 #endif
464
465
466
467
468
469 #ifdef REPLACEMENT_MB_CUR_MAX
470 #include <stdlib.h>
471 #undef MB_CUR_MAX
472 #define MB_CUR_MAX REPLACEMENT_MB_CUR_MAX
473 #endif