unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob f31e012dc6e6c296faf4a38f668561b5554140c5 15877 bytes (raw)
name: src/conf_post.h 	 # note: path name is non-authoritative(*)

  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
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
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
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
 
/* conf_post.h --- configure.ac includes this via AH_BOTTOM

Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2023 Free Software
Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */

/* Put the code here rather than in configure.ac using AH_BOTTOM.
   This way, the code does not get processed by autoheader.  For
   example, undefs here are not commented out.  */

/* Disable 'assert' unless enabling checking.  Do this early, in
   case some misguided implementation depends on NDEBUG in some
   include file other than assert.h.  */
#if !defined ENABLE_CHECKING && !defined NDEBUG
# define NDEBUG
#endif

/* To help make dependencies clearer elsewhere, this file typically
   does not #include other files.  The exception is ms-w32.h (DOS_NT
   only) because it historically was included here and changing that
   would take some work.  */

#if defined WINDOWSNT && !defined DEFER_MS_W32_H
# include <ms-w32.h>
#endif

/* GNUC_PREREQ (V, W, X) is true if this is GNU C version V.W.X or later.
   It can be used in a preprocessor expression.  */
#ifndef __GNUC_MINOR__
# define GNUC_PREREQ(v, w, x) false
#elif ! defined __GNUC_PATCHLEVEL__
# define GNUC_PREREQ(v, w, x) \
    ((v) < __GNUC__ + ((w) < __GNUC_MINOR__ + ((x) == 0))
#else
# define GNUC_PREREQ(v, w, x) \
    ((v) < __GNUC__ + ((w) < __GNUC_MINOR__ + ((x) <= __GNUC_PATCHLEVEL__)))
#endif

/* The type of bool bitfields.  Needed to compile Objective-C with
   standard GCC, and to make sure adjacent bool_bf fields are packed
   into the same 1-, 2-, or 4-byte allocation unit in the MinGW
   builds.  It was also needed to port to pre-C99 compilers, although
   we don't care about that any more.  */
#if NS_IMPL_GNUSTEP || defined __MINGW32__
typedef unsigned int bool_bf;
#else
typedef bool bool_bf;
#endif

/* A substitute for __has_attribute on compilers that lack it.
   It is used only on arguments like cleanup that are handled here.
   This macro should be used only in #if expressions, as Oracle
   Studio 12.5's __has_attribute does not work in plain code.  */
#if (defined __has_attribute \
     && (!defined __clang_minor__ \
         || 3 < __clang_major__ + (5 <= __clang_minor__)))
# define HAS_ATTRIBUTE(a) __has_attribute (__##a##__)
#else
# define HAS_ATTRIBUTE(a) HAS_ATTR_##a
# define HAS_ATTR_cleanup GNUC_PREREQ (3, 4, 0)
# define HAS_ATTR_no_address_safety_analysis false
# define HAS_ATTR_no_sanitize false
# define HAS_ATTR_no_sanitize_address GNUC_PREREQ (4, 8, 0)
# define HAS_ATTR_no_sanitize_undefined GNUC_PREREQ (4, 9, 0)
#endif

/* A substitute for __has_feature on compilers that lack it.  It is used only
   to define ADDRESS_SANITIZER below.  */
#ifdef __has_feature
# define HAS_FEATURE(a) __has_feature (a)
#else
# define HAS_FEATURE(a) false
#endif

/* True if addresses are being sanitized.  */
#if defined __SANITIZE_ADDRESS__ || HAS_FEATURE (address_sanitizer)
# define ADDRESS_SANITIZER true
#else
# define ADDRESS_SANITIZER false
#endif

#ifdef emacs
/* We include stdlib.h here, because Gnulib's stdlib.h might redirect
   'free' to its replacement, and we want to avoid that in unexec
   builds.  Inclduing it here will render its inclusion after config.h
   a no-op.  */
# if (defined DARWIN_OS && defined HAVE_UNEXEC) || defined HYBRID_MALLOC
#  include <stdlib.h>
# endif
#endif

#if defined DARWIN_OS && defined emacs && defined HAVE_UNEXEC
# undef malloc
# define malloc unexec_malloc
# undef realloc
# define realloc unexec_realloc
# undef free
# define free unexec_free

extern void *unexec_malloc (size_t);
extern void *unexec_realloc (void *, size_t);
extern void unexec_free (void *);

#endif

/* If HYBRID_MALLOC is defined (e.g., on Cygwin), emacs will use
   gmalloc before dumping and the system malloc after dumping.
   hybrid_malloc and friends, defined in gmalloc.c, are wrappers that
   accomplish this.  */
