1 /* d-system.h -- DMD frontend inclusion of gcc header files.
2  * Copyright (C) 2018-2020 Free Software Foundation, Inc.
3  *
4  * GCC is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3, or (at your option)
7  * any later version.
8  *
9  * GCC is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with GCC; see the file COPYING3.  If not see
16  * <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef GCC_D_SYSTEM_H
20 #define GCC_D_SYSTEM_H
21 
22 #include "config.h"
23 #include "system.h"
24 
25 /* Used by the dmd front-end to determine if we have POSIX-style IO.  */
26 #define POSIX (__linux__ || __GLIBC__ || __gnu_hurd__ || __APPLE__ \
27 	       || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ \
28 	       || __sun || __unix__)
29 
30 /* Forward assert invariants to gcc_assert.  */
31 #undef assert
32 #define assert(EXPR) gcc_assert(EXPR)
33 
34 /* Use libiberty's lrealpath to avoid portability problems.  */
35 #undef realpath
36 #define realpath(a, b) lrealpath((a))
37 
38 /* Forward ctype.h macros used by the dmd front-end to safe-ctype.h.  */
39 #undef isalpha
40 #define isalpha(c) ISALPHA(c)
41 #undef isalnum
42 #define isalnum(c) ISALNUM(c)
43 #undef isdigit
44 #define isdigit(c) ISDIGIT(c)
45 #undef islower
46 #define islower(c) ISLOWER(c)
47 #undef isprint
48 #define isprint(c) ISPRINT(c)
49 #undef isspace
50 #define isspace(c) ISSPACE(c)
51 #undef isupper
52 #define isupper(c) ISUPPER(c)
53 #undef isxdigit
54 #define isxdigit(c) ISXDIGIT(c)
55 #undef tolower
56 #define tolower(c) TOLOWER(c)
57 
58 /* Forward _mkdir on MinGW to mkdir in system.h.  */
59 #ifdef _WIN32
60 #undef _mkdir
61 #define _mkdir(p) mkdir(p, 0)
62 #endif
63 
64 /* Define any missing _MAX and _MIN macros.  */
65 #ifndef INT32_MAX
66 # define INT32_MAX INTTYPE_MAXIMUM (int32_t)
67 #endif
68 #ifndef INT32_MIN
69 # define INT32_MIN INTTYPE_MINIMUM (int32_t)
70 #endif
71 #ifndef INT64_MIN
72 # define INT64_MIN INTTYPE_MINIMUM (int64_t)
73 #endif
74 #ifndef UINT32_MAX
75 # define UINT32_MAX INTTYPE_MAXIMUM (uint32_t)
76 #endif
77 #ifndef UINT64_MAX
78 # define UINT64_MAX INTTYPE_MAXIMUM (uint64_t)
79 #endif
80 
81 #endif  /* GCC_D_SYSTEM_H  */
82