]> jfr.im git - solanum.git/blob - include/stdinc.h
Merge pull request #334 from edk0/massnotice
[solanum.git] / include / stdinc.h
1 /*
2 * ircd-ratbox: A slightly useful ircd.
3 * stdinc.h: Pull in all of the necessary system headers
4 *
5 * Copyright (C) 2002 Aaron Sethman <androsyn@ratbox.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 */
23
24 #include "rb_lib.h"
25 #include "ircd_defs.h" /* Needed for some reasons here -- dwr */
26
27 /* AIX requires this to be the first thing in the file. */
28 #ifdef __GNUC__
29 #undef alloca
30 #define alloca __builtin_alloca
31 #else
32 # ifdef _MSC_VER
33 # include <malloc.h>
34 # define alloca _alloca
35 # else
36 # if HAVE_ALLOCA_H
37 # include <alloca.h>
38 # else
39 # ifdef _AIX
40 #pragma alloca
41 # else
42 # ifndef alloca /* predefined by HP cc +Olibcalls */
43 char *alloca ();
44 # endif
45 # endif
46 # endif
47 # endif
48 #endif
49
50
51 #ifdef HAVE_STDLIB_H
52 #include <stdlib.h>
53 #endif
54 #ifdef STRING_WITH_STRINGS
55 # include <string.h>
56 # include <strings.h>
57 #else
58 # ifdef HAVE_STRING_H
59 # include <string.h>
60 # else
61 # ifdef HAVE_STRINGS_H
62 # include <strings.h>
63 # endif
64 # endif
65 #endif
66
67
68 #ifdef HAVE_STDDEF_H
69 #include <stddef.h>
70 #endif
71
72
73 #ifdef HAVE_STDBOOL_H
74 # include <stdbool.h>
75 #else
76 # ifndef HAVE__BOOL
77 # ifdef __cplusplus
78 typedef bool _Bool;
79 # else
80 # define _Bool signed char
81 # endif
82 # endif
83 # define bool _Bool
84 # define false 0
85 # define true 1
86 # define __bool_true_false_are_defined 1
87 #endif
88
89
90 #include <stdio.h>
91 #include <assert.h>
92 #include <stdio.h>
93 #include <time.h>
94 #include <fcntl.h>
95 #include <stdarg.h>
96 #include <signal.h>
97 #include <dirent.h>
98 #include <ctype.h>
99
100 #include <limits.h>
101
102 #ifdef HAVE_UNISTD_H
103 #include <unistd.h>
104 #endif
105
106 #include <sys/time.h>
107 #include <sys/types.h>
108 #include <sys/file.h>
109 #ifdef HAVE_SYS_RESOURCE_H
110 #include <sys/resource.h>
111 #endif
112
113
114 #include <sys/stat.h>
115
116 #ifdef HAVE_SYS_PARAM_H
117 #include <sys/param.h>
118 #endif
119
120 #ifdef HAVE_ERRNO_H
121 #include <errno.h>
122 #else
123 extern int errno;
124 #endif
125
126 #ifdef HAVE_SYS_UIO_H
127 #include <sys/uio.h>
128 #endif
129
130 #if defined(__INTEL_COMPILER) || defined(__GNUC__)
131 # ifdef __unused
132 # undef __unused
133 # endif
134 # ifdef __printf
135 # undef __printf
136 # endif
137 # ifdef __noreturn
138 # undef __noreturn
139 # endif
140
141 # define __unused __attribute__((__unused__))
142 # define __printf(x) __attribute__((__format__ (__printf__, x, x + 1)))
143 # define __noreturn __attribute__((__noreturn__))
144 #else
145 # define __unused
146 # define __printf
147 # define __noreturn
148 #endif
149
150
151
152 #ifdef strdupa
153 #define LOCAL_COPY(s) strdupa(s)
154 #else
155 #if defined(__INTEL_COMPILER) || defined(__GNUC__)
156 # define LOCAL_COPY(s) __extension__({ char *_s = alloca(strlen(s) + 1); strcpy(_s, s); _s; })
157 #else
158 # define LOCAL_COPY(s) strcpy(alloca(strlen(s) + 1), s) /* XXX Is that allowed? */
159 #endif /* defined(__INTEL_COMPILER) || defined(__GNUC__) */
160 #endif /* strdupa */