#ifdef HYBRID_MALLOC
#ifdef emacs
#undef malloc
#define malloc hybrid_malloc
#undef realloc
#define realloc hybrid_realloc
#undef aligned_alloc
#define aligned_alloc hybrid_aligned_alloc
#undef calloc
#define calloc hybrid_calloc
#undef free
#define free hybrid_free

extern void *hybrid_malloc (size_t);
extern void *hybrid_calloc (size_t, size_t);
extern void hybrid_free (void *);
extern void *hybrid_aligned_alloc (size_t, size_t);
extern void *hybrid_realloc (void *, size_t);
#endif	/* emacs */
#endif	/* HYBRID_MALLOC */

/* We have to go this route, rather than the old hpux9 approach of
   renaming the functions via macros.  The system's stdlib.h has fully
   prototyped declarations, which yields a conflicting definition of
   srand48; it tries to redeclare what was once srandom to be srand48.
   So we go with HAVE_LRAND48 being defined.  */
#ifdef HPUX
#undef srandom
#undef random
#undef HAVE_RANDOM
#undef HAVE_RINT
#endif  /* HPUX */

#ifdef MSDOS
#ifndef __DJGPP__
You lose; /* Emacs for DOS must be compiled with DJGPP */
#endif
#define _NAIVE_DOS_REGS

/* Start of gnulib-related stuff  */

/* lib/ftoastr.c wants strtold, but DJGPP only has _strtold.  DJGPP >
   2.03 has it, but it also has _strtold as a stub that jumps to
   strtold, so use _strtold in all versions.  */
#define strtold _strtold

#if __DJGPP__ > 2 || __DJGPP_MINOR__ > 3
# define HAVE_LSTAT 1
#else
# define lstat stat
/* DJGPP 2.03 and older don't have the next two.  */
# define EOVERFLOW ERANGE
# define SIZE_MAX  4294967295U
#endif

/* Things that lib/reg* wants.  */

#define mbrtowc(pwc, s, n, ps) mbtowc ((pwc), (s), (n))
#define wcrtomb(s, wc, ps) wctomb ((s), (wc))
#define btowc(b) ((wchar_t) (b))
#define towupper(chr) toupper (chr)
#define towlower(chr) tolower (chr)
#define iswalnum(chr) isalnum (chr)
#define wctype(name) ((wctype_t) 0)
#define iswctype(wc, type) false
#define mbsinit(ps) 1

/* Some things that lib/at-func.c wants.  */
#define GNULIB_SUPPORT_ONLY_AT_FDCWD

/* Needed by lib/lchmod.c.  */
#define EOPNOTSUPP EINVAL

#define MALLOC_0_IS_NONNULL 1

/* We must intercept 'opendir' calls to stash away the directory name,
   so we could reuse it in readlinkat; see msdos.c.  */
#define opendir sys_opendir

/* End of gnulib-related stuff.  */

#define emacs_raise(sig) msdos_fatal_signal (sig)

/* DATA_START is needed by vm-limit.c and unexcoff.c. */
#define DATA_START (&etext + 1)

/* Define one of these for easier conditionals.  */
#ifdef HAVE_X_WINDOWS
/* We need a little extra space, see ../../lisp/loadup.el and the
   commentary below, in the non-X branch.  The 140KB number was
   measured on GNU/Linux and on MS-Windows.  */
#define SYSTEM_PURESIZE_EXTRA (-170000+140000)
#else
/* We need a little extra space, see ../../lisp/loadup.el.
   As of 20091024, DOS-specific files use up 62KB of pure space.  But
   overall, we end up wasting 130KB of pure space, because
   BASE_PURESIZE starts at 1.47MB, while we need only 1.3MB (including
   non-DOS specific files and load history; the latter is about 55K,
   but depends on the depth of the top-level Emacs directory in the
   directory tree).  Given the unknown policy of different DPMI
   hosts regarding loading of untouched pages, I'm not going to risk
   enlarging Emacs footprint by another 100+ KBytes.  */
#define SYSTEM_PURESIZE_EXTRA (-170000+90000)
#endif
#endif  /* MSDOS */

