Home | History | Annotate | Line # | Download | only in libcpp
      1       1.1  mrg /* Get common system includes and various definitions and declarations based
      2       1.1  mrg    on autoconf macros.
      3  1.1.1.12  mrg    Copyright (C) 1998-2024 Free Software Foundation, Inc.
      4       1.1  mrg 
      5       1.1  mrg This file is part of GCC.
      6       1.1  mrg 
      7       1.1  mrg GCC is free software; you can redistribute it and/or modify it under
      8       1.1  mrg the terms of the GNU General Public License as published by the Free
      9       1.1  mrg Software Foundation; either version 3, or (at your option) any later
     10       1.1  mrg version.
     11       1.1  mrg 
     12       1.1  mrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
     13       1.1  mrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
     14       1.1  mrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     15       1.1  mrg for more details.
     16       1.1  mrg 
     17       1.1  mrg You should have received a copy of the GNU General Public License
     18       1.1  mrg along with GCC; see the file COPYING3.  If not see
     19       1.1  mrg <http://www.gnu.org/licenses/>.  */
     20       1.1  mrg 
     21       1.1  mrg 
     22       1.1  mrg #ifndef LIBCPP_SYSTEM_H
     23       1.1  mrg #define LIBCPP_SYSTEM_H
     24       1.1  mrg 
     25       1.1  mrg /* We must include stdarg.h before stdio.h.  */
     26       1.1  mrg #include <stdarg.h>
     27       1.1  mrg 
     28       1.1  mrg #ifdef HAVE_STDDEF_H
     29       1.1  mrg # include <stddef.h>
     30       1.1  mrg #endif
     31   1.1.1.2  mrg #ifdef HAVE_STDINT_H
     32   1.1.1.2  mrg # include <stdint.h>
     33   1.1.1.2  mrg #endif
     34   1.1.1.2  mrg #ifdef HAVE_INTTYPES_H
     35   1.1.1.2  mrg # include <inttypes.h>
     36   1.1.1.2  mrg #endif
     37       1.1  mrg 
     38       1.1  mrg #include <stdio.h>
     39       1.1  mrg 
     40   1.1.1.9  mrg #ifdef __cplusplus
     41   1.1.1.9  mrg #include <new>
     42   1.1.1.9  mrg #endif
     43   1.1.1.9  mrg 
     44       1.1  mrg /* Define a generic NULL if one hasn't already been defined.  */
     45       1.1  mrg #ifndef NULL
     46       1.1  mrg #define NULL 0
     47       1.1  mrg #endif
     48       1.1  mrg 
     49       1.1  mrg /* Use the unlocked open routines from libiberty.  */
     50   1.1.1.2  mrg 
     51   1.1.1.2  mrg /* Some of these are #define on some systems, e.g. on AIX to redirect
     52   1.1.1.2  mrg    the names to 64bit capable functions for LARGE_FILES support. These
     53   1.1.1.2  mrg    redefs are pointless here so we can override them.  */
     54   1.1.1.2  mrg 
     55   1.1.1.2  mrg #undef fopen
     56   1.1.1.2  mrg #undef freopen
     57   1.1.1.2  mrg 
     58       1.1  mrg #define fopen(PATH,MODE) fopen_unlocked(PATH,MODE)
     59       1.1  mrg #define fdopen(FILDES,MODE) fdopen_unlocked(FILDES,MODE)
     60       1.1  mrg #define freopen(PATH,MODE,STREAM) freopen_unlocked(PATH,MODE,STREAM)
     61       1.1  mrg 
     62       1.1  mrg /* The compiler is not a multi-threaded application and therefore we
     63       1.1  mrg    do not have to use the locking functions.  In fact, using the locking
     64       1.1  mrg    functions can cause the compiler to be significantly slower under
     65       1.1  mrg    I/O bound conditions (such as -g -O0 on very large source files).
     66       1.1  mrg 
     67       1.1  mrg    HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the stdio
     68       1.1  mrg    code is multi-thread safe by default.  If it is set to 0, then do
     69       1.1  mrg    not worry about using the _unlocked functions.
     70       1.1  mrg 
     71       1.1  mrg    fputs_unlocked, fwrite_unlocked, and fprintf_unlocked are
     72       1.1  mrg    extensions and need to be prototyped by hand (since we do not
     73       1.1  mrg    define _GNU_SOURCE).  */
     74       1.1  mrg 
     75       1.1  mrg #if defined HAVE_DECL_PUTC_UNLOCKED && HAVE_DECL_PUTC_UNLOCKED
     76       1.1  mrg 
     77       1.1  mrg # ifdef HAVE_PUTC_UNLOCKED
     78       1.1  mrg #  undef putc
     79       1.1  mrg #  define putc(C, Stream) putc_unlocked (C, Stream)
     80       1.1  mrg # endif
     81       1.1  mrg # ifdef HAVE_PUTCHAR_UNLOCKED
     82       1.1  mrg #  undef putchar
     83       1.1  mrg #  define putchar(C) putchar_unlocked (C)
     84       1.1  mrg # endif
     85       1.1  mrg # ifdef HAVE_GETC_UNLOCKED
     86       1.1  mrg #  undef getc
     87       1.1  mrg #  define getc(Stream) getc_unlocked (Stream)
     88       1.1  mrg # endif
     89       1.1  mrg # ifdef HAVE_GETCHAR_UNLOCKED
     90       1.1  mrg #  undef getchar
     91       1.1  mrg #  define getchar() getchar_unlocked ()
     92       1.1  mrg # endif
     93       1.1  mrg # ifdef HAVE_FPUTC_UNLOCKED
     94       1.1  mrg #  undef fputc
     95       1.1  mrg #  define fputc(C, Stream) fputc_unlocked (C, Stream)
     96       1.1  mrg # endif
     97       1.1  mrg 
     98   1.1.1.2  mrg #ifdef __cplusplus
     99   1.1.1.2  mrg extern "C" {
    100   1.1.1.2  mrg #endif
    101   1.1.1.2  mrg 
    102       1.1  mrg # ifdef HAVE_CLEARERR_UNLOCKED
    103       1.1  mrg #  undef clearerr
    104       1.1  mrg #  define clearerr(Stream) clearerr_unlocked (Stream)
    105       1.1  mrg #  if defined (HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED
    106       1.1  mrg extern void clearerr_unlocked (FILE *);
    107       1.1  mrg #  endif
    108       1.1  mrg # endif
    109       1.1  mrg # ifdef HAVE_FEOF_UNLOCKED
    110       1.1  mrg #  undef feof
    111       1.1  mrg #  define feof(Stream) feof_unlocked (Stream)
    112       1.1  mrg #  if defined (HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
    113       1.1  mrg extern int feof_unlocked (FILE *);
    114       1.1  mrg #  endif
    115       1.1  mrg # endif
    116       1.1  mrg # ifdef HAVE_FILENO_UNLOCKED
    117       1.1  mrg #  undef fileno
    118       1.1  mrg #  define fileno(Stream) fileno_unlocked (Stream)
    119       1.1  mrg #  if defined (HAVE_DECL_FILENO_UNLOCKED) && !HAVE_DECL_FILENO_UNLOCKED
    120       1.1  mrg extern int fileno_unlocked (FILE *);
    121       1.1  mrg #  endif
    122       1.1  mrg # endif
    123       1.1  mrg # ifdef HAVE_FFLUSH_UNLOCKED
    124       1.1  mrg #  undef fflush
    125       1.1  mrg #  define fflush(Stream) fflush_unlocked (Stream)
    126       1.1  mrg #  if defined (HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
    127       1.1  mrg extern int fflush_unlocked (FILE *);
    128       1.1  mrg #  endif
    129       1.1  mrg # endif
    130       1.1  mrg # ifdef HAVE_FGETC_UNLOCKED
    131       1.1  mrg #  undef fgetc
    132       1.1  mrg #  define fgetc(Stream) fgetc_unlocked (Stream)
    133       1.1  mrg #  if defined (HAVE_DECL_FGETC_UNLOCKED) && !HAVE_DECL_FGETC_UNLOCKED
    134       1.1  mrg extern int fgetc_unlocked (FILE *);
    135       1.1  mrg #  endif
    136       1.1  mrg # endif
    137       1.1  mrg # ifdef HAVE_FGETS_UNLOCKED
    138       1.1  mrg #  undef fgets
    139       1.1  mrg #  define fgets(S, n, Stream) fgets_unlocked (S, n, Stream)
    140       1.1  mrg #  if defined (HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
    141       1.1  mrg extern char *fgets_unlocked (char *, int, FILE *);
    142       1.1  mrg #  endif
    143       1.1  mrg # endif
    144       1.1  mrg # ifdef HAVE_FPUTS_UNLOCKED
    145       1.1  mrg #  undef fputs
    146       1.1  mrg #  define fputs(String, Stream) fputs_unlocked (String, Stream)
    147       1.1  mrg #  if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
    148       1.1  mrg extern int fputs_unlocked (const char *, FILE *);
    149       1.1  mrg #  endif
    150       1.1  mrg # endif
    151       1.1  mrg # ifdef HAVE_FERROR_UNLOCKED
    152       1.1  mrg #  undef ferror
    153       1.1  mrg #  define ferror(Stream) ferror_unlocked (Stream)
    154       1.1  mrg #  if defined (HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
    155       1.1  mrg extern int ferror_unlocked (FILE *);
    156       1.1  mrg #  endif
    157       1.1  mrg # endif
    158       1.1  mrg # ifdef HAVE_FREAD_UNLOCKED
    159       1.1  mrg #  undef fread
    160       1.1  mrg #  define fread(Ptr, Size, N, Stream) fread_unlocked (Ptr, Size, N, Stream)
    161       1.1  mrg #  if defined (HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
    162       1.1  mrg extern size_t fread_unlocked (void *, size_t, size_t, FILE *);
    163       1.1  mrg #  endif
    164       1.1  mrg # endif
    165       1.1  mrg # ifdef HAVE_FWRITE_UNLOCKED
    166       1.1  mrg #  undef fwrite
    167       1.1  mrg #  define fwrite(Ptr, Size, N, Stream) fwrite_unlocked (Ptr, Size, N, Stream)
    168       1.1  mrg #  if defined (HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
    169       1.1  mrg extern size_t fwrite_unlocked (const void *, size_t, size_t, FILE *);
    170       1.1  mrg #  endif
    171       1.1  mrg # endif
    172       1.1  mrg # ifdef HAVE_FPRINTF_UNLOCKED
    173       1.1  mrg #  undef fprintf
    174       1.1  mrg /* We can't use a function-like macro here because we don't know if
    175       1.1  mrg    we have varargs macros.  */
    176       1.1  mrg #  define fprintf fprintf_unlocked
    177       1.1  mrg #  if defined (HAVE_DECL_FPRINTF_UNLOCKED) && !HAVE_DECL_FPRINTF_UNLOCKED
    178       1.1  mrg extern int fprintf_unlocked (FILE *, const char *, ...);
    179       1.1  mrg #  endif
    180       1.1  mrg # endif
    181       1.1  mrg 
    182   1.1.1.2  mrg #ifdef __cplusplus
    183   1.1.1.2  mrg }
    184   1.1.1.2  mrg #endif
    185   1.1.1.2  mrg 
    186       1.1  mrg #endif
    187       1.1  mrg 
    188       1.1  mrg /* ??? Glibc's fwrite/fread_unlocked macros cause
    189       1.1  mrg    "warning: signed and unsigned type in conditional expression".  */
    190       1.1  mrg #undef fread_unlocked
    191       1.1  mrg #undef fwrite_unlocked
    192       1.1  mrg 
    193       1.1  mrg #include <sys/types.h>
    194       1.1  mrg #include <errno.h>
    195       1.1  mrg 
    196       1.1  mrg #if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
    197       1.1  mrg extern int errno;
    198       1.1  mrg #endif
    199       1.1  mrg 
    200       1.1  mrg /* Some of glibc's string inlines cause warnings.  Plus we'd rather
    201       1.1  mrg    rely on (and therefore test) GCC's string builtins.  */
    202       1.1  mrg #define __NO_STRING_INLINES
    203       1.1  mrg 
    204       1.1  mrg #ifdef STRING_WITH_STRINGS
    205       1.1  mrg # include <string.h>
    206       1.1  mrg # include <strings.h>
    207       1.1  mrg #else
    208       1.1  mrg # ifdef HAVE_STRING_H
    209       1.1  mrg #  include <string.h>
    210       1.1  mrg # else
    211       1.1  mrg #  ifdef HAVE_STRINGS_H
    212       1.1  mrg #   include <strings.h>
    213       1.1  mrg #  endif
    214       1.1  mrg # endif
    215       1.1  mrg #endif
    216       1.1  mrg 
    217       1.1  mrg #ifdef HAVE_STDLIB_H
    218       1.1  mrg # include <stdlib.h>
    219       1.1  mrg #endif
    220       1.1  mrg 
    221       1.1  mrg #ifdef HAVE_UNISTD_H
    222       1.1  mrg # include <unistd.h>
    223       1.1  mrg #endif
    224       1.1  mrg 
    225       1.1  mrg #if HAVE_LIMITS_H
    226       1.1  mrg # include <limits.h>
    227       1.1  mrg #endif
    228       1.1  mrg 
    229       1.1  mrg /* Infrastructure for defining missing _MAX and _MIN macros.  Note that
    230       1.1  mrg    macros defined with these cannot be used in #if.  */
    231       1.1  mrg 
    232       1.1  mrg /* The extra casts work around common compiler bugs.  */
    233       1.1  mrg #define INTTYPE_SIGNED(t) (! ((t) 0 < (t) -1))
    234       1.1  mrg /* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
    235       1.1  mrg    It is necessary at least when t == time_t.  */
    236       1.1  mrg #define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \
    237   1.1.1.4  mrg 			    ? (t) 1 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
    238       1.1  mrg #define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t)))
    239       1.1  mrg 
    240       1.1  mrg /* Use that infrastructure to provide a few constants.  */
    241       1.1  mrg #ifndef UCHAR_MAX
    242       1.1  mrg # define UCHAR_MAX INTTYPE_MAXIMUM (unsigned char)
    243       1.1  mrg #endif
    244       1.1  mrg 
    245       1.1  mrg #ifdef TIME_WITH_SYS_TIME
    246       1.1  mrg # include <sys/time.h>
    247       1.1  mrg # include <time.h>
    248       1.1  mrg #else
    249       1.1  mrg # if HAVE_SYS_TIME_H
    250       1.1  mrg #  include <sys/time.h>
    251       1.1  mrg # else
    252       1.1  mrg #  ifdef HAVE_TIME_H
    253       1.1  mrg #   include <time.h>
    254       1.1  mrg #  endif
    255       1.1  mrg # endif
    256       1.1  mrg #endif
    257       1.1  mrg 
    258       1.1  mrg #ifdef HAVE_FCNTL_H
    259       1.1  mrg # include <fcntl.h>
    260       1.1  mrg #else
    261       1.1  mrg # ifdef HAVE_SYS_FILE_H
    262       1.1  mrg #  include <sys/file.h>
    263       1.1  mrg # endif
    264       1.1  mrg #endif
    265       1.1  mrg 
    266       1.1  mrg #ifdef HAVE_LOCALE_H
    267       1.1  mrg # include <locale.h>
    268       1.1  mrg #endif
    269       1.1  mrg 
    270       1.1  mrg #ifdef HAVE_LANGINFO_CODESET
    271       1.1  mrg # include <langinfo.h>
    272       1.1  mrg #endif
    273       1.1  mrg 
    274       1.1  mrg #ifndef HAVE_SETLOCALE
    275       1.1  mrg # define setlocale(category, locale) (locale)
    276       1.1  mrg #endif
    277       1.1  mrg 
    278       1.1  mrg #ifdef ENABLE_NLS
    279       1.1  mrg #include <libintl.h>
    280       1.1  mrg #else
    281       1.1  mrg /* Stubs.  */
    282       1.1  mrg # undef dgettext
    283       1.1  mrg # define dgettext(package, msgid) (msgid)
    284       1.1  mrg #endif
    285       1.1  mrg 
    286       1.1  mrg #ifndef _
    287       1.1  mrg # define _(msgid) dgettext (PACKAGE, msgid)
    288       1.1  mrg #endif
    289       1.1  mrg 
    290       1.1  mrg #ifndef N_
    291       1.1  mrg # define N_(msgid) msgid
    292       1.1  mrg #endif
    293       1.1  mrg 
    294       1.1  mrg /* Some systems define these in, e.g., param.h.  We undefine these names
    295       1.1  mrg    here to avoid the warnings.  We prefer to use our definitions since we
    296       1.1  mrg    know they are correct.  */
    297       1.1  mrg 
    298       1.1  mrg #undef MIN
    299       1.1  mrg #undef MAX
    300       1.1  mrg #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
    301       1.1  mrg #define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
    302       1.1  mrg 
    303       1.1  mrg /* The HAVE_DECL_* macros are three-state, undefined, 0 or 1.  If they
    304       1.1  mrg    are defined to 0 then we must provide the relevant declaration
    305       1.1  mrg    here.  These checks will be in the undefined state while configure
    306       1.1  mrg    is running so be careful to test "defined (HAVE_DECL_*)".  */
    307       1.1  mrg 
    308   1.1.1.2  mrg #ifdef __cplusplus
    309   1.1.1.2  mrg extern "C" {
    310   1.1.1.2  mrg #endif
    311   1.1.1.2  mrg 
    312       1.1  mrg #if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT
    313       1.1  mrg extern void abort (void);
    314       1.1  mrg #endif
    315       1.1  mrg 
    316   1.1.1.2  mrg #ifdef __cplusplus
    317   1.1.1.2  mrg }
    318   1.1.1.2  mrg #endif
    319   1.1.1.2  mrg 
    320       1.1  mrg #if HAVE_SYS_STAT_H
    321       1.1  mrg # include <sys/stat.h>
    322       1.1  mrg #endif
    323       1.1  mrg 
    324       1.1  mrg /* Test if something is a normal file.  */
    325       1.1  mrg #ifndef S_ISREG
    326       1.1  mrg #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
    327       1.1  mrg #endif
    328       1.1  mrg 
    329       1.1  mrg /* Test if something is a directory.  */
    330       1.1  mrg #ifndef S_ISDIR
    331       1.1  mrg #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
    332       1.1  mrg #endif
    333       1.1  mrg 
    334       1.1  mrg /* Test if something is a character special file.  */
    335       1.1  mrg #ifndef S_ISCHR
    336       1.1  mrg #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
    337       1.1  mrg #endif
    338       1.1  mrg 
    339       1.1  mrg /* Test if something is a block special file.  */
    340       1.1  mrg #ifndef S_ISBLK
    341       1.1  mrg #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
    342       1.1  mrg #endif
    343       1.1  mrg 
    344       1.1  mrg /* Test if something is a socket.  */
    345       1.1  mrg #ifndef S_ISSOCK
    346       1.1  mrg # ifdef S_IFSOCK
    347       1.1  mrg #   define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
    348       1.1  mrg # else
    349       1.1  mrg #   define S_ISSOCK(m) 0
    350       1.1  mrg # endif
    351       1.1  mrg #endif
    352       1.1  mrg 
    353       1.1  mrg /* Test if something is a FIFO.  */
    354       1.1  mrg #ifndef S_ISFIFO
    355       1.1  mrg # ifdef S_IFIFO
    356       1.1  mrg #  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
    357       1.1  mrg # else
    358       1.1  mrg #  define S_ISFIFO(m) 0
    359       1.1  mrg # endif
    360       1.1  mrg #endif
    361       1.1  mrg 
    362       1.1  mrg /* Approximate O_NOCTTY and O_BINARY.  */
    363       1.1  mrg #ifndef O_NOCTTY
    364       1.1  mrg #define O_NOCTTY 0
    365       1.1  mrg #endif
    366       1.1  mrg #ifndef O_BINARY
    367       1.1  mrg # define O_BINARY 0
    368       1.1  mrg #endif
    369       1.1  mrg 
    370       1.1  mrg /* Filename handling macros.  */
    371       1.1  mrg #include "filenames.h"
    372       1.1  mrg 
    373       1.1  mrg /* Get libiberty declarations.  */
    374       1.1  mrg #include "libiberty.h"
    375       1.1  mrg #include "safe-ctype.h"
    376       1.1  mrg 
    377       1.1  mrg /* 1 if we have C99 designated initializers.
    378       1.1  mrg 
    379       1.1  mrg    ??? C99 designated initializers are not supported by most C++
    380       1.1  mrg    compilers, including G++.  -- gdr, 2005-05-18  */
    381       1.1  mrg #if !defined(HAVE_DESIGNATED_INITIALIZERS)
    382   1.1.1.5  mrg #ifdef __cplusplus
    383   1.1.1.5  mrg #define HAVE_DESIGNATED_INITIALIZERS 0
    384   1.1.1.5  mrg #else
    385       1.1  mrg #define HAVE_DESIGNATED_INITIALIZERS \
    386   1.1.1.5  mrg    ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
    387   1.1.1.5  mrg #endif
    388       1.1  mrg #endif
    389       1.1  mrg 
    390       1.1  mrg #ifndef offsetof
    391       1.1  mrg #define offsetof(TYPE, MEMBER)	((size_t) &((TYPE *) 0)->MEMBER)
    392       1.1  mrg #endif
    393       1.1  mrg 
    394       1.1  mrg /* __builtin_expect(A, B) evaluates to A, but notifies the compiler that
    395       1.1  mrg    the most likely value of A is B.  This feature was added at some point
    396       1.1  mrg    between 2.95 and 3.0.  Let's use 3.0 as the lower bound for now.  */
    397       1.1  mrg #if (GCC_VERSION < 3000)
    398       1.1  mrg #define __builtin_expect(a, b) (a)
    399       1.1  mrg #endif
    400       1.1  mrg 
    401   1.1.1.4  mrg /* Redefine abort to report an internal error w/o coredump, and
    402   1.1.1.4  mrg    reporting the location of the error in the source file.  */
    403   1.1.1.4  mrg extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
    404   1.1.1.4  mrg #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
    405   1.1.1.4  mrg 
    406   1.1.1.4  mrg /* Use gcc_assert(EXPR) to test invariants.  */
    407   1.1.1.4  mrg #if ENABLE_ASSERT_CHECKING
    408   1.1.1.4  mrg #define gcc_assert(EXPR) 						\
    409   1.1.1.4  mrg    ((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0))
    410   1.1.1.4  mrg #elif (GCC_VERSION >= 4005)
    411   1.1.1.4  mrg #define gcc_assert(EXPR) 						\
    412   1.1.1.4  mrg   ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0))
    413   1.1.1.4  mrg #else
    414   1.1.1.4  mrg /* Include EXPR, so that unused variable warnings do not occur.  */
    415   1.1.1.4  mrg #define gcc_assert(EXPR) ((void)(0 && (EXPR)))
    416   1.1.1.4  mrg #endif
    417   1.1.1.4  mrg 
    418   1.1.1.4  mrg #if CHECKING_P
    419   1.1.1.4  mrg #define gcc_checking_assert(EXPR) gcc_assert (EXPR)
    420   1.1.1.4  mrg #else
    421   1.1.1.4  mrg /* N.B.: in release build EXPR is not evaluated.  */
    422   1.1.1.4  mrg #define gcc_checking_assert(EXPR) ((void)(0 && (EXPR)))
    423   1.1.1.4  mrg #endif
    424   1.1.1.4  mrg 
    425  1.1.1.11  mrg #ifdef __has_cpp_attribute
    426  1.1.1.11  mrg # if __has_cpp_attribute(likely)
    427  1.1.1.11  mrg #  define ATTR_LIKELY [[likely]]
    428  1.1.1.11  mrg # elif __has_cpp_attribute(__likely__)
    429  1.1.1.11  mrg #  define ATTR_LIKELY [[__likely__]]
    430  1.1.1.11  mrg # else
    431  1.1.1.11  mrg #  define ATTR_LIKELY
    432  1.1.1.11  mrg # endif
    433  1.1.1.11  mrg #else
    434  1.1.1.11  mrg # define ATTR_LIKELY
    435       1.1  mrg #endif
    436       1.1  mrg 
    437       1.1  mrg /* Poison identifiers we do not want to use.  */
    438       1.1  mrg #if (GCC_VERSION >= 3000)
    439       1.1  mrg #undef calloc
    440       1.1  mrg #undef strdup
    441       1.1  mrg #undef malloc
    442       1.1  mrg #undef realloc
    443       1.1  mrg  #pragma GCC poison calloc strdup
    444       1.1  mrg  #pragma GCC poison malloc realloc
    445       1.1  mrg 
    446       1.1  mrg /* Libiberty macros that are no longer used in GCC.  */
    447       1.1  mrg #undef ANSI_PROTOTYPES
    448       1.1  mrg #undef PTR_CONST
    449       1.1  mrg #undef LONG_DOUBLE
    450       1.1  mrg #undef VPARAMS
    451       1.1  mrg #undef VA_OPEN
    452       1.1  mrg #undef VA_FIXEDARG
    453       1.1  mrg #undef VA_CLOSE
    454       1.1  mrg #undef VA_START
    455       1.1  mrg  #pragma GCC poison ANSI_PROTOTYPES PTR_CONST LONG_DOUBLE VPARAMS VA_OPEN \
    456       1.1  mrg   VA_FIXEDARG VA_CLOSE VA_START
    457       1.1  mrg 
    458       1.1  mrg /* Note: not all uses of the `index' token (e.g. variable names and
    459       1.1  mrg    structure members) have been eliminated.  */
    460       1.1  mrg #undef bcopy
    461       1.1  mrg #undef bzero
    462       1.1  mrg #undef bcmp
    463       1.1  mrg #undef rindex
    464       1.1  mrg  #pragma GCC poison bcopy bzero bcmp rindex
    465       1.1  mrg 
    466       1.1  mrg #endif /* GCC >= 3.0 */
    467       1.1  mrg #endif /* ! LIBCPP_SYSTEM_H */
    468