]> jfr.im git - irc/rqf/shadowircd.git/blame - include/stdinc.h
m_challenge: fix use of undefined behaviour.
[irc/rqf/shadowircd.git] / include / stdinc.h
CommitLineData
212380e3 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 22 *
23 */
24
db6b0313 25#include "ratbox_lib.h"
212380e3 26#include "config.h" /* Gotta pull in the autoconf stuff */
06c0995c 27#include "ircd_defs.h" /* Needed for some reasons here -- dwr */
212380e3 28
29/* AIX requires this to be the first thing in the file. */
30#ifdef __GNUC__
31#undef alloca
32#define alloca __builtin_alloca
33#else
34# ifdef _MSC_VER
35# include <malloc.h>
36# define alloca _alloca
37# else
38# if HAVE_ALLOCA_H
39# include <alloca.h>
40# else
41# ifdef _AIX
42 #pragma alloca
43# else
44# ifndef alloca /* predefined by HP cc +Olibcalls */
45char *alloca ();
46# endif
47# endif
48# endif
49# endif
50#endif
51
52
53#ifdef HAVE_STDLIB_H
54#include <stdlib.h>
55#endif
56#ifdef STRING_WITH_STRINGS
57# include <string.h>
58# include <strings.h>
59#else
60# ifdef HAVE_STRING_H
61# include <string.h>
62# else
63# ifdef HAVE_STRINGS_H
64# include <strings.h>
65# endif
66# endif
67#endif
68
69
70#ifdef HAVE_STDDEF_H
71#include <stddef.h>
72#endif
73
74
75
76#include <stdio.h>
77#include <assert.h>
78#include <stdio.h>
79#include <time.h>
80#include <fcntl.h>
81#include <netdb.h>
82#include <stdarg.h>
83#include <signal.h>
84#include <dirent.h>
85#include <ctype.h>
86
87#include <limits.h>
88
89#ifdef HAVE_UNISTD_H
90#include <unistd.h>
91#endif
92
93#include <sys/time.h>
94#include <sys/types.h>
95#include <sys/file.h>
96#ifdef HAVE_SYS_RESOURCE_H
97#include <sys/resource.h>
98#endif
99
100
101#include <sys/socket.h>
102#include <sys/stat.h>
103#include <sys/wait.h>
104
105#ifdef HAVE_SYS_PARAM_H
106#include <sys/param.h>
107#endif
108#include <netinet/in.h>
109#include <netinet/tcp.h>
110#include <arpa/inet.h>
111
112#ifdef HAVE_ERRNO_H
113#include <errno.h>
114#else
115extern int errno;
116#endif
117
118#ifdef HAVE_SYS_UIO_H
119#include <sys/uio.h>
120#endif
121
122#if defined(__INTEL_COMPILER) || defined(__GNUC__)
123# ifdef __unused
124# undef __unused
125# endif
126# ifdef __printf
127# undef __printf
128# endif
129# ifdef __noreturn
130# undef __noreturn
131# endif
132
133# define __unused __attribute__((__unused__))
134# define __printf(x) __attribute__((__format__ (__printf__, x, x + 1)))
135# define __noreturn __attribute__((__noreturn__))
136#else
137# define __unused
138# define __printf
139# define __noreturn
140#endif
141
58e8319c
VY
142
143
212380e3 144#ifdef strdupa
145#define LOCAL_COPY(s) strdupa(s)
146#else
147#if defined(__INTEL_COMPILER) || defined(__GNUC__)
148# define LOCAL_COPY(s) __extension__({ char *_s = alloca(strlen(s) + 1); strcpy(_s, s); _s; })
149#else
150# define LOCAL_COPY(s) strcpy(alloca(strlen(s) + 1), s) /* XXX Is that allowed? */
151#endif /* defined(__INTEL_COMPILER) || defined(__GNUC__) */
152#endif /* strdupa */