00001 /* Get common system includes and various definitions and declarations 00002 based on target macros. 00003 Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc. 00004 00005 This file is part of GCC. 00006 00007 GCC is free software; you can redistribute it and/or modify it under 00008 the terms of the GNU General Public License as published by the Free 00009 Software Foundation; either version 2, or (at your option) any later 00010 version. 00011 00012 GCC is distributed in the hope that it will be useful, but WITHOUT ANY 00013 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with GCC; see the file COPYING. If not, write to the Free 00019 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 00020 02110-1301, USA. */ 00021 00022 /* As a special exception, if you link this library with other files, 00023 some of which are compiled with GCC, to produce an executable, 00024 this library does not by itself cause the resulting executable 00025 to be covered by the GNU General Public License. 00026 This exception does not however invalidate any other reasons why 00027 the executable file might be covered by the GNU General Public License. */ 00028 00029 #ifndef GCC_TSYSTEM_H 00030 #define GCC_TSYSTEM_H 00031 00032 /* System headers (e.g. stdio.h, stdlib.h, unistd.h) sometimes 00033 indirectly include getopt.h. Our -I flags will cause gcc's gnu 00034 getopt.h to be included, not the platform's copy. In the default 00035 case, gnu getopt.h will provide us with a no-argument prototype 00036 which will generate -Wstrict-prototypes warnings. None of the 00037 target files actually use getopt, so it is safe to tell gnu 00038 getopt.h we never need this prototype. */ 00039 #ifndef HAVE_DECL_GETOPT 00040 #define HAVE_DECL_GETOPT 1 00041 #endif 00042 00043 /* We want everything from the glibc headers. */ 00044 #define _GNU_SOURCE 1 00045 00046 /* GCC supplies these headers. */ 00047 #include <stddef.h> 00048 #include <float.h> 00049 00050 #ifdef inhibit_libc 00051 00052 #ifndef malloc 00053 extern void *malloc (size_t); 00054 #endif 00055 00056 #ifndef free 00057 extern void free (void *); 00058 #endif 00059 00060 #ifndef atexit 00061 extern int atexit (void (*)(void)); 00062 #endif 00063 00064 #ifndef abort 00065 extern void abort (void) __attribute__ ((__noreturn__)); 00066 #endif 00067 00068 #ifndef strlen 00069 extern size_t strlen (const char *); 00070 #endif 00071 00072 #ifndef memcpy 00073 extern void *memcpy (void *, const void *, size_t); 00074 #endif 00075 00076 #ifndef memset 00077 extern void *memset (void *, int, size_t); 00078 #endif 00079 00080 #else /* ! inhibit_libc */ 00081 /* We disable this when inhibit_libc, so that gcc can still be built without 00082 needing header files first. */ 00083 /* ??? This is not a good solution, since prototypes may be required in 00084 some cases for correct code. */ 00085 00086 /* GCC supplies this header. */ 00087 #include <stdarg.h> 00088 00089 /* All systems have this header. */ 00090 #include <stdio.h> 00091 00092 /* All systems have this header. */ 00093 #include <sys/types.h> 00094 00095 /* All systems have this header. */ 00096 #include <errno.h> 00097 00098 #ifndef errno 00099 extern int errno; 00100 #endif 00101 00102 /* GCC (fixproto) guarantees these system headers exist. */ 00103 #include <string.h> 00104 #include <stdlib.h> 00105 #include <unistd.h> 00106 00107 /* GCC supplies this header. */ 00108 #include <limits.h> 00109 00110 /* GCC (fixproto) guarantees this system headers exists. */ 00111 #include <time.h> 00112 00113 #endif /* inhibit_libc */ 00114 00115 /* Define a generic NULL if one hasn't already been defined. */ 00116 #ifndef NULL 00117 #define NULL 0 00118 #endif 00119 00120 /* GCC always provides __builtin_alloca(x). */ 00121 #undef alloca 00122 #define alloca(x) __builtin_alloca(x) 00123 00124 #ifdef ENABLE_RUNTIME_CHECKING 00125 #define gcc_assert(EXPR) ((void)(!(EXPR) ? abort (), 0 : 0)) 00126 #else 00127 /* Include EXPR, so that unused variable warnings do not occur. */ 00128 #define gcc_assert(EXPR) ((void)(0 && (EXPR))) 00129 #endif 00130 /* Use gcc_unreachable() to mark unreachable locations (like an 00131 unreachable default case of a switch. Do not use gcc_assert(0). */ 00132 #define gcc_unreachable() (abort ()) 00133 00134 /* Filename handling macros. */ 00135 #include "filenames.h" 00136 00137 #endif /* ! GCC_TSYSTEM_H */
1.5.6