/* macOS / GNUstep need a bit more pure memory.  Of the existing knobs,
   SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
#ifdef HAVE_NS
#if defined NS_IMPL_GNUSTEP
#  define SYSTEM_PURESIZE_EXTRA 30000
#elif defined DARWIN_OS
#  define SYSTEM_PURESIZE_EXTRA 200000
#endif
#endif

#ifdef CYGWIN
#define SYSTEM_PURESIZE_EXTRA 50000
#endif

#if defined HAVE_NTGUI && !defined DebPrint
# ifdef EMACSDEBUG
extern void _DebPrint (const char *fmt, ...);
#  define DebPrint(stuff) _DebPrint stuff
# else
#  define DebPrint(stuff) ((void) 0)
# endif
#endif

#if defined CYGWIN && defined HAVE_NTGUI
# define NTGUI_UNICODE /* Cygwin runs only on UNICODE-supporting systems */
# define _WIN32_WINNT 0x500 /* Win2k */
/* The following was in /usr/include/string.h prior to Cygwin 1.7.33.  */
#ifndef strnicmp
#define strnicmp strncasecmp
#endif
#endif

#ifdef emacs /* Don't do this for lib-src.  */
/* Tell regex.c to use a type compatible with Emacs.  */
#define RE_TRANSLATE_TYPE Lisp_Object
#define RE_TRANSLATE(TBL, C) char_table_translate (TBL, C)
#define RE_TRANSLATE_P(TBL) (!BASE_EQ (TBL, make_fixnum (0)))
#endif

/* Tell time_rz.c to use Emacs's getter and setter for TZ.
   Only Emacs uses time_rz so this is OK.  */
#define getenv_TZ emacs_getenv_TZ
#define setenv_TZ emacs_setenv_TZ
extern char *emacs_getenv_TZ (void);
extern int emacs_setenv_TZ (char const *);

#define NO_INLINE _GL_ATTRIBUTE_NOINLINE
#define EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE

#if GNUC_PREREQ (4, 4, 0) && defined __GLIBC_MINOR__
# define PRINTF_ARCHETYPE __gnu_printf__
#elif GNUC_PREREQ (4, 4, 0) && defined __MINGW32__
# ifdef MINGW_W64
/* When __USE_MINGW_ANSI_STDIO is non-zero (as set by config.h),
   MinGW64 replaces printf* with its own versions that are
   __gnu_printf__ compatible, and emits warnings for MS native %I64d
   format spec.  */
#  if __USE_MINGW_ANSI_STDIO
#   define PRINTF_ARCHETYPE __gnu_printf__
#  else
#   define PRINTF_ARCHETYPE __ms_printf__
#  endif
# else	/* mingw.org's MinGW */
/* Starting from runtime v5.0.0, mingw.org's MinGW with GCC 6 and
   later turns on __USE_MINGW_ANSI_STDIO by default, replaces printf*
   with its own __mingw_printf__ version, which still recognizes
   %I64d.  */
#  if GNUC_PREREQ (6, 0, 0) && __MINGW32_MAJOR_VERSION >= 5
#   define PRINTF_ARCHETYPE __mingw_printf__
#  else  /* __MINGW32_MAJOR_VERSION < 5 */
#   define PRINTF_ARCHETYPE __ms_printf__
#  endif  /* __MINGW32_MAJOR_VERSION < 5 */
# endif	 /* MinGW */
#else
# define PRINTF_ARCHETYPE __printf__
#endif
#define ATTRIBUTE_FORMAT_PRINTF(string_index, first_to_check) \
  _GL_ATTRIBUTE_FORMAT ((PRINTF_ARCHETYPE, string_index, first_to_check))

#define ARG_NONNULL _GL_ATTRIBUTE_NONNULL

/* Declare NAME to be a pointer to an object of type TYPE, initialized
   to the address ADDR, which may be of a different type.  Accesses
   via NAME may alias with other accesses with the traditional
   behavior, even if options like gcc -fstrict-aliasing are used.  */

#define DECLARE_POINTER_ALIAS(name, type, addr) \
  type _GL_ATTRIBUTE_MAY_ALIAS *name = (type *) (addr)

#if 3 <= __GNUC__
# define ATTRIBUTE_SECTION(name) __attribute__((section (name)))
#else
# define ATTRIBUTE_SECTION(name)
#endif

#define ATTRIBUTE_MALLOC_SIZE(args) \
  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE (args)

/* Work around GCC bug 59600: when a function is inlined, the inlined
   code may have its addresses sanitized even if the function has the
   no_sanitize_address attribute.  This bug is fixed in GCC 4.9.0 and
   clang 3.4.  */
#if (! ADDRESS_SANITIZER \
     || (GNUC_PREREQ (4, 9, 0) \
	 || 3 < __clang_major__ + (4 <= __clang_minor__)))
# define ADDRESS_SANITIZER_WORKAROUND /* No workaround needed.  */
#else
# define ADDRESS_SANITIZER_WORKAROUND NO_INLINE
#endif

/* Attribute of functions whose code should not have addresses
   sanitized.  */

