tsystem.h revision 96489
1198892Srdivacky/* Get common system includes and various definitions and declarations
2198892Srdivacky   based on target macros.
3198892Srdivacky   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4198892Srdivacky
5198892SrdivackyThis file is part of GCC.
6198892Srdivacky
7198892SrdivackyGCC is free software; you can redistribute it and/or modify it under
8198892Srdivackythe terms of the GNU General Public License as published by the Free
9198892SrdivackySoftware Foundation; either version 2, or (at your option) any later
10198892Srdivackyversion.
11198892Srdivacky
12198892SrdivackyGCC is distributed in the hope that it will be useful, but WITHOUT ANY
13198892SrdivackyWARRANTY; without even the implied warranty of MERCHANTABILITY or
14198892SrdivackyFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15198892Srdivackyfor more details.
16198892Srdivacky
17198892SrdivackyYou should have received a copy of the GNU General Public License
18198892Srdivackyalong with GCC; see the file COPYING.  If not, write to the Free
19198892SrdivackySoftware Foundation, 59 Temple Place - Suite 330, Boston, MA
20198892Srdivacky02111-1307, USA.  */
21210299Sed
22198892Srdivacky#ifndef GCC_TSYSTEM_H
23198892Srdivacky#define GCC_TSYSTEM_H
24198892Srdivacky
25198892Srdivacky/* System headers (e.g. stdio.h, stdlib.h, unistd.h) sometimes
26198892Srdivacky   indirectly include getopt.h.  Our -I flags will cause gcc's gnu
27198892Srdivacky   getopt.h to be included, not the platform's copy.  In the default
28198892Srdivacky   case, gnu getopt.h will provide us with a no-argument prototype
29198892Srdivacky   which will generate -Wstrict-prototypes warnings.  None of the
30224145Sdim   target files actually use getopt, so it is safe to tell gnu
31198892Srdivacky   getopt.h we never need this prototype.  */
32198892Srdivacky#ifndef HAVE_DECL_GETOPT
33210299Sed#define HAVE_DECL_GETOPT 1
34198892Srdivacky#endif
35224145Sdim
36212904Sdim/* GCC supplies this header.  */
37212904Sdim#include <stddef.h>
38234353Sdim
39234353Sdim#ifdef inhibit_libc
40198892Srdivacky
41198892Srdivacky#ifndef malloc
42198892Srdivackyextern void *malloc (size_t);
43198892Srdivacky#endif
44198892Srdivacky
45212904Sdim#ifndef free
46212904Sdimextern void free (void *);
47212904Sdim#endif
48212904Sdim
49198892Srdivacky#ifndef atexit
50212904Sdimextern int atexit (void (*)(void));
51200581Srdivacky#endif
52200581Srdivacky
53200581Srdivacky#else /* ! inhibit_libc */
54198892Srdivacky/* We disable this when inhibit_libc, so that gcc can still be built without
55198892Srdivacky   needing header files first.  */
56234353Sdim/* ??? This is not a good solution, since prototypes may be required in
57198892Srdivacky   some cases for correct code.  */
58234353Sdim
59198892Srdivacky/* GCC supplies this header.  */
60198892Srdivacky#include <stdarg.h>
61198892Srdivacky
62198892Srdivacky/* All systems have this header.  */
63198892Srdivacky#include <stdio.h>
64198892Srdivacky
65239462Sdim/* All systems have this header.  */
66239462Sdim#include <sys/types.h>
67239462Sdim
68239462Sdim/* All systems have this header.  */
69239462Sdim#include <errno.h>
70198892Srdivacky
71198892Srdivacky#ifndef errno
72210299Sedextern int errno;
73210299Sed#endif
74210299Sed
75210299Sed#ifdef POSIX
76210299Sed#include <string.h>
77210299Sed#endif
78198892Srdivacky
79210299Sed/* GCC (fixproto) guarantees these system headers exist.  */
80198892Srdivacky#include <stdlib.h>
81239462Sdim#include <unistd.h>
82239462Sdim
83239462Sdim/* GCC supplies this header.  */
84239462Sdim#include <limits.h>
85239462Sdim
86198892Srdivacky#ifdef POSIX
87210299Sed#include <time.h>
88198892Srdivacky#endif
89198892Srdivacky
90198892Srdivacky#endif /* inhibit_libc */
91198892Srdivacky
92198892Srdivacky/* Define a generic NULL if one hasn't already been defined.  */
93198892Srdivacky#ifndef NULL
94234353Sdim#define NULL 0
95239462Sdim#endif
96239462Sdim
97239462Sdim#endif /* ! GCC_TSYSTEM_H */
98239462Sdim