xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/d/d-system.h (revision 4c3eb207d36f67d31994830c0a694161fc1ca39b)
1627f7eb2Smrg /* d-system.h -- DMD frontend inclusion of gcc header files.
2*4c3eb207Smrg  * Copyright (C) 2018-2020 Free Software Foundation, Inc.
3627f7eb2Smrg  *
4627f7eb2Smrg  * GCC is free software; you can redistribute it and/or modify
5627f7eb2Smrg  * it under the terms of the GNU General Public License as published by
6627f7eb2Smrg  * the Free Software Foundation; either version 3, or (at your option)
7627f7eb2Smrg  * any later version.
8627f7eb2Smrg  *
9627f7eb2Smrg  * GCC is distributed in the hope that it will be useful,
10627f7eb2Smrg  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11627f7eb2Smrg  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12627f7eb2Smrg  * GNU General Public License for more details.
13627f7eb2Smrg  *
14627f7eb2Smrg  * You should have received a copy of the GNU General Public License
15627f7eb2Smrg  * along with GCC; see the file COPYING3.  If not see
16627f7eb2Smrg  * <http://www.gnu.org/licenses/>.
17627f7eb2Smrg  */
18627f7eb2Smrg 
19627f7eb2Smrg #ifndef GCC_D_SYSTEM_H
20627f7eb2Smrg #define GCC_D_SYSTEM_H
21627f7eb2Smrg 
22627f7eb2Smrg #include "config.h"
23627f7eb2Smrg #include "system.h"
24627f7eb2Smrg 
25627f7eb2Smrg /* Used by the dmd front-end to determine if we have POSIX-style IO.  */
26627f7eb2Smrg #define POSIX (__linux__ || __GLIBC__ || __gnu_hurd__ || __APPLE__ \
27627f7eb2Smrg 	       || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ \
28627f7eb2Smrg 	       || __sun || __unix__)
29627f7eb2Smrg 
30627f7eb2Smrg /* Forward assert invariants to gcc_assert.  */
31627f7eb2Smrg #undef assert
32627f7eb2Smrg #define assert(EXPR) gcc_assert(EXPR)
33627f7eb2Smrg 
34627f7eb2Smrg /* Use libiberty's lrealpath to avoid portability problems.  */
35627f7eb2Smrg #undef realpath
36627f7eb2Smrg #define realpath(a, b) lrealpath((a))
37627f7eb2Smrg 
38627f7eb2Smrg /* Forward ctype.h macros used by the dmd front-end to safe-ctype.h.  */
39627f7eb2Smrg #undef isalpha
40627f7eb2Smrg #define isalpha(c) ISALPHA(c)
41627f7eb2Smrg #undef isalnum
42627f7eb2Smrg #define isalnum(c) ISALNUM(c)
43627f7eb2Smrg #undef isdigit
44627f7eb2Smrg #define isdigit(c) ISDIGIT(c)
45627f7eb2Smrg #undef islower
46627f7eb2Smrg #define islower(c) ISLOWER(c)
47627f7eb2Smrg #undef isprint
48627f7eb2Smrg #define isprint(c) ISPRINT(c)
49627f7eb2Smrg #undef isspace
50627f7eb2Smrg #define isspace(c) ISSPACE(c)
51627f7eb2Smrg #undef isupper
52627f7eb2Smrg #define isupper(c) ISUPPER(c)
53627f7eb2Smrg #undef isxdigit
54627f7eb2Smrg #define isxdigit(c) ISXDIGIT(c)
55627f7eb2Smrg #undef tolower
56627f7eb2Smrg #define tolower(c) TOLOWER(c)
57627f7eb2Smrg 
58627f7eb2Smrg /* Forward _mkdir on MinGW to mkdir in system.h.  */
59627f7eb2Smrg #ifdef _WIN32
60627f7eb2Smrg #undef _mkdir
61627f7eb2Smrg #define _mkdir(p) mkdir(p, 0)
62627f7eb2Smrg #endif
63627f7eb2Smrg 
64627f7eb2Smrg /* Define any missing _MAX and _MIN macros.  */
65627f7eb2Smrg #ifndef INT32_MAX
66627f7eb2Smrg # define INT32_MAX INTTYPE_MAXIMUM (int32_t)
67627f7eb2Smrg #endif
68627f7eb2Smrg #ifndef INT32_MIN
69627f7eb2Smrg # define INT32_MIN INTTYPE_MINIMUM (int32_t)
70627f7eb2Smrg #endif
71627f7eb2Smrg #ifndef INT64_MIN
72627f7eb2Smrg # define INT64_MIN INTTYPE_MINIMUM (int64_t)
73627f7eb2Smrg #endif
74627f7eb2Smrg #ifndef UINT32_MAX
75627f7eb2Smrg # define UINT32_MAX INTTYPE_MAXIMUM (uint32_t)
76627f7eb2Smrg #endif
77627f7eb2Smrg #ifndef UINT64_MAX
78627f7eb2Smrg # define UINT64_MAX INTTYPE_MAXIMUM (uint64_t)
79627f7eb2Smrg #endif
80627f7eb2Smrg 
81627f7eb2Smrg #endif  /* GCC_D_SYSTEM_H  */
82