#if HAS_ATTRIBUTE (no_sanitize_address)
# define ATTRIBUTE_NO_SANITIZE_ADDRESS \
    __attribute__ ((no_sanitize_address)) ADDRESS_SANITIZER_WORKAROUND
#elif HAS_ATTRIBUTE (no_address_safety_analysis)
# define ATTRIBUTE_NO_SANITIZE_ADDRESS \
    __attribute__ ((no_address_safety_analysis)) ADDRESS_SANITIZER_WORKAROUND
#else
# define ATTRIBUTE_NO_SANITIZE_ADDRESS
#endif

/* Attribute of functions whose undefined behavior should not be sanitized.  */

#if HAS_ATTRIBUTE (no_sanitize_undefined)
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
#elif HAS_ATTRIBUTE (no_sanitize)
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED \
    __attribute__ ((no_sanitize ("undefined")))
#else
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED
#endif

/* gcc -fsanitize=address does not work with vfork in Fedora 28 x86-64.  See:
   https://lists.gnu.org/r/emacs-devel/2017-05/msg00464.html
   For now, assume that this problem occurs on all platforms.  */
#if ADDRESS_SANITIZER && !defined vfork
# define vfork fork
#endif

/* vfork is deprecated on at least macOS 11.6 and later, but it still works
   and is faster than fork, so silence the warning as if we knew what we
   are doing.  */
#ifdef DARWIN_OS
#define VFORK()								\
  (_Pragma("clang diagnostic push")					\
   _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")	\
   vfork ()								\
   _Pragma("clang diagnostic pop"))
#else
#define VFORK() vfork ()
#endif

#if ! (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)
# undef PROFILING
#endif

/* Some versions of GNU/Linux define noinline in their headers.  */
#ifdef noinline
#undef noinline
#endif

/* INLINE marks functions defined in Emacs-internal C headers.
   INLINE is implemented via C99-style 'extern inline' if Emacs is built
   with -DEMACS_EXTERN_INLINE; otherwise it is implemented via 'static'.
   EMACS_EXTERN_INLINE is no longer the default, as 'static' seems to
   have better performance with GCC.

   An include file foo.h should prepend INLINE to function
   definitions, with the following overall pattern:

      [#include any other .h files first.]
      ...
      INLINE_HEADER_BEGIN
      ...
      INLINE int
      incr (int i)
      {
        return i + 1;
      }
      ...
      INLINE_HEADER_END

   For every executable, exactly one file that includes the header
   should do this:

      #define INLINE EXTERN_INLINE

   before including config.h or any other .h file.
   Other .c files should not define INLINE.
   For Emacs, this is done by having emacs.c first '#define INLINE
   EXTERN_INLINE' and then include every .h file that uses INLINE.

   The INLINE_HEADER_BEGIN and INLINE_HEADER_END macros suppress bogus
   warnings in some GCC versions; see ../m4/extern-inline.m4.  */

#ifdef EMACS_EXTERN_INLINE

/* Use Gnulib's extern-inline module for extern inline functions.

   C99 compilers compile functions like 'incr' as C99-style extern
   inline functions.  Buggy GCC implementations do something similar with
   GNU-specific keywords.  Buggy non-GCC compilers use static
   functions, which bloats the code but is good enough.  */

# ifndef INLINE
#  define INLINE _GL_INLINE
# endif
# define EXTERN_INLINE _GL_EXTERN_INLINE
# define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN
# define INLINE_HEADER_END _GL_INLINE_HEADER_END

#else

/* Use 'static inline' instead of 'extern inline' because 'static inline'
   has much better performance for Emacs when compiled with 'gcc -Og'.  */

# ifndef INLINE
#  define INLINE EXTERN_INLINE
# endif
# define EXTERN_INLINE static inline
# define INLINE_HEADER_BEGIN
# define INLINE_HEADER_END

#endif

/* 'int x UNINIT;' is equivalent to 'int x;', except it cajoles GCC
   into not warning incorrectly about use of an uninitialized variable.  */
#if defined GCC_LINT || defined lint
# define UNINIT = {0,}
#else
# define UNINIT /* empty */
#endif

/* MB_CUR_MAX is often broken on systems which copy-paste LLVM
   headers, so replace its definition with a working one if
   necessary.  */

#ifdef REPLACEMENT_MB_CUR_MAX
#include <stdlib.h>
#undef MB_CUR_MAX
#define MB_CUR_MAX REPLACEMENT_MB_CUR_MAX
#endif /* REPLACEMENT_MB_CUR_MAX */

debug log:

solving f31e012dc6e ...
found f31e012dc6e in https://git.savannah.gnu.org/cgit/emacs.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).