From 2e39bdbe4b92cea918f54624604e241cd1672a52 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Tue, 1 Feb 2000 21:30:52 +0000 Subject: [PATCH] tsystem.h: New file. * tsystem.h: New file. * Makefile.in (libgcc2.a, stmp-multilib, crtbegin.o, crtend.o, s-crtS): Depend on tsystem.h. * crtstuff.c: Include tsystem.h. * frame.c: Likewise. * libgcc2.c: Likewise. From-SVN: r31741 --- gcc/ChangeLog | 11 +++++++ gcc/Makefile.in | 11 ++++--- gcc/crtstuff.c | 18 ++--------- gcc/frame.c | 23 ++----------- gcc/libgcc2.c | 28 +--------------- gcc/tsystem.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 108 insertions(+), 69 deletions(-) create mode 100644 gcc/tsystem.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0152ec687ea..2e1691505db 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2000-02-01 Kaveh R. Ghazi + + * tsystem.h: New file. + + * Makefile.in (libgcc2.a, stmp-multilib, crtbegin.o, crtend.o, + s-crtS): Depend on tsystem.h. + + * crtstuff.c: Include tsystem.h. + * frame.c: Likewise. + * libgcc2.c: Likewise. + Tue Feb 1 19:53:27 CET 2000 Jan Hubicka * builtins.c (expand_builtin_memset): Expand for variable sized diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 328611af2e8..2a61aa84122 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1054,7 +1054,8 @@ libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs $(STMP_FIXPROTO) LIB2ADD = $(srcdir)/frame.c $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS) libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(FPBIT) $(DPBIT) $(LIB2ADD) \ - $(MACHMODE_H) longlong.h frame.h gbl-ctors.h config.status stmp-int-hdrs + $(MACHMODE_H) longlong.h frame.h gbl-ctors.h config.status stmp-int-hdrs \ + tsystem.h # Actually build it in tmplibgcc2.a, then rename at end, # so that libgcc2.a itself remains nonexistent if compilation is aborted. -rm -f tmplibgcc2.a @@ -1186,7 +1187,7 @@ s-mlib: $(srcdir)/genmultilib Makefile # Build multiple copies of libgcc.a, one for each target switch. stmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \ - frame.h \ + frame.h tsystem.h \ $(LIB2ADD) $(MACHMODE_H) longlong.h gbl-ctors.h config.status for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \ dir=`echo $$i | sed -e 's/;.*$$//'`; \ @@ -1272,14 +1273,14 @@ stmp-multilib-sub: # linked using GCC on systems using COFF or ELF, for the sake of C++ # constructors. $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ - defaults.h frame.h gbl-ctors.h stmp-int-hdrs + defaults.h frame.h gbl-ctors.h stmp-int-hdrs tsystem.h $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ -finhibit-size-directive -fno-inline-functions \ -fno-exceptions $(CRTSTUFF_T_CFLAGS) @inhibit_libc@ \ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o $(T)crtbegin$(objext) $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ - defaults.h frame.h gbl-ctors.h stmp-int-hdrs + defaults.h frame.h gbl-ctors.h stmp-int-hdrs tsystem.h $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ -finhibit-size-directive -fno-inline-functions \ -fno-exceptions $(CRTSTUFF_T_CFLAGS) @inhibit_libc@ \ @@ -1290,7 +1291,7 @@ $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ crtbeginS.o crtendS.o: s-crtS ; @true s-crtS: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ - defaults.h frame.h gbl-ctors.h stmp-int-hdrs + defaults.h frame.h gbl-ctors.h stmp-int-hdrs tsystem.h $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \ -DCRT_BEGIN -DCRTSTUFFS_O -finhibit-size-directive \ -fno-inline-functions -fno-exceptions @inhibit_libc@ -g0 \ diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index 98e0779a5e2..c2d4fac605a 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -1,6 +1,6 @@ /* Specialized bits of code needed to support construction and destruction of file-scope objects in C++ code. - Copyright (C) 1991, 1994-1999 Free Software Foundation, Inc. + Copyright (C) 1991, 1994-1999, 2000 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@monkeys.com). This file is part of GNU CC. @@ -52,23 +52,9 @@ Boston, MA 02111-1307, USA. */ do not apply. */ #include "tm.h" - -/* We disable this when inhibit_libc, so that gcc can still be built without - needing header files first. */ -/* ??? This is not a good solution, since prototypes may be required in - some cases for correct code. See also libgcc2.c/frame.c. */ -#ifndef inhibit_libc -/* fixproto guarantees these system headers exist. */ -#include -#include -#else -# ifndef atexit -extern int atexit(void (*)(void)); -# endif -#endif +#include "tsystem.h" #include "defaults.h" -#include #include "frame.h" /* We do not want to add the weak attribute to the declarations of these diff --git a/gcc/frame.c b/gcc/frame.c index 697d3f4f0a9..717849fe3b8 100644 --- a/gcc/frame.c +++ b/gcc/frame.c @@ -1,6 +1,6 @@ /* Subroutines needed for unwinding stack frames for exception handling. */ /* Compile this one with gcc. */ -/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. Contributed by Jason Merrill . This file is part of GNU CC. @@ -32,31 +32,12 @@ Boston, MA 02111-1307, USA. */ do not apply. */ #include "tconfig.h" - -/* We disable this when inhibit_libc, so that gcc can still be built without - needing header files first. */ -/* ??? This is not a good solution, since prototypes may be required in - some cases for correct code. See also libgcc2.c/crtstuff.c. */ -#ifndef inhibit_libc -/* fixproto guarantees these system headers exist. */ -#include -#include - -#else -#include -#ifndef malloc -extern void *malloc (size_t); -#endif -#ifndef free -extern void free (void *); -#endif -#endif +#include "tsystem.h" #include "defaults.h" #ifdef DWARF2_UNWIND_INFO #include "dwarf2.h" -#include #include "frame.h" #include "gthr.h" diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c index de140514707..2775751aca9 100644 --- a/gcc/libgcc2.c +++ b/gcc/libgcc2.c @@ -32,36 +32,10 @@ Boston, MA 02111-1307, USA. */ do not apply. */ #include "tconfig.h" - -/* We disable this when inhibit_libc, so that gcc can still be built without - needing header files first. */ -/* ??? This is not a good solution, since prototypes may be required in - some cases for correct code. See also frame.c/crtstuff.c. */ -#ifndef inhibit_libc -/* fixproto guarantees these system headers exist. */ -#include -#include - -#else -#ifndef L_trampoline -#include -#ifndef malloc -extern void *malloc (size_t); -#endif -#ifndef free -extern void free (void *); -#endif -#ifndef atexit -extern int atexit(void (*)(void)); -#endif -#endif -#endif +#include "tsystem.h" #include "machmode.h" #include "defaults.h" -#ifndef L_trampoline -#include -#endif /* Don't use `fancy_abort' here even if config.h says to use it. */ #ifdef abort diff --git a/gcc/tsystem.h b/gcc/tsystem.h new file mode 100644 index 00000000000..244e5c06c2a --- /dev/null +++ b/gcc/tsystem.h @@ -0,0 +1,86 @@ +/* Get common system includes and various definitions and declarations + based on target macros. + Copyright (C) 2000 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#ifndef __GCC_TSYSTEM_H__ +#define __GCC_TSYSTEM_H__ + +/* GCC supplies this header. */ +#include + +#ifdef inhibit_libc + +#ifndef malloc +extern void *malloc (size_t); +#endif + +#ifndef free +extern void free (void *); +#endif + +#ifndef atexit +extern int atexit (void (*)(void)); +#endif + +#else /* ! inhibit_libc */ +/* We disable this when inhibit_libc, so that gcc can still be built without + needing header files first. */ +/* ??? This is not a good solution, since prototypes may be required in + some cases for correct code. */ + +/* GCC supplies this header. */ +#include + +/* All systems have this header. */ +#include + +/* All systems have this header. */ +#include + +/* All systems have this header. */ +#include + +#ifndef errno +extern int errno; +#endif + +#if defined(POSIX) || defined(USG) +#include +#endif + +/* GCC (fixproto) guarantees these system headers exist. */ +#include +#include + +/* GCC supplies this header. */ +#include + +#if defined(POSIX) || defined(USG) +#include +#endif + +#endif /* inhibit_libc */ + +/* Define a generic NULL if one hasn't already been defined. */ +#ifndef NULL +#define NULL 0 +#endif + +#endif /* __GCC_TSYSTEM_H__ */