OSDN Git Service

libiberty:
[pf3gnuchains/gcc-fork.git] / gcc / system.h
index ace7177..8721f7e 100644 (file)
@@ -1,6 +1,6 @@
 /* Get common system includes and various definitions and declarations based
    on autoconf macros.
-   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -43,6 +43,10 @@ Boston, MA 02111-1307, USA.  */
 # endif
 #endif
 
+#ifdef HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+
 #include <stdio.h>
 
 /* Define a generic NULL if one hasn't already been defined.  */
@@ -108,11 +112,25 @@ extern int errno;
 
 #ifdef HAVE_STDLIB_H
 # include <stdlib.h>
-# ifdef USE_C_ALLOCA
-/* Note that systems that use glibc have a <stdlib.h> that includes
-   <alloca.h> that defines alloca, so let USE_C_ALLOCA override this. */
-# undef alloca
 #endif
+
+/* If we don't have an overriding definition, set SUCCESS_EXIT_CODE and
+   FATAL_EXIT_CODE to EXIT_SUCCESS and EXIT_FAILURE respectively,
+   or 0 and 1 if those macros are not defined.  */
+#ifndef SUCCESS_EXIT_CODE
+# ifdef EXIT_SUCCESS
+#  define SUCCESS_EXIT_CODE EXIT_SUCCESS
+# else
+#  define SUCCESS_EXIT_CODE 0
+# endif
+#endif
+
+#ifndef FATAL_EXIT_CODE
+# ifdef EXIT_FAILURE
+#  define FATAL_EXIT_CODE EXIT_FAILURE
+# else
+#  define FATAL_EXIT_CODE 1
+# endif
 #endif
 
 #ifdef HAVE_UNISTD_H
@@ -355,6 +373,14 @@ extern void abort PARAMS ((void));
   ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
 #endif
 
+/* 1 if we have _Bool.  */
+#ifndef HAVE__BOOL
+# define HAVE__BOOL \
+   ((GCC_VERSION >= 3000) || (__STDC_VERSION__ >= 199901L))
+#endif
+
+
+
 /* Define a STRINGIFY macro that's right for ANSI or traditional C.
    Note: if the argument passed to STRINGIFY is itself a macro, eg
    #define foo bar, STRINGIFY(foo) will produce "foo", not "bar".
@@ -521,11 +547,6 @@ extern void abort PARAMS ((void));
 #define UNION_INIT_ZERO
 #endif
 
-/* GCC now gives implicit declaration warnings for undeclared builtins.  */
-#if defined(__GNUC__) && defined (__SIZE_TYPE__)
-extern void *alloca (__SIZE_TYPE__);
-#endif
-
 /* Various error reporting routines want to use __FUNCTION__.  */
 #if (GCC_VERSION < 2007)
 #ifndef __FUNCTION__
@@ -533,4 +554,27 @@ extern void *alloca (__SIZE_TYPE__);
 #endif /* ! __FUNCTION__ */
 #endif
 
+/* Provide some sort of boolean type.  We use stdbool.h if it's
+  available.  This is dead last because various system headers might
+  mess us up.  */
+#undef bool
+#undef true
+#undef false
+#undef TRUE
+#undef FALSE
+
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+# if !HAVE__BOOL
+typedef char _Bool;
+# endif
+# define bool _Bool
+# define true 1
+# define false 0
+#endif
+
+#define TRUE true
+#define FALSE false
+
 #endif /* __GCC_SYSTEM_H__ */