OSDN Git Service

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