]> jfr.im git - solanum.git/blame - include/stdinc.h
Remove ancient portability code (#361)
[solanum.git] / include / stdinc.h
CommitLineData
212380e3
AC
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 *
212380e3
AC
22 */
23
fe037171 24#include "rb_lib.h"
6e6a6326 25#include "ircd_defs.h" /* Needed for some reasons here -- dwr */
212380e3
AC
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 */
43char *alloca ();
44# endif
45# endif
46# endif
47# endif
48#endif
55abcbb2 49
212380e3
AC
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
212380e3 67#include <stddef.h>
212380e3 68
07554369
EM
69#ifdef HAVE_STDBOOL_H
70# include <stdbool.h>
71#else
72# ifndef HAVE__BOOL
73# ifdef __cplusplus
74typedef bool _Bool;
75# else
76# define _Bool signed char
77# endif
78# endif
79# define bool _Bool
80# define false 0
81# define true 1
82# define __bool_true_false_are_defined 1
83#endif
84
212380e3
AC
85
86#include <stdio.h>
87#include <assert.h>
88#include <stdio.h>
89#include <time.h>
90#include <fcntl.h>
212380e3
AC
91#include <stdarg.h>
92#include <signal.h>
93#include <dirent.h>
94#include <ctype.h>
95
96#include <limits.h>
212380e3 97#include <unistd.h>
212380e3
AC
98#include <sys/time.h>
99#include <sys/types.h>
100#include <sys/file.h>
212380e3 101#include <sys/resource.h>
212380e3 102
212380e3 103#include <sys/stat.h>
212380e3
AC
104
105#ifdef HAVE_SYS_PARAM_H
106#include <sys/param.h>
107#endif
212380e3 108
212380e3 109#include <errno.h>
212380e3 110#include <sys/uio.h>
212380e3
AC
111
112#if defined(__INTEL_COMPILER) || defined(__GNUC__)
113# ifdef __unused
114# undef __unused
115# endif
116# ifdef __printf
117# undef __printf
118# endif
119# ifdef __noreturn
120# undef __noreturn
121# endif
122
123# define __unused __attribute__((__unused__))
124# define __printf(x) __attribute__((__format__ (__printf__, x, x + 1)))
125# define __noreturn __attribute__((__noreturn__))
126#else
127# define __unused
128# define __printf
129# define __noreturn
130#endif
131
ae78a571
VY
132
133
212380e3 134#ifdef strdupa
55abcbb2 135#define LOCAL_COPY(s) strdupa(s)
212380e3
AC
136#else
137#if defined(__INTEL_COMPILER) || defined(__GNUC__)
138# define LOCAL_COPY(s) __extension__({ char *_s = alloca(strlen(s) + 1); strcpy(_s, s); _s; })
139#else
140# define LOCAL_COPY(s) strcpy(alloca(strlen(s) + 1), s) /* XXX Is that allowed? */
141#endif /* defined(__INTEL_COMPILER) || defined(__GNUC__) */
142#endif /* strdupa */