]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/tsystem.h
Update copyright years.
[thirdparty/gcc.git] / gcc / tsystem.h
CommitLineData
2e39bdbe
KG
1/* Get common system includes and various definitions and declarations
2 based on target macros.
818ab71a 3 Copyright (C) 2000-2016 Free Software Foundation, Inc.
2e39bdbe 4
1322177d 5This file is part of GCC.
2e39bdbe 6
1322177d
LB
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
748086b7 9Software Foundation; either version 3, or (at your option) any later
1322177d 10version.
2e39bdbe 11
1322177d
LB
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
2e39bdbe 16
748086b7
JJ
17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24<http://www.gnu.org/licenses/>. */
77c915d8 25
88657302
RH
26#ifndef GCC_TSYSTEM_H
27#define GCC_TSYSTEM_H
2e39bdbe 28
16b97540
KG
29/* System headers (e.g. stdio.h, stdlib.h, unistd.h) sometimes
30 indirectly include getopt.h. Our -I flags will cause gcc's gnu
31 getopt.h to be included, not the platform's copy. In the default
32 case, gnu getopt.h will provide us with a no-argument prototype
33 which will generate -Wstrict-prototypes warnings. None of the
34 target files actually use getopt, so it is safe to tell gnu
35 getopt.h we never need this prototype. */
36#ifndef HAVE_DECL_GETOPT
37#define HAVE_DECL_GETOPT 1
38#endif
39
40aac948
JM
40/* We want everything from the glibc headers. */
41#define _GNU_SOURCE 1
42
15e5ad76 43/* GCC supplies these headers. */
2e39bdbe 44#include <stddef.h>
15e5ad76 45#include <float.h>
2e39bdbe
KG
46
47#ifdef inhibit_libc
48
49#ifndef malloc
50extern void *malloc (size_t);
51#endif
52
53#ifndef free
54extern void free (void *);
55#endif
56
57#ifndef atexit
58extern int atexit (void (*)(void));
59#endif
60
7e7de68b
DE
61#ifndef abort
62extern void abort (void) __attribute__ ((__noreturn__));
63#endif
64
488c98d8
KH
65#ifndef strlen
66extern size_t strlen (const char *);
67#endif
68
7f148c2f
JB
69#ifndef memcpy
70extern void *memcpy (void *, const void *, size_t);
71#endif
72
73#ifndef memset
74extern void *memset (void *, int, size_t);
75#endif
76
2e39bdbe
KG
77#else /* ! inhibit_libc */
78/* We disable this when inhibit_libc, so that gcc can still be built without
79 needing header files first. */
80/* ??? This is not a good solution, since prototypes may be required in
81 some cases for correct code. */
82
2ba84f36 83/* GCC supplies this header. */
2e39bdbe
KG
84#include <stdarg.h>
85
2ba84f36 86/* All systems have this header. */
2e39bdbe
KG
87#include <stdio.h>
88
2ba84f36 89/* All systems have this header. */
2e39bdbe
KG
90#include <sys/types.h>
91
2ba84f36 92/* All systems have this header. */
2e39bdbe
KG
93#include <errno.h>
94
95#ifndef errno
96extern int errno;
97#endif
98
52c0e446 99/* If these system headers do not exist, fixincludes must create them. */
cbbf876b 100#include <string.h>
2e39bdbe
KG
101#include <stdlib.h>
102#include <unistd.h>
103
2ba84f36 104/* GCC supplies this header. */
2e39bdbe
KG
105#include <limits.h>
106
52c0e446 107/* If these system headers do not exist, fixincludes must create them. */
2e39bdbe 108#include <time.h>
2e39bdbe
KG
109
110#endif /* inhibit_libc */
111
112/* Define a generic NULL if one hasn't already been defined. */
113#ifndef NULL
114#define NULL 0
115#endif
116
2c82eecc
KG
117/* GCC always provides __builtin_alloca(x). */
118#undef alloca
119#define alloca(x) __builtin_alloca(x)
120
b53ef395
NS
121#ifdef ENABLE_RUNTIME_CHECKING
122#define gcc_assert(EXPR) ((void)(!(EXPR) ? abort (), 0 : 0))
123#else
124/* Include EXPR, so that unused variable warnings do not occur. */
125#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
126#endif
127/* Use gcc_unreachable() to mark unreachable locations (like an
128 unreachable default case of a switch. Do not use gcc_assert(0). */
129#define gcc_unreachable() (abort ())
130
96c891b3 131#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
c3284718 132#define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X))
96c891b3 133
992f396f
GZ
134/* Filename handling macros. */
135#include "filenames.h"
136
88657302 137#endif /* ! GCC_TSYSTEM_H */