diff mbox

system.h and system header include cleanup

Message ID Pine.LNX.4.64.1011270147350.14195@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Nov. 27, 2010, 1:49 a.m. UTC
As I indicated in <http://gcc.gnu.org/ml/gcc/2010-11/msg00587.html>,
rather too many places have accumulated with system headers directly
included in individual source files rather than in system.h.  It is
generally preferred to have host system dependencies and header
includes in system.h, at least if they are used several times in GCC,
rather than spreading conditional code allowing for such dependencies
about the compiler.

This patch cleans up such issues somewhat (for code built for the host
and build systems; though tsystem.h exists for code built for the
target, I didn't do anything about such code).  system.h is made to
include four more headers: <signal.h>, <sys/mman.h>, <sys/resource.h>
and <sys/times.h>.  Associated macros that were defined in multiple
places in the compiler are added, including O_BINARY.  Includes and
definitions directly in individual source files - including those of
system headers (and libiberty.h) already included in system.h, or
system header includes not in fact needed - were removed.  Some system
header includes removed from target files came before config.h,
meaning there could have been large-files issues on those targets
before this patch; config.h must *always* be the first include in any
file that includes, directly or indirectly, any system header.

GET_ENVIRONMENT was a macro in defaults.h that appeared to be intended
to encapsulate some form of system dependency (and so would belong in
system.h), but since there were no non-default definitions of this
macro and plenty of plain uses of getenv, I changed all uses of
GET_ENVIRONMENT to use getenv and poisoned the macro.  One tm.h
include that was commented as present for GET_ENVIRONMENT was removed;
makefile dependencies didn't mention that include so didn't need
updating.

A configure test for mincore was removed since the only use of the
result of that test was to condition includes of <sys/types.h>, which
is already included in system.h.

fortran/gfortran.h had a pile of definitions related to alloca.  If
such were needed, system.h would be the right place for them, but
since the rest of GCC uses alloca without needing such definitions I
just removed them.

java/jcf-depend.c was made to use gcc_assert instead of <assert.h>.

lto/lto-endian.h (which included some system headers) was removed as
unused.

In the course of doing this I noticed et-forest.h makes use of 'extern
"C"'; I see no reason for it to do so (given the general convention we
have that GCC-internal interfaces are C++ interfaces when building as
C++), but didn't change it.

To make it easier to find system header includes I changed some code
to follow the convention that #include <> is used for system headers
but #include "" for GCC headers (including those in libiberty).

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Also
tested building cc1 for crosses to: alpha-linux-gnu arm-eabi frv-elf
i686-mingw32 iq2000-elf m32c-elf m68hc11-elf mep-elf microblaze-elf
mips-elf.  OK to commit?

2010-11-26  Joseph Myers  <joseph@codesourcery.com>

	* system.h: Include "safe-ctype.h" instead of <safe-ctype.h>.
	Include <signal.h>, <sys/mman.h>, <sys/resource.h> and
	<sys/times.h>.
	(O_BINARY, SIGCHLD, MAP_FAILED, MAP_ANONYMOUS, kill):
	Conditionally define.
	(GET_ENVIRONMENT): Poison.
	* configure.ac: Don't test for mincore.
	* configure: Regenerate.
	* config.in: Regenerate.
	* collect2-aix.c: Don't include <sys/mman.h>.
	* collect2.c: Don't include <signal.h>.
	(SIGCHLD): Don't define.
	(prefix_from_env): Use getenv instead of GET_ENVIRONMENT.
	* config/alpha/alpha.c: Include "splay-tree.h" instead of
	<splay-tree.h>.
	* config/arm/arm.c (arm_target_help): Use getenv instead of
	GET_ENVIRONMENT.
	* config/avr/driver-avr.c: Don't include <stdlib.h>.
	* config/frv/frv.c: Don't include <ctype.h>.
	* config/host-darwin.c: Don't include <sys/mman.h>.
	* config/host-hpux.c: Don't include <sys/mman.h> or <unistd.h>.
	(MAP_FAILED): Don't define.
	* config/host-linux.c: Don't include <sys/mman.h> or <limits.h>.
	* config/host-solaris.c: Don't include <sys/mman.h>.
	* config/i386/cygming.h: Don't include <stdio.h>.
	* config/i386/driver-i386.c: Don't include <stdlib.h>.
	* config/i386/host-cygwin.c: Don't include <sys/mman.h>.
	* config/iq2000/iq2000.c: Don't include <signal.h>.
	* config/m32c/m32c-pragma.c: Don't include <stdio.h>.
	* config/m68hc11/m68hc11.c: Don't include <stdio.h>.
	* config/mep/mep-pragma.c: Don't include <stdio.h>.
	* config/microblaze/microblaze.c: Don't include <signal.h>.
	* config/mips/mips.c: Don't include <signal.h>.
	* config/rs6000/host-darwin.c: Don't include <signal.h>.
	* cppdefault.c (cpp_relocated): Use getenv instead of
	GET_ENVIRONMENT.
	* defaults.h (GET_ENVIRONMENT): Don't define.
	* et-forest.h: Don't include <ansidecl.h> or <stddef.h>.
	* gcc.c: Don't include <signal.h>, <sys/mman.h> or <sys/types.h>.
	(SIGCHLD, MAP_FAILED, kill): Don't define.
	(process_command): Use getenv instead of GET_ENVIRONMENT.
	* genhooks.c: Don't include <string.h>.
	* ggc-common.c: Don't include <sys/resource.h>, <sys/mman.h> or
	<sys/types.h>.
	(MAP_FAILED): Don't define.
	* ggc-page.c Don't include <sys/mman.h>.
	(MAP_ANONYMOUS, MAP_FAILED): Don't define.
	* ggc-zone.c: Don't include <sys/mman.h>.
	(MAP_ANONYMOUS, MAP_FAILED): Don't define.
	* graph.c: Include "config.h" instead of <config.h>.
	* incpath.c (add_env_var_paths): Use getenv instead of
	GET_ENVIRONMENT.
	* lto-wrapper.c: Don't include <errno.h>, <signal.h> or
	"libiberty.h".
	(SIGCHLD, kill): Don't define.
	* mips-tfile.c: Don't include <signal.h>.
	* opts.c: Don't include <signal.h> or <sys/resource.h>.
	(print_specific_help): Use getenv instead of GET_ENVIRONMENT.
	* passes.c: Don't include <signal.h>, <sys/resource.h> or
	<sys/times.h>.
	* sparseset.h: Don't include <assert.h>.
	* timevar.c: Don't include <sys/times.h> or <sys/resource.h>.
	* tlink.c: Don't include "libiberty.h".
	* toplev.c: Don't include <signal.h> or <sys/times.h>.
	* tree-mudflap.c: Include "demangle.h" instead of <demangle.h>.
	* tree-switch-conversion.c: Don't include <signal.h>.
	* vmsdbgout.c: Don't include <errno.h> or <string.h>.

c-family:
2010-11-26  Joseph Myers  <joseph@codesourcery.com>

	* c-opts.c (check_deps_environment_vars): Use getenv instead of
	GET_ENVIRONMENT.
	* c-pch.c (O_BINARY): Don't define here.
	* c-pragma.h: Include "cpplib.h" instead of <cpplib.h>.

fortran:
2010-11-26  Joseph Myers  <joseph@codesourcery.com>

	* gfortran.h (alloca): Don't include definitions.
	(NULL): Don't define.

java:
2010-11-26  Joseph Myers  <joseph@codesourcery.com>

	* boehm.c: Include "config.h" instead of <config.h>.
	* builtins.c: Don't include <stdarg.h>.
	* class.c: Don't include "stdio.h".
	(O_BINARY): Don't define here.
	* jcf-depend.c: Don't include <assert.h>.
	(jcf_dependency_set_dep_file, jcf_dependency_init,
	jcf_dependency_write): Use gcc_assert.
	* jcf-io.c (O_BINARY): Don't define here.
	* jcf-path.c: Don't include "tm.h".
	(jcf_path_init): Use getenv instead of GET_ENVIRONMENT.
	* resource.c: Don't include "stdio.h".
	(O_BINARY): Don't define here.
	* verify-impl.c: Don't include <stdio.h>.

lto:
2010-11-26  Joseph Myers  <joseph@codesourcery.com>

	* lto-endian.h: Delete.
	* lto-object.c: Don't include "libiberty.h".
	(O_BINARY): Don't define.
	* lto.c: Don't include "libiberty.h" or <sys/mman.h>.
	(O_BINARY): Don't define.

Comments

Steve Kargl Nov. 27, 2010, 2:42 a.m. UTC | #1
On Sat, Nov 27, 2010 at 01:49:33AM +0000, Joseph S. Myers wrote:
> 
> fortran:
> 2010-11-26  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* gfortran.h (alloca): Don't include definitions.
> 	(NULL): Don't define.
> 

This is OK.
Ralf Wildenhues Nov. 27, 2010, 8:25 a.m. UTC | #2
* Joseph S. Myers wrote on Sat, Nov 27, 2010 at 02:49:33AM CET:
> 2010-11-26  Joseph Myers  <joseph@codesourcery.com>

> 	* configure.ac: Don't test for mincore.
> 	* configure: Regenerate.
> 	* config.in: Regenerate.

OK for the build parts (even obvious I'd think).

Thanks,
Ralf
N.M. Maclaren Nov. 27, 2010, 10:16 a.m. UTC | #3
On Nov 27 2010, Joseph S. Myers wrote:
>
>GET_ENVIRONMENT was a macro ...
>... and plenty of plain uses of getenv,

I think that I recall the history of that (and it's wider than gcc),
but the world has moved in the direction you have changed the code.
What was a good idea then is merely confusing now.

>fortran/gfortran.h had a pile of definitions related to alloca.  If
>such were needed, system.h would be the right place for them, but
>since the rest of GCC uses alloca without needing such definitions I
>just removed them.

Do you know if any of those rely on function-scope lifetime rather than
block-scope lifetime and are in code that is needed for bootstrapping?
I am still trying to find out where the world is going in this respect,
and it is most unclear.


Regards,
Nick Maclaren.
Richard Biener Nov. 27, 2010, 11:32 a.m. UTC | #4
On Sat, Nov 27, 2010 at 2:49 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> As I indicated in <http://gcc.gnu.org/ml/gcc/2010-11/msg00587.html>,
> rather too many places have accumulated with system headers directly
> included in individual source files rather than in system.h.  It is
> generally preferred to have host system dependencies and header
> includes in system.h, at least if they are used several times in GCC,
> rather than spreading conditional code allowing for such dependencies
> about the compiler.
>
> This patch cleans up such issues somewhat (for code built for the host
> and build systems; though tsystem.h exists for code built for the
> target, I didn't do anything about such code).  system.h is made to
> include four more headers: <signal.h>, <sys/mman.h>, <sys/resource.h>
> and <sys/times.h>.  Associated macros that were defined in multiple
> places in the compiler are added, including O_BINARY.  Includes and
> definitions directly in individual source files - including those of
> system headers (and libiberty.h) already included in system.h, or
> system header includes not in fact needed - were removed.  Some system
> header includes removed from target files came before config.h,
> meaning there could have been large-files issues on those targets
> before this patch; config.h must *always* be the first include in any
> file that includes, directly or indirectly, any system header.
>
> GET_ENVIRONMENT was a macro in defaults.h that appeared to be intended
> to encapsulate some form of system dependency (and so would belong in
> system.h), but since there were no non-default definitions of this
> macro and plenty of plain uses of getenv, I changed all uses of
> GET_ENVIRONMENT to use getenv and poisoned the macro.  One tm.h
> include that was commented as present for GET_ENVIRONMENT was removed;
> makefile dependencies didn't mention that include so didn't need
> updating.
>
> A configure test for mincore was removed since the only use of the
> result of that test was to condition includes of <sys/types.h>, which
> is already included in system.h.
>
> fortran/gfortran.h had a pile of definitions related to alloca.  If
> such were needed, system.h would be the right place for them, but
> since the rest of GCC uses alloca without needing such definitions I
> just removed them.
>
> java/jcf-depend.c was made to use gcc_assert instead of <assert.h>.
>
> lto/lto-endian.h (which included some system headers) was removed as
> unused.
>
> In the course of doing this I noticed et-forest.h makes use of 'extern
> "C"'; I see no reason for it to do so (given the general convention we
> have that GCC-internal interfaces are C++ interfaces when building as
> C++), but didn't change it.
>
> To make it easier to find system header includes I changed some code
> to follow the convention that #include <> is used for system headers
> but #include "" for GCC headers (including those in libiberty).
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Also
> tested building cc1 for crosses to: alpha-linux-gnu arm-eabi frv-elf
> i686-mingw32 iq2000-elf m32c-elf m68hc11-elf mep-elf microblaze-elf
> mips-elf.  OK to commit?

The non-frontend and LTO frontend changes are ok.

Thanks,
Richard.

> 2010-11-26  Joseph Myers  <joseph@codesourcery.com>
>
>        * system.h: Include "safe-ctype.h" instead of <safe-ctype.h>.
>        Include <signal.h>, <sys/mman.h>, <sys/resource.h> and
>        <sys/times.h>.
>        (O_BINARY, SIGCHLD, MAP_FAILED, MAP_ANONYMOUS, kill):
>        Conditionally define.
>        (GET_ENVIRONMENT): Poison.
>        * configure.ac: Don't test for mincore.
>        * configure: Regenerate.
>        * config.in: Regenerate.
>        * collect2-aix.c: Don't include <sys/mman.h>.
>        * collect2.c: Don't include <signal.h>.
>        (SIGCHLD): Don't define.
>        (prefix_from_env): Use getenv instead of GET_ENVIRONMENT.
>        * config/alpha/alpha.c: Include "splay-tree.h" instead of
>        <splay-tree.h>.
>        * config/arm/arm.c (arm_target_help): Use getenv instead of
>        GET_ENVIRONMENT.
>        * config/avr/driver-avr.c: Don't include <stdlib.h>.
>        * config/frv/frv.c: Don't include <ctype.h>.
>        * config/host-darwin.c: Don't include <sys/mman.h>.
>        * config/host-hpux.c: Don't include <sys/mman.h> or <unistd.h>.
>        (MAP_FAILED): Don't define.
>        * config/host-linux.c: Don't include <sys/mman.h> or <limits.h>.
>        * config/host-solaris.c: Don't include <sys/mman.h>.
>        * config/i386/cygming.h: Don't include <stdio.h>.
>        * config/i386/driver-i386.c: Don't include <stdlib.h>.
>        * config/i386/host-cygwin.c: Don't include <sys/mman.h>.
>        * config/iq2000/iq2000.c: Don't include <signal.h>.
>        * config/m32c/m32c-pragma.c: Don't include <stdio.h>.
>        * config/m68hc11/m68hc11.c: Don't include <stdio.h>.
>        * config/mep/mep-pragma.c: Don't include <stdio.h>.
>        * config/microblaze/microblaze.c: Don't include <signal.h>.
>        * config/mips/mips.c: Don't include <signal.h>.
>        * config/rs6000/host-darwin.c: Don't include <signal.h>.
>        * cppdefault.c (cpp_relocated): Use getenv instead of
>        GET_ENVIRONMENT.
>        * defaults.h (GET_ENVIRONMENT): Don't define.
>        * et-forest.h: Don't include <ansidecl.h> or <stddef.h>.
>        * gcc.c: Don't include <signal.h>, <sys/mman.h> or <sys/types.h>.
>        (SIGCHLD, MAP_FAILED, kill): Don't define.
>        (process_command): Use getenv instead of GET_ENVIRONMENT.
>        * genhooks.c: Don't include <string.h>.
>        * ggc-common.c: Don't include <sys/resource.h>, <sys/mman.h> or
>        <sys/types.h>.
>        (MAP_FAILED): Don't define.
>        * ggc-page.c Don't include <sys/mman.h>.
>        (MAP_ANONYMOUS, MAP_FAILED): Don't define.
>        * ggc-zone.c: Don't include <sys/mman.h>.
>        (MAP_ANONYMOUS, MAP_FAILED): Don't define.
>        * graph.c: Include "config.h" instead of <config.h>.
>        * incpath.c (add_env_var_paths): Use getenv instead of
>        GET_ENVIRONMENT.
>        * lto-wrapper.c: Don't include <errno.h>, <signal.h> or
>        "libiberty.h".
>        (SIGCHLD, kill): Don't define.
>        * mips-tfile.c: Don't include <signal.h>.
>        * opts.c: Don't include <signal.h> or <sys/resource.h>.
>        (print_specific_help): Use getenv instead of GET_ENVIRONMENT.
>        * passes.c: Don't include <signal.h>, <sys/resource.h> or
>        <sys/times.h>.
>        * sparseset.h: Don't include <assert.h>.
>        * timevar.c: Don't include <sys/times.h> or <sys/resource.h>.
>        * tlink.c: Don't include "libiberty.h".
>        * toplev.c: Don't include <signal.h> or <sys/times.h>.
>        * tree-mudflap.c: Include "demangle.h" instead of <demangle.h>.
>        * tree-switch-conversion.c: Don't include <signal.h>.
>        * vmsdbgout.c: Don't include <errno.h> or <string.h>.
>
> c-family:
> 2010-11-26  Joseph Myers  <joseph@codesourcery.com>
>
>        * c-opts.c (check_deps_environment_vars): Use getenv instead of
>        GET_ENVIRONMENT.
>        * c-pch.c (O_BINARY): Don't define here.
>        * c-pragma.h: Include "cpplib.h" instead of <cpplib.h>.
>
> fortran:
> 2010-11-26  Joseph Myers  <joseph@codesourcery.com>
>
>        * gfortran.h (alloca): Don't include definitions.
>        (NULL): Don't define.
>
> java:
> 2010-11-26  Joseph Myers  <joseph@codesourcery.com>
>
>        * boehm.c: Include "config.h" instead of <config.h>.
>        * builtins.c: Don't include <stdarg.h>.
>        * class.c: Don't include "stdio.h".
>        (O_BINARY): Don't define here.
>        * jcf-depend.c: Don't include <assert.h>.
>        (jcf_dependency_set_dep_file, jcf_dependency_init,
>        jcf_dependency_write): Use gcc_assert.
>        * jcf-io.c (O_BINARY): Don't define here.
>        * jcf-path.c: Don't include "tm.h".
>        (jcf_path_init): Use getenv instead of GET_ENVIRONMENT.
>        * resource.c: Don't include "stdio.h".
>        (O_BINARY): Don't define here.
>        * verify-impl.c: Don't include <stdio.h>.
>
> lto:
> 2010-11-26  Joseph Myers  <joseph@codesourcery.com>
>
>        * lto-endian.h: Delete.
>        * lto-object.c: Don't include "libiberty.h".
>        (O_BINARY): Don't define.
>        * lto.c: Don't include "libiberty.h" or <sys/mman.h>.
>        (O_BINARY): Don't define.
>
> Index: gcc/c-family/c-opts.c
> ===================================================================
> --- gcc/c-family/c-opts.c       (revision 167145)
> +++ gcc/c-family/c-opts.c       (working copy)
> @@ -1131,12 +1131,12 @@ check_deps_environment_vars (void)
>  {
>   char *spec;
>
> -  GET_ENVIRONMENT (spec, "DEPENDENCIES_OUTPUT");
> +  spec = getenv ("DEPENDENCIES_OUTPUT");
>   if (spec)
>     cpp_opts->deps.style = DEPS_USER;
>   else
>     {
> -      GET_ENVIRONMENT (spec, "SUNPRO_DEPENDENCIES");
> +      spec = getenv ("SUNPRO_DEPENDENCIES");
>       if (spec)
>        {
>          cpp_opts->deps.style = DEPS_SYSTEM;
> Index: gcc/c-family/c-pch.c
> ===================================================================
> --- gcc/c-family/c-pch.c        (revision 167145)
> +++ gcc/c-family/c-pch.c        (working copy)
> @@ -472,10 +472,6 @@ c_common_no_more_pch (void)
>
>  /* Handle #pragma GCC pch_preprocess, to load in the PCH file.  */
>
> -#ifndef O_BINARY
> -# define O_BINARY 0
> -#endif
> -
>  void
>  c_common_pch_pragma (cpp_reader *pfile, const char *name)
>  {
> Index: gcc/c-family/c-pragma.h
> ===================================================================
> --- gcc/c-family/c-pragma.h     (revision 167145)
> +++ gcc/c-family/c-pragma.h     (working copy)
> @@ -21,7 +21,7 @@ along with GCC; see the file COPYING3.
>  #ifndef GCC_C_PRAGMA_H
>  #define GCC_C_PRAGMA_H
>
> -#include <cpplib.h> /* For enum cpp_ttype.  */
> +#include "cpplib.h" /* For enum cpp_ttype.  */
>
>  /* Pragma identifiers built in to the front end parsers.  Identifiers
>    for ancillary handlers will follow these.  */
> Index: gcc/java/verify-impl.c
> ===================================================================
> --- gcc/java/verify-impl.c      (revision 167145)
> +++ gcc/java/verify-impl.c      (working copy)
> @@ -1,4 +1,4 @@
> -/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009
> +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010
>    Free Software Foundation
>
>    This file is part of libgcj.
> @@ -19,10 +19,6 @@ details.  */
>  /* Hack to work around namespace pollution from java-tree.h.  */
>  #undef current_class
>
> -#ifdef VERIFY_DEBUG
> -#include <stdio.h>
> -#endif /* VERIFY_DEBUG */
> -
>  /* This is used to mark states which are not scheduled for
>    verification. */
>  #define INVALID_STATE ((state *) -1)
> Index: gcc/java/class.c
> ===================================================================
> --- gcc/java/class.c    (revision 167145)
> +++ gcc/java/class.c    (working copy)
> @@ -38,18 +38,12 @@ The Free Software Foundation is independ
>  #include "parse.h"
>  #include "function.h"
>  #include "ggc.h"
> -#include "stdio.h"
>  #include "cgraph.h"
>  #include "tree-iterator.h"
>  #include "vecprim.h"
>  #include "tm.h"         /* FIXME: For gcc_obstack_init from defaults.h.  */
>  #include "target.h"
>
> -/* DOS brain-damage */
> -#ifndef O_BINARY
> -#define O_BINARY 0 /* MS-DOS brain-damage */
> -#endif
> -
>  static tree make_method_value (tree);
>  static tree build_java_method_type (tree, tree, int);
>  static int32 hashUtf8String (const char *, int);
> Index: gcc/java/resource.c
> ===================================================================
> --- gcc/java/resource.c (revision 167145)
> +++ gcc/java/resource.c (working copy)
> @@ -1,6 +1,6 @@
>  /* Functions related to building resource files.
>    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
> -   2007, 2008 Free Software Foundation, Inc.
> +   2007, 2008, 2009, 2010 Free Software Foundation, Inc.
>
>  This file is part of GCC.
>
> @@ -34,15 +34,9 @@ The Free Software Foundation is independ
>  #include "parse.h"
>  #include "function.h"
>  #include "ggc.h"
> -#include "stdio.h"
>  #include "tree-iterator.h"
>  #include "cgraph.h"
>
> -/* DOS brain-damage */
> -#ifndef O_BINARY
> -#define O_BINARY 0 /* MS-DOS brain-damage */
> -#endif
> -
>  /* A list of all the resources files.  */
>  static GTY(()) VEC(tree,gc) *resources;
>
> Index: gcc/java/builtins.c
> ===================================================================
> --- gcc/java/builtins.c (revision 167145)
> +++ gcc/java/builtins.c (working copy)
> @@ -36,7 +36,6 @@ The Free Software Foundation is independ
>  #include "flags.h"
>  #include "langhooks.h"
>  #include "java-tree.h"
> -#include <stdarg.h>
>
>  /* FIXME: All these headers are necessary for sync_compare_and_swap.
>    Front ends should never have to look at that.  */
> Index: gcc/java/jcf-path.c
> ===================================================================
> --- gcc/java/jcf-path.c (revision 167145)
> +++ gcc/java/jcf-path.c (working copy)
> @@ -1,6 +1,6 @@
>  /* Handle CLASSPATH, -classpath, and path searching.
>    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006,
> -   2007, 2008 Free Software Foundation, Inc.
> +   2007, 2008, 2010 Free Software Foundation, Inc.
>
>  This file is part of GCC.
>
> @@ -27,7 +27,6 @@ The Free Software Foundation is independ
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include "tm.h"                /* FIXME: For GET_ENVIRONMENT from defaults.h.  */
>
>  #include <dirent.h>
>
> @@ -224,7 +223,7 @@ jcf_path_init (void)
>   sep[0] = DIR_SEPARATOR;
>   sep[1] = '\0';
>
> -  GET_ENVIRONMENT (cp, "GCC_EXEC_PREFIX");
> +  cp = getenv ("GCC_EXEC_PREFIX");
>   if (cp)
>     {
>       attempt = (char *) alloca (strlen (cp) + 50);
> @@ -295,7 +294,7 @@ jcf_path_init (void)
>        jcf_path_extdirs_arg (extdirs);
>     }
>
> -  GET_ENVIRONMENT (cp, "CLASSPATH");
> +  cp = getenv ("CLASSPATH");
>   add_path (&classpath_env, cp, 0);
>  }
>
> Index: gcc/java/jcf-depend.c
> ===================================================================
> --- gcc/java/jcf-depend.c       (revision 167145)
> +++ gcc/java/jcf-depend.c       (working copy)
> @@ -1,6 +1,6 @@
>  /* Functions for handling dependency tracking when reading .class files.
>
> -   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2006, 2007
> +   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2006, 2007, 2010
>    Free Software Foundation, Inc.
>
>  This file is part of GCC.
> @@ -30,8 +30,6 @@ The Free Software Foundation is independ
>  #include "coretypes.h"
>  #include "mkdeps.h"
>
> -#include <assert.h>
> -
>  #include "jcf.h"
>
>
> @@ -89,7 +87,7 @@ jcf_dependency_add_target (const char *n
>  void
>  jcf_dependency_set_dep_file (const char *name)
>  {
> -  assert (dep_out != stdout);
> +  gcc_assert (dep_out != stdout);
>   if (dep_out)
>     fclose (dep_out);
>   if (! strcmp (name, "-"))
> @@ -117,7 +115,7 @@ jcf_dependency_add_file (const char *fil
>  void
>  jcf_dependency_init (int system_p)
>  {
> -  assert (! dependencies);
> +  gcc_assert (! dependencies);
>   system_files = system_p;
>   dependencies = deps_init ();
>  }
> @@ -134,7 +132,7 @@ jcf_dependency_write (void)
>   if (! dep_out)
>     return;
>
> -  assert (dependencies);
> +  gcc_assert (dependencies);
>
>   deps_write (dependencies, dep_out, 72);
>   if (print_dummies)
> Index: gcc/java/jcf-io.c
> ===================================================================
> --- gcc/java/jcf-io.c   (revision 167145)
> +++ gcc/java/jcf-io.c   (working copy)
> @@ -1,6 +1,6 @@
>  /* Utility routines for finding and reading Java(TM) .class files.
>    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005,
> -   2006, 2007, 2008, 2009 Free Software Foundation, Inc.
> +   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
>
>  This file is part of GCC.
>
> @@ -36,11 +36,6 @@ The Free Software Foundation is independ
>
>  #include "zlib.h"
>
> -/* DOS brain-damage */
> -#ifndef O_BINARY
> -#define O_BINARY 0 /* MS-DOS brain-damage */
> -#endif
> -
>  int
>  jcf_unexpected_eof (JCF *jcf, int count ATTRIBUTE_UNUSED)
>  {
> Index: gcc/java/boehm.c
> ===================================================================
> --- gcc/java/boehm.c    (revision 167145)
> +++ gcc/java/boehm.c    (working copy)
> @@ -1,5 +1,6 @@
>  /* Functions related to the Boehm garbage collector.
> -   Copyright (C) 2000, 2003, 2004, 2006, 2009 Free Software Foundation, Inc.
> +   Copyright (C) 2000, 2003, 2004, 2006, 2009, 2010
> +   Free Software Foundation, Inc.
>
>  This file is part of GCC.
>
> @@ -23,8 +24,7 @@ The Free Software Foundation is independ
>
>  /* Written by Tom Tromey <tromey@cygnus.com>.  */
>
> -#include <config.h>
> -
> +#include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
>  #include "double-int.h"
> Index: gcc/defaults.h
> ===================================================================
> --- gcc/defaults.h      (revision 167145)
> +++ gcc/defaults.h      (working copy)
> @@ -28,10 +28,6 @@ see the files COPYING3 and COPYING.RUNTI
>  #ifndef GCC_DEFAULTS_H
>  #define GCC_DEFAULTS_H
>
> -#ifndef GET_ENVIRONMENT
> -#define GET_ENVIRONMENT(VALUE, NAME) do { (VALUE) = getenv (NAME); } while (0)
> -#endif
> -
>  /* Store in OUTPUT a string (made with alloca) containing an
>    assembler-name for a local static variable or function named NAME.
>    LABELNO is an integer which is different for each call.  */
> Index: gcc/incpath.c
> ===================================================================
> --- gcc/incpath.c       (revision 167145)
> +++ gcc/incpath.c       (working copy)
> @@ -100,7 +100,7 @@ add_env_var_paths (const char *env_var,
>  {
>   char *p, *q, *path;
>
> -  GET_ENVIRONMENT (q, env_var);
> +  q = getenv (env_var);
>
>   if (!q)
>     return;
> Index: gcc/configure
> ===================================================================
> --- gcc/configure       (revision 167145)
> +++ gcc/configure       (working copy)
> @@ -8610,7 +8610,7 @@ fi
>
>  for ac_func in times clock kill getrlimit setrlimit atoll atoq \
>        sysconf strsignal getrusage nl_langinfo \
> -       gettimeofday mbstowcs wcswidth mmap mincore setlocale \
> +       gettimeofday mbstowcs wcswidth mmap setlocale \
>        clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked
>  do :
>   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
> Index: gcc/mips-tfile.c
> ===================================================================
> --- gcc/mips-tfile.c    (revision 167145)
> +++ gcc/mips-tfile.c    (working copy)
> @@ -665,8 +665,6 @@ main (void)
>
>  #undef index
>
> -#include <signal.h>
> -
>  #ifndef CROSS_DIRECTORY_STRUCTURE
>  #include <a.out.h>
>  #else
> Index: gcc/gcc.c
> ===================================================================
> --- gcc/gcc.c   (revision 167145)
> +++ gcc/gcc.c   (working copy)
> @@ -35,10 +35,6 @@ compilation is specified by a string cal
>  #include "coretypes.h"
>  #include "multilib.h" /* before tm.h */
>  #include "tm.h"
> -#include <signal.h>
> -#if ! defined( SIGCHLD ) && defined( SIGCLD )
> -#  define SIGCHLD SIGCLD
> -#endif
>  #include "xregex.h"
>  #include "obstack.h"
>  #include "intl.h"
> @@ -49,18 +45,6 @@ compilation is specified by a string cal
>  #include "opts.h"
>  #include "vec.h"
>
> -#ifdef HAVE_MMAP_FILE
> -# include <sys/mman.h>
> -# ifdef HAVE_MINCORE
> -/* This is on Solaris.  */
> -#  include <sys/types.h>
> -# endif
> -#endif
> -
> -#ifndef MAP_FAILED
> -# define MAP_FAILED ((void *)-1)
> -#endif
> -
>  /* By default there is no special suffix for target executables.  */
>  /* FIXME: when autoconf is fixed, remove the host check - dj */
>  #if defined(TARGET_EXECUTABLE_SUFFIX) && defined(HOST_EXECUTABLE_SUFFIX)
> @@ -88,10 +72,6 @@ static const char dir_separator_str[] =
>  #define LIBRARY_PATH_ENV "LIBRARY_PATH"
>  #endif
>
> -#ifndef HAVE_KILL
> -#define kill(p,s) raise(s)
> -#endif
> -
>  /* If a stage of compilation returns an exit status >= 1,
>    compilation of that file ceases.  */
>
> @@ -3506,7 +3486,7 @@ process_command (unsigned int decoded_op
>   struct cl_option_handlers handlers;
>   unsigned int j;
>
> -  GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
> +  gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX");
>
>   n_switches = 0;
>   n_infiles = 0;
> @@ -3611,7 +3591,7 @@ process_command (unsigned int decoded_op
>   /* COMPILER_PATH and LIBRARY_PATH have values
>      that are lists of directory names with colons.  */
>
> -  GET_ENVIRONMENT (temp, "COMPILER_PATH");
> +  temp = getenv ("COMPILER_PATH");
>   if (temp)
>     {
>       const char *startp, *endp;
> @@ -3645,7 +3625,7 @@ process_command (unsigned int decoded_op
>        }
>     }
>
> -  GET_ENVIRONMENT (temp, LIBRARY_PATH_ENV);
> +  temp = getenv (LIBRARY_PATH_ENV);
>   if (temp && *cross_compile == '0')
>     {
>       const char *startp, *endp;
> @@ -3678,7 +3658,7 @@ process_command (unsigned int decoded_op
>     }
>
>   /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
> -  GET_ENVIRONMENT (temp, "LPATH");
> +  temp = getenv ("LPATH");
>   if (temp && *cross_compile == '0')
>     {
>       const char *startp, *endp;
> Index: gcc/toplev.c
> ===================================================================
> --- gcc/toplev.c        (revision 167145)
> +++ gcc/toplev.c        (working copy)
> @@ -28,12 +28,6 @@ along with GCC; see the file COPYING3.
>  #include "system.h"
>  #include "coretypes.h"
>  #include "tm.h"
> -#include <signal.h>
> -
> -#ifdef HAVE_SYS_TIMES_H
> -# include <sys/times.h>
> -#endif
> -
>  #include "line-map.h"
>  #include "input.h"
>  #include "tree.h"
> Index: gcc/vmsdbgout.c
> ===================================================================
> --- gcc/vmsdbgout.c     (revision 167145)
> +++ gcc/vmsdbgout.c     (working copy)
> @@ -1625,9 +1625,7 @@ vmsdbgout_finish (const char *main_input
>  #include <vms/stsdef.h>
>  #include <vms/iodef.h>
>  #include <vms/fatdef.h>
> -#include <errno.h>
>  #include <vms/descrip.h>
> -#include <string.h>
>  #include <unixlib.h>
>
>  #define MAXPATH 256
> Index: gcc/graph.c
> ===================================================================
> --- gcc/graph.c (revision 167145)
> +++ gcc/graph.c (working copy)
> @@ -19,7 +19,7 @@ You should have received a copy of the G
>  along with GCC; see the file COPYING3.  If not see
>  <http://www.gnu.org/licenses/>.  */
>
> -#include <config.h>
> +#include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
>  #include "tm.h"
> Index: gcc/lto-wrapper.c
> ===================================================================
> --- gcc/lto-wrapper.c   (revision 167145)
> +++ gcc/lto-wrapper.c   (working copy)
> @@ -40,19 +40,9 @@ along with GCC; see the file COPYING3.
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include <errno.h>
> -#include <signal.h>
> -#if ! defined( SIGCHLD ) && defined( SIGCLD )
> -#  define SIGCHLD SIGCLD
> -#endif
>  #include "intl.h"
> -#include "libiberty.h"
>  #include "obstack.h"
>
> -#ifndef HAVE_KILL
> -#define kill(p,s) raise(s)
> -#endif
> -
>  int debug;                             /* true if -save-temps.  */
>  int verbose;                           /* true if -v.  */
>
> Index: gcc/config.in
> ===================================================================
> --- gcc/config.in       (revision 167145)
> +++ gcc/config.in       (working copy)
> @@ -1251,12 +1251,6 @@
>  #endif
>
>
> -/* Define to 1 if you have the `mincore' function. */
> -#ifndef USED_FOR_TARGET
> -#undef HAVE_MINCORE
> -#endif
> -
> -
>  /* Define to 1 if you have the `mmap' function. */
>  #ifndef USED_FOR_TARGET
>  #undef HAVE_MMAP
> Index: gcc/opts.c
> ===================================================================
> --- gcc/opts.c  (revision 167145)
> +++ gcc/opts.c  (working copy)
> @@ -21,13 +21,6 @@ along with GCC; see the file COPYING3.
>
>  #include "config.h"
>  #include "system.h"
> -
> -#include <signal.h>
> -
> -#ifdef HAVE_SYS_RESOURCE_H
> -# include <sys/resource.h>
> -#endif
> -
>  #include "intl.h"
>  #include "coretypes.h"
>  #include "tm.h" /* Needed by rtl.h and used for DWARF2_DEBUGGING_INFO
> @@ -1067,7 +1060,7 @@ print_specific_help (unsigned int includ
>     {
>       const char *p;
>
> -      GET_ENVIRONMENT (p, "COLUMNS");
> +      p = getenv ("COLUMNS");
>       if (p != NULL)
>        {
>          int value = atoi (p);
> Index: gcc/timevar.c
> ===================================================================
> --- gcc/timevar.c       (revision 167145)
> +++ gcc/timevar.c       (working copy)
> @@ -1,5 +1,6 @@
>  /* Timing variables for measuring compiler performance.
> -   Copyright (C) 2000, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
> +   Copyright (C) 2000, 2003, 2004, 2005, 2007, 2010
> +   Free Software Foundation, Inc.
>    Contributed by Alex Samuel <samuel@codesourcery.com>
>
>  This file is part of GCC.
> @@ -20,12 +21,6 @@ along with GCC; see the file COPYING3.
>
>  #include "config.h"
>  #include "system.h"
> -#ifdef HAVE_SYS_TIMES_H
> -# include <sys/times.h>
> -#endif
> -#ifdef HAVE_SYS_RESOURCE_H
> -#include <sys/resource.h>
> -#endif
>  #include "timevar.h"
>
>  #ifndef HAVE_CLOCK_T
> Index: gcc/fortran/gfortran.h
> ===================================================================
> --- gcc/fortran/gfortran.h      (revision 167145)
> +++ gcc/fortran/gfortran.h      (working copy)
> @@ -38,24 +38,6 @@ along with GCC; see the file COPYING3.
>  #include "coretypes.h"
>  #include "input.h"
>  #include "splay-tree.h"
> -/* The following ifdefs are recommended by the autoconf documentation
> -   for any code using alloca.  */
> -
> -/* AIX requires this to be the first thing in the file.  */
> -#ifdef __GNUC__
> -#else /* not __GNUC__ */
> -#ifdef HAVE_ALLOCA_H
> -#include <alloca.h>
> -#else /* do not HAVE_ALLOCA_H */
> -#ifdef _AIX
> -#pragma alloca
> -#else
> -#ifndef alloca                 /* predefined by HP cc +Olibcalls */
> -char *alloca ();
> -#endif /* not predefined */
> -#endif /* not _AIX */
> -#endif /* do not HAVE_ALLOCA_H */
> -#endif /* not __GNUC__ */
>
>  /* Major control parameters.  */
>
> @@ -70,10 +52,6 @@ char *alloca ();
>  #define free(x) Use_gfc_free_instead_of_free()
>  #define gfc_is_whitespace(c) ((c==' ') || (c=='\t'))
>
> -#ifndef NULL
> -#define NULL ((void *) 0)
> -#endif
> -
>  /* Stringization.  */
>  #define stringize(x) expand_macro(x)
>  #define expand_macro(x) # x
> Index: gcc/et-forest.h
> ===================================================================
> --- gcc/et-forest.h     (revision 167145)
> +++ gcc/et-forest.h     (working copy)
> @@ -1,5 +1,6 @@
>  /* Et-forest data structure implementation.
> -   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
> +   Copyright (C) 2002, 2003, 2004, 2005, 2007, 2010
> +   Free Software Foundation, Inc.
>
>    This program is free software; you can redistribute it and/or modify
>    it under the terms of the GNU General Public License as published by
> @@ -48,9 +49,6 @@
>  #ifndef _ET_TREE_H
>  #define _ET_TREE_H
>
> -#include <ansidecl.h>
> -#include <stddef.h>
> -
>  #ifdef __cplusplus
>  extern "C" {
>  #endif /* __cplusplus */
> Index: gcc/configure.ac
> ===================================================================
> --- gcc/configure.ac    (revision 167145)
> +++ gcc/configure.ac    (working copy)
> @@ -974,7 +974,7 @@ define(gcc_UNLOCKED_FUNCS, clearerr_unlo
>   putchar_unlocked putc_unlocked)
>  AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \
>        sysconf strsignal getrusage nl_langinfo \
> -       gettimeofday mbstowcs wcswidth mmap mincore setlocale \
> +       gettimeofday mbstowcs wcswidth mmap setlocale \
>        gcc_UNLOCKED_FUNCS)
>
>  if test x$ac_cv_func_mbstowcs = xyes; then
> Index: gcc/cppdefault.c
> ===================================================================
> --- gcc/cppdefault.c    (revision 167145)
> +++ gcc/cppdefault.c    (working copy)
> @@ -1,6 +1,6 @@
>  /* CPP Library.
>    Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
> -   1999, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
> +   1999, 2000, 2003, 2004, 2006, 2007, 2010 Free Software Foundation, Inc.
>    Contributed by Per Bothner, 1994-95.
>    Based on CCCP program by Paul Rubin, June 1986
>    Adapted to ANSI C, Richard Stallman, Jan 1987
> @@ -127,7 +127,7 @@ cpp_relocated (void)
>   if (relocated == -1)
>     {
>       /* Check if the toolchain was relocated?  */
> -      GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
> +      gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX");
>       if (gcc_exec_prefix)
>        relocated = 1;
>       else
> Index: gcc/sparseset.h
> ===================================================================
> --- gcc/sparseset.h     (revision 167145)
> +++ gcc/sparseset.h     (working copy)
> @@ -1,5 +1,5 @@
>  /* SparseSet implementation.
> -   Copyright (C) 2007 Free Software Foundation, Inc.
> +   Copyright (C) 2007, 2010 Free Software Foundation, Inc.
>    Contributed by Peter Bergner <bergner@vnet.ibm.com>
>
>  This file is part of GCC.
> @@ -21,8 +21,6 @@ along with GCC; see the file COPYING3.
>  #ifndef GCC_SPARSESET_H
>  #define GCC_SPARSESET_H
>
> -#include <assert.h>
> -
>  #define SPARSESET_ELT_BITS ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT)
>  #define SPARSESET_ELT_TYPE unsigned int
>
> Index: gcc/genhooks.c
> ===================================================================
> --- gcc/genhooks.c      (revision 167145)
> +++ gcc/genhooks.c      (working copy)
> @@ -19,7 +19,6 @@ along with GCC; see the file COPYING3.
>  <http://www.gnu.org/licenses/>.  */
>  #include "bconfig.h"
>  #include "system.h"
> -#include <string.h>
>  #include "hashtab.h"
>  #include "errors.h"
>
> Index: gcc/ggc-common.c
> ===================================================================
> --- gcc/ggc-common.c    (revision 167145)
> +++ gcc/ggc-common.c    (working copy)
> @@ -36,22 +36,6 @@ along with GCC; see the file COPYING3.
>  #include "vec.h"
>  #include "timevar.h"
>
> -#ifdef HAVE_SYS_RESOURCE_H
> -# include <sys/resource.h>
> -#endif
> -
> -#ifdef HAVE_MMAP_FILE
> -# include <sys/mman.h>
> -# ifdef HAVE_MINCORE
> -/* This is on Solaris.  */
> -#  include <sys/types.h>
> -# endif
> -#endif
> -
> -#ifndef MAP_FAILED
> -# define MAP_FAILED ((void *)-1)
> -#endif
> -
>  /* When set, ggc_collect will do collection.  */
>  bool ggc_force_collect;
>
> Index: gcc/lto/lto.c
> ===================================================================
> --- gcc/lto/lto.c       (revision 167145)
> +++ gcc/lto/lto.c       (working copy)
> @@ -26,7 +26,6 @@ along with GCC; see the file COPYING3.
>  #include "tree.h"
>  #include "diagnostic-core.h"
>  #include "tm.h"
> -#include "libiberty.h"
>  #include "cgraph.h"
>  #include "ggc.h"
>  #include "tree-ssa-operands.h"
> @@ -46,20 +45,6 @@ along with GCC; see the file COPYING3.
>  #include "splay-tree.h"
>  #include "params.h"
>
> -/* This needs to be included after config.h.  Otherwise, _GNU_SOURCE will not
> -   be defined in time to set __USE_GNU in the system headers, and strsignal
> -   will not be declared.  */
> -#if HAVE_MMAP_FILE
> -#include <sys/mman.h>
> -#endif
> -
> -/* Handle opening elf files on hosts, such as Windows, that may use
> -   text file handling that will break binary access.  */
> -
> -#ifndef O_BINARY
> -# define O_BINARY 0
> -#endif
> -
>  static GTY(()) tree first_personality_decl;
>
>  /* Returns a hash code for P.  */
> Index: gcc/lto/lto-endian.h
> ===================================================================
> --- gcc/lto/lto-endian.h        (revision 167145)
> +++ gcc/lto/lto-endian.h        (working copy)
> @@ -1,205 +0,0 @@
> -/* Very simple endian-ness layer for LTO object file handling
> -   Copyright 2010 Free Software Foundation, Inc.
> -
> -This file is part of GCC.
> -
> -GCC 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 3, or (at your option) any later
> -version.
> -
> -GCC 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 GCC; see the file COPYING3.  If not see
> -<http://www.gnu.org/licenses/>.  */
> -
> -/* This header file provides a simple way to handle object files in
> -   another endian-ness than the host machine.  This is necesarry to
> -   enable cross-compilation with LTO enabled.  Targets that use the
> -   ELF binary object format do not need this (libelf already handles
> -   endian-ness) but for COFF and Mach-O the functions in this header
> -   are used in the minimal binary object reader/writer.
> -
> -   For all functions in this header, the user is responsible for
> -   making sure that the memory accesses are valid.  */
> -
> -#ifndef GCC_LTO_ENDIAN_H
> -#define GCC_LTO_ENDIAN_H
> -
> -#include <stdint.h>
> -#include <inttypes.h>
> -
> -static inline uint16_t
> -get_uint16_le (const unsigned char *ptr)
> -{
> -  return ptr[0] | (ptr[1] << 8);
> -}
> -
> -static inline uint32_t
> -get_uint32_le (const unsigned char *ptr)
> -{
> -  return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
> -}
> -
> -static inline uint64_t
> -get_uint64_le (const unsigned char *ptr_)
> -{
> -#define ptr (uint64_t) ptr_
> -  return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24)
> -         | (ptr[4] << 32) | (ptr[5] << 40) | (ptr[6] << 48) | (ptr[7] << 56);
> -#undef ptr
> -}
> -
> -static inline uint16_t
> -get_uint16_be (const unsigned char *ptr)
> -{
> -  return ptr[1] | (ptr[2] << 8);
> -}
> -
> -static inline uint32_t
> -get_uint32_be (const unsigned char *ptr)
> -{
> -  return ptr[3] | (ptr[2] << 8) | (ptr[1] << 16) | (ptr[0] << 24);
> -}
> -
> -static inline uint64_t
> -get_uint64_be (const unsigned char *ptr_)
> -{
> -#define ptr (uint64_t) ptr_
> -  return ptr[7] | (ptr[6] << 8) | (ptr[5] << 16) | (ptr[4] << 24)
> -         | (ptr[3] << 32) | (ptr[2] << 40) | (ptr[1] << 48) | (ptr[0] << 56);
> -#undef ptr
> -}
> -
> -static inline void
> -put_uint16_le (unsigned char *ptr, uint16_t data)
> -{
> -  ptr[0] = data & 0xff;
> -  ptr[1] = (data >> 8) & 0xff;
> -}
> -
> -static inline void
> -put_uint32_le (unsigned char *ptr, uint32_t data)
> -{
> -  ptr[0] = data & 0xff;
> -  ptr[1] = (data >> 8) & 0xff;
> -  ptr[2] = (data >> 16) & 0xff;
> -  ptr[3] = (data >> 24) & 0xff;
> -}
> -
> -static inline void
> -put_uint64_le (unsigned char *ptr, uint64_t data)
> -{
> -  ptr[0] = data & 0xff;
> -  ptr[1] = (data >> 8) & 0xff;
> -  ptr[2] = (data >> 16) & 0xff;
> -  ptr[3] = (data >> 24) & 0xff;
> -  ptr[4] = (data >> 32) & 0xff;
> -  ptr[5] = (data >> 40) & 0xff;
> -  ptr[6] = (data >> 48) & 0xff;
> -  ptr[7] = (data >> 56) & 0xff;
> -}
> -
> -static inline void
> -put_uint16_be (unsigned char *ptr, uint16_t data)
> -{
> -  ptr[1] = data & 0xff;
> -  ptr[0] = (data >> 8) & 0xff;
> -}
> -
> -static inline void
> -put_uint32_be (unsigned char *ptr, uint32_t data)
> -{
> -  ptr[3] = data & 0xff;
> -  ptr[2] = (data >> 8) & 0xff;
> -  ptr[1] = (data >> 16) & 0xff;
> -  ptr[0] = (data >> 24) & 0xff;
> -}
> -
> -static inline void
> -put_uint64_be (unsigned char *ptr, uint64_t data)
> -{
> -  ptr[7] = data & 0xff;
> -  ptr[6] = (data >> 8) & 0xff;
> -  ptr[5] = (data >> 16) & 0xff;
> -  ptr[4] = (data >> 24) & 0xff;
> -  ptr[3] = (data >> 32) & 0xff;
> -  ptr[2] = (data >> 40) & 0xff;
> -  ptr[1] = (data >> 48) & 0xff;
> -  ptr[0] = (data >> 56) & 0xff;
> -}
> -
> -static inline void
> -get_string (unsigned char *ptr, char *dest, size_t len)
> -{
> -  memcpy (dest, ptr, len);
> -}
> -
> -static inline void
> -put_string (unsigned char *ptr, char *src, size_t len)
> -{
> -  memcpy (ptr, src, len);
> -}
> -
> -/* Use the target macro BYTES_BIG_ENDIAN to choose.  */
> -
> -static inline uint16_t
> -get_uint16 (const unsigned char *ptr)
> -{
> -  if (BYTES_BIG_ENDIAN)
> -    return get_uint16_be (ptr);
> -  else
> -    return get_uint16_le (ptr);
> -}
> -
> -static inline uint32_t
> -get_uint32 (const unsigned char *ptr)
> -{
> -  if (BYTES_BIG_ENDIAN)
> -    return get_uint32_be (ptr);
> -  else
> -    return get_uint32_le (ptr);
> -}
> -
> -static inline uint64_t
> -get_uint64 (const unsigned char *ptr)
> -{
> -  if (BYTES_BIG_ENDIAN)
> -    return get_uint64_be (ptr);
> -  else
> -    return get_uint64_le (ptr);
> -}
> -
> -static inline void
> -put_uint16 (unsigned char *ptr, uint16_t data)
> -{
> -  if (BYTES_BIG_ENDIAN)
> -    put_uint16_be (ptr, data);
> -  else
> -    put_uint16_le (ptr, data);
> -}
> -
> -static inline void
> -put_uint32 (unsigned char *ptr, uint32_t data)
> -{
> -  if (BYTES_BIG_ENDIAN)
> -    put_uint32_be (ptr, data);
> -  else
> -    put_uint32_le (ptr, data);
> -}
> -
> -static inline void
> -put_uint64 (unsigned char *ptr, uint64_t data)
> -{
> -  if (BYTES_BIG_ENDIAN)
> -    put_uint64_be (ptr, data);
> -  else
> -    put_uint64_le (ptr, data);
> -}
> -
> -#endif /* GCC_LTO_ENDIAN_H  */
> -
> Index: gcc/lto/lto-object.c
> ===================================================================
> --- gcc/lto/lto-object.c        (revision 167145)
> +++ gcc/lto/lto-object.c        (working copy)
> @@ -26,15 +26,8 @@ along with GCC; see the file COPYING3.
>  #include "lto.h"
>  #include "tm.h"
>  #include "lto-streamer.h"
> -#include "libiberty.h"
>  #include "simple-object.h"
>
> -/* Handle opening elf files on hosts, such as Windows, that may use
> -   text file handling that will break binary access.  */
> -#ifndef O_BINARY
> -# define O_BINARY 0
> -#endif
> -
>  /* Segment name for LTO sections.  This is only used for Mach-O.
>    FIXME: This needs to be kept in sync with darwin.c.  */
>
> Index: gcc/tree-mudflap.c
> ===================================================================
> --- gcc/tree-mudflap.c  (revision 167145)
> +++ gcc/tree-mudflap.c  (working copy)
> @@ -39,7 +39,7 @@ along with GCC; see the file COPYING3.
>  #include "tree-pass.h"
>  #include "hashtab.h"
>  #include "diagnostic.h"
> -#include <demangle.h>
> +#include "demangle.h"
>  #include "langhooks.h"
>  #include "ggc.h"
>  #include "cgraph.h"
> Index: gcc/ggc-zone.c
> ===================================================================
> --- gcc/ggc-zone.c      (revision 167145)
> +++ gcc/ggc-zone.c      (working copy)
> @@ -43,22 +43,10 @@ along with GCC; see the file COPYING3.
>    file open.  Prefer either to valloc.  */
>  #ifdef HAVE_MMAP_ANON
>  # undef HAVE_MMAP_DEV_ZERO
> -
> -# include <sys/mman.h>
> -# ifndef MAP_FAILED
> -#  define MAP_FAILED -1
> -# endif
> -# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
> -#  define MAP_ANONYMOUS MAP_ANON
> -# endif
>  # define USING_MMAP
>  #endif
>
>  #ifdef HAVE_MMAP_DEV_ZERO
> -# include <sys/mman.h>
> -# ifndef MAP_FAILED
> -#  define MAP_FAILED -1
> -# endif
>  # define USING_MMAP
>  #endif
>
> Index: gcc/ggc-page.c
> ===================================================================
> --- gcc/ggc-page.c      (revision 167145)
> +++ gcc/ggc-page.c      (working copy)
> @@ -40,26 +40,11 @@ along with GCC; see the file COPYING3.
>    file open.  Prefer either to valloc.  */
>  #ifdef HAVE_MMAP_ANON
>  # undef HAVE_MMAP_DEV_ZERO
> -
> -# include <sys/mman.h>
> -# ifndef MAP_FAILED
> -#  define MAP_FAILED -1
> -# endif
> -# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
> -#  define MAP_ANONYMOUS MAP_ANON
> -# endif
>  # define USING_MMAP
> -
>  #endif
>
>  #ifdef HAVE_MMAP_DEV_ZERO
> -
> -# include <sys/mman.h>
> -# ifndef MAP_FAILED
> -#  define MAP_FAILED -1
> -# endif
>  # define USING_MMAP
> -
>  #endif
>
>  #ifndef USING_MMAP
> Index: gcc/collect2-aix.c
> ===================================================================
> --- gcc/collect2-aix.c  (revision 167145)
> +++ gcc/collect2-aix.c  (working copy)
> @@ -1,5 +1,5 @@
>  /* AIX cross support for collect2.
> -   Copyright (C) 2009 Free Software Foundation, Inc.
> +   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
>
>  This file is part of GCC.
>
> @@ -25,8 +25,6 @@ along with GCC; see the file COPYING3.
>
>  #ifdef CROSS_AIX_SUPPORT
>
> -#include <sys/mman.h>
> -
>  /* Read SIZE bytes starting at DATA as a big-endian value.  */
>
>  static inline bfd_vma
> Index: gcc/system.h
> ===================================================================
> --- gcc/system.h        (revision 167145)
> +++ gcc/system.h        (working copy)
> @@ -180,7 +180,7 @@ extern int fprintf_unlocked (FILE *, con
>  /* There are an extraordinary number of issues with <ctype.h>.
>    The last straw is that it varies with the locale.  Use libiberty's
>    replacement instead.  */
> -#include <safe-ctype.h>
> +#include "safe-ctype.h"
>
>  #include <sys/types.h>
>
> @@ -314,6 +314,9 @@ extern int errno;
>  #ifndef O_WRONLY
>  # define O_WRONLY 1
>  #endif
> +#ifndef O_BINARY
> +# define O_BINARY 0
> +#endif
>
>  /* Some systems define these in, e.g., param.h.  We undefine these names
>    here to avoid the warnings.  We prefer to use our definitions since we
> @@ -353,6 +356,31 @@ extern int errno;
>  #define WCOREFLG 0200
>  #endif
>
> +#include <signal.h>
> +#if !defined (SIGCHLD) && defined (SIGCLD)
> +# define SIGCHLD SIGCLD
> +#endif
> +
> +#ifdef HAVE_SYS_MMAN_H
> +# include <sys/mman.h>
> +#endif
> +
> +#ifndef MAP_FAILED
> +# define MAP_FAILED ((void *)-1)
> +#endif
> +
> +#if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
> +# define MAP_ANONYMOUS MAP_ANON
> +#endif
> +
> +#ifdef HAVE_SYS_RESOURCE_H
> +# include <sys/resource.h>
> +#endif
> +
> +#ifdef HAVE_SYS_TIMES_H
> +# include <sys/times.h>
> +#endif
> +
>  /* The HAVE_DECL_* macros are three-state, undefined, 0 or 1.  If they
>    are defined to 0 then we must provide the relevant declaration
>    here.  These checks will be in the undefined state while configure
> @@ -526,6 +554,10 @@ extern int vsnprintf(char *, size_t, con
>  # define mkdir(a,b) mkdir(a)
>  #endif
>
> +#ifndef HAVE_KILL
> +# define kill(p,s) raise(s)
> +#endif
> +
>  /* Provide a way to print an address via printf.  */
>  #ifndef HOST_PTR_PRINTF
>  #define HOST_PTR_PRINTF "%p"
> @@ -804,7 +836,7 @@ extern void fancy_abort (const char *, i
>    LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
>
>  /* Miscellaneous macros that are no longer used.  */
> - #pragma GCC poison USE_MAPPED_LOCATION
> + #pragma GCC poison USE_MAPPED_LOCATION GET_ENVIRONMENT
>
>  /* Libiberty macros that are no longer used in GCC.  */
>  #undef ANSI_PROTOTYPES
> Index: gcc/tlink.c
> ===================================================================
> --- gcc/tlink.c (revision 167145)
> +++ gcc/tlink.c (working copy)
> @@ -1,8 +1,8 @@
>  /* Scan linker error messages for missing template instantiations and provide
>    them.
>
> -   Copyright (C) 1995, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008
> -   Free Software Foundation, Inc.
> +   Copyright (C) 1995, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008,
> +   2009, 2010 Free Software Foundation, Inc.
>    Contributed by Jason Merrill (jason@cygnus.com).
>
>  This file is part of GCC.
> @@ -30,7 +30,6 @@ along with GCC; see the file COPYING3.
>  #include "hashtab.h"
>  #include "demangle.h"
>  #include "collect2.h"
> -#include "libiberty.h"
>
>  /* TARGET_64BIT may be defined to use driver specific functionality. */
>  #undef TARGET_64BIT
> Index: gcc/tree-switch-conversion.c
> ===================================================================
> --- gcc/tree-switch-conversion.c        (revision 167145)
> +++ gcc/tree-switch-conversion.c        (working copy)
> @@ -80,8 +80,6 @@ eight) times the number of the actual sw
>  #include "system.h"
>  #include "coretypes.h"
>  #include "tm.h"
> -#include <signal.h>
> -
>  #include "line-map.h"
>  #include "params.h"
>  #include "flags.h"
> Index: gcc/passes.c
> ===================================================================
> --- gcc/passes.c        (revision 167145)
> +++ gcc/passes.c        (working copy)
> @@ -28,16 +28,6 @@ along with GCC; see the file COPYING3.
>  #include "system.h"
>  #include "coretypes.h"
>  #include "tm.h"
> -#include <signal.h>
> -
> -#ifdef HAVE_SYS_RESOURCE_H
> -# include <sys/resource.h>
> -#endif
> -
> -#ifdef HAVE_SYS_TIMES_H
> -# include <sys/times.h>
> -#endif
> -
>  #include "line-map.h"
>  #include "input.h"
>  #include "tree.h"
> Index: gcc/config/host-hpux.c
> ===================================================================
> --- gcc/config/host-hpux.c      (revision 167145)
> +++ gcc/config/host-hpux.c      (working copy)
> @@ -1,5 +1,5 @@
>  /* HP-UX host-specific hook definitions.
> -   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
> +   Copyright (C) 2004, 2005, 2007, 2010 Free Software Foundation, Inc.
>
>    This file is part of GCC.
>
> @@ -20,15 +20,9 @@
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include <sys/mman.h>
> -#include <unistd.h>
>  #include "hosthooks.h"
>  #include "hosthooks-def.h"
>
> -#ifndef MAP_FAILED
> -#define MAP_FAILED (void *)-1L
> -#endif
> -
>  static void *hpux_gt_pch_get_address (size_t, int);
>  static int hpux_gt_pch_use_address (void *, size_t, int, size_t);
>
> Index: gcc/config/alpha/alpha.c
> ===================================================================
> --- gcc/config/alpha/alpha.c    (revision 167145)
> +++ gcc/config/alpha/alpha.c    (working copy)
> @@ -50,7 +50,7 @@ along with GCC; see the file COPYING3.
>  #include "target-def.h"
>  #include "debug.h"
>  #include "langhooks.h"
> -#include <splay-tree.h>
> +#include "splay-tree.h"
>  #include "cfglayout.h"
>  #include "gimple.h"
>  #include "tree-flow.h"
> Index: gcc/config/frv/frv.c
> ===================================================================
> --- gcc/config/frv/frv.c        (revision 167145)
> +++ gcc/config/frv/frv.c        (working copy)
> @@ -44,7 +44,6 @@ along with GCC; see the file COPYING3.
>  #include "basic-block.h"
>  #include "tm_p.h"
>  #include "ggc.h"
> -#include <ctype.h>
>  #include "target.h"
>  #include "target-def.h"
>  #include "targhooks.h"
> Index: gcc/config/m32c/m32c-pragma.c
> ===================================================================
> --- gcc/config/m32c/m32c-pragma.c       (revision 167145)
> +++ gcc/config/m32c/m32c-pragma.c       (working copy)
> @@ -1,5 +1,5 @@
>  /* M32C Pragma support
> -   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
> +   Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc.
>    Contributed by Red Hat, Inc.
>
>    This file is part of GCC.
> @@ -18,7 +18,6 @@
>    along with GCC; see the file COPYING3.  If not see
>    <http://www.gnu.org/licenses/>.  */
>
> -#include <stdio.h>
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> Index: gcc/config/mep/mep-pragma.c
> ===================================================================
> --- gcc/config/mep/mep-pragma.c (revision 167145)
> +++ gcc/config/mep/mep-pragma.c (working copy)
> @@ -1,5 +1,5 @@
>  /* Definitions of Toshiba Media Processor
> -   Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free
> +   Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010 Free
>    Software Foundation, Inc.  Contributed by Red Hat, Inc.
>
>  This file is part of GCC.
> @@ -18,7 +18,6 @@ You should have received a copy of the G
>  along with GCC; see the file COPYING3.  If not see
>  <http://www.gnu.org/licenses/>.  */
>
> -#include <stdio.h>
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> Index: gcc/config/i386/cygming.h
> ===================================================================
> --- gcc/config/i386/cygming.h   (revision 167145)
> +++ gcc/config/i386/cygming.h   (working copy)
> @@ -118,8 +118,6 @@ along with GCC; see the file COPYING3.
>
>  #define TARGET_EXECUTABLE_SUFFIX ".exe"
>
> -#include <stdio.h>
> -
>  #define TARGET_OS_CPP_BUILTINS()                                       \
>   do                                                                   \
>     {                                                                  \
> Index: gcc/config/i386/host-cygwin.c
> ===================================================================
> --- gcc/config/i386/host-cygwin.c       (revision 167145)
> +++ gcc/config/i386/host-cygwin.c       (working copy)
> @@ -1,5 +1,5 @@
>  /* Cygwin host-specific hook definitions.
> - Copyright (C) 2004, 2007 Free Software Foundation, Inc.
> + Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc.
>
>  This file is part of GCC.
>
> @@ -20,7 +20,6 @@
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include <sys/mman.h>
>  #include "hosthooks.h"
>  #include "hosthooks-def.h"
>  #include "toplev.h"
> Index: gcc/config/i386/driver-i386.c
> ===================================================================
> --- gcc/config/i386/driver-i386.c       (revision 167145)
> +++ gcc/config/i386/driver-i386.c       (working copy)
> @@ -21,7 +21,6 @@ along with GCC; see the file COPYING3.
>  #include "system.h"
>  #include "coretypes.h"
>  #include "tm.h"
> -#include <stdlib.h>
>
>  const char *host_detect_local_cpu (int argc, const char **argv);
>
> Index: gcc/config/microblaze/microblaze.c
> ===================================================================
> --- gcc/config/microblaze/microblaze.c  (revision 167145)
> +++ gcc/config/microblaze/microblaze.c  (working copy)
> @@ -22,7 +22,6 @@
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include <signal.h>
>  #include "tm.h"
>  #include "rtl.h"
>  #include "regs.h"
> Index: gcc/config/avr/driver-avr.c
> ===================================================================
> --- gcc/config/avr/driver-avr.c (revision 167145)
> +++ gcc/config/avr/driver-avr.c (working copy)
> @@ -1,5 +1,5 @@
>  /* Subroutines for the gcc driver.
> -   Copyright (C) 2009 Free Software Foundation, Inc.
> +   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
>    Contributed by Anatoly Sokolov <aesok@post.ru>
>
>  This file is part of GCC.
> @@ -22,7 +22,6 @@ along with GCC; see the file COPYING3.
>  #include "system.h"
>  #include "coretypes.h"
>  #include "tm.h"
> -#include <stdlib.h>
>
>  /* Current architecture.  */
>  const struct base_arch_s *avr_current_arch = NULL;
> Index: gcc/config/host-solaris.c
> ===================================================================
> --- gcc/config/host-solaris.c   (revision 167145)
> +++ gcc/config/host-solaris.c   (working copy)
> @@ -20,7 +20,6 @@
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include <sys/mman.h>
>  #include "hosthooks.h"
>  #include "hosthooks-def.h"
>
> Index: gcc/config/m68hc11/m68hc11.c
> ===================================================================
> --- gcc/config/m68hc11/m68hc11.c        (revision 167145)
> +++ gcc/config/m68hc11/m68hc11.c        (working copy)
> @@ -32,7 +32,6 @@ Note:
>
>  */
>
> -#include <stdio.h>
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> Index: gcc/config/host-linux.c
> ===================================================================
> --- gcc/config/host-linux.c     (revision 167145)
> +++ gcc/config/host-linux.c     (working copy)
> @@ -1,5 +1,5 @@
>  /* Linux host-specific hook definitions.
> -   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
> +   Copyright (C) 2004, 2005, 2007, 2008, 2010 Free Software Foundation, Inc.
>
>    This file is part of GCC.
>
> @@ -20,8 +20,6 @@
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include <sys/mman.h>
> -#include <limits.h>
>  #include "hosthooks.h"
>  #include "hosthooks-def.h"
>
> Index: gcc/config/iq2000/iq2000.c
> ===================================================================
> --- gcc/config/iq2000/iq2000.c  (revision 167145)
> +++ gcc/config/iq2000/iq2000.c  (working copy)
> @@ -21,7 +21,6 @@ along with GCC; see the file COPYING3.
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include <signal.h>
>  #include "tm.h"
>  #include "tree.h"
>  #include "rtl.h"
> Index: gcc/config/host-darwin.c
> ===================================================================
> --- gcc/config/host-darwin.c    (revision 167145)
> +++ gcc/config/host-darwin.c    (working copy)
> @@ -1,5 +1,5 @@
>  /* Darwin host-specific hook definitions.
> -   Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
> +   Copyright (C) 2003, 2004, 2005, 2007, 2010 Free Software Foundation, Inc.
>
>    This file is part of GCC.
>
> @@ -20,7 +20,6 @@
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include <sys/mman.h>
>  #include "diagnostic-core.h"
>  #include "toplev.h"
>  #include "config/host-darwin.h"
> Index: gcc/config/rs6000/host-darwin.c
> ===================================================================
> --- gcc/config/rs6000/host-darwin.c     (revision 167145)
> +++ gcc/config/rs6000/host-darwin.c     (working copy)
> @@ -1,5 +1,5 @@
>  /* Darwin/powerpc host-specific hook definitions.
> -   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
> +   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010
>    Free Software Foundation, Inc.
>
>    This file is part of GCC.
> @@ -21,7 +21,6 @@
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> -#include <signal.h>
>  #include <sys/ucontext.h>
>  #include "hosthooks.h"
>  #include "hosthooks-def.h"
> Index: gcc/config/arm/arm.c
> ===================================================================
> --- gcc/config/arm/arm.c        (revision 167145)
> +++ gcc/config/arm/arm.c        (working copy)
> @@ -1352,7 +1352,7 @@ arm_target_help (void)
>     {
>       const char *p;
>
> -      GET_ENVIRONMENT (p, "COLUMNS");
> +      p = getenv ("COLUMNS");
>       if (p != NULL)
>        {
>          int value = atoi (p);
> Index: gcc/config/mips/mips.c
> ===================================================================
> --- gcc/config/mips/mips.c      (revision 167145)
> +++ gcc/config/mips/mips.c      (working copy)
> @@ -27,7 +27,6 @@ along with GCC; see the file COPYING3.
>  #include "system.h"
>  #include "coretypes.h"
>  #include "tm.h"
> -#include <signal.h>
>  #include "rtl.h"
>  #include "regs.h"
>  #include "hard-reg-set.h"
> Index: gcc/collect2.c
> ===================================================================
> --- gcc/collect2.c      (revision 167145)
> +++ gcc/collect2.c      (working copy)
> @@ -30,10 +30,6 @@ along with GCC; see the file COPYING3.
>  #include "system.h"
>  #include "coretypes.h"
>  #include "tm.h"
> -#include <signal.h>
> -#if ! defined( SIGCHLD ) && defined( SIGCLD )
> -#  define SIGCHLD SIGCLD
> -#endif
>
>  /* TARGET_64BIT may be defined to use driver specific functionality. */
>  #undef TARGET_64BIT
> @@ -822,7 +818,7 @@ static void
>  prefix_from_env (const char *env, struct path_prefix *pprefix)
>  {
>   const char *p;
> -  GET_ENVIRONMENT (p, env);
> +  p = getenv (env);
>
>   if (p)
>     prefix_from_string (p, pprefix);
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>
Dave Korn Nov. 27, 2010, 11:32 a.m. UTC | #5
On 27/11/2010 01:49, Joseph S. Myers wrote:

> 	* config/i386/cygming.h: Don't include <stdio.h>.

> 	* config/i386/host-cygwin.c: Don't include <sys/mman.h>.


> Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Also
> tested building cc1 for crosses to: alpha-linux-gnu arm-eabi frv-elf
> i686-mingw32 iq2000-elf m32c-elf m68hc11-elf mep-elf microblaze-elf
> mips-elf.  

  And I successfully restrapped an existing build tree with it on
i686-pc-cygwin, so those two are OK.

    cheers,
      DaveK
Laurynas Biveinis Nov. 27, 2010, 1:22 p.m. UTC | #6
2010/11/27 Joseph S. Myers <joseph@codesourcery.com>:
>        * ggc-zone.c: Don't include <sys/mman.h>.
>        (MAP_ANONYMOUS, MAP_FAILED): Don't define.

ggc-zone.c is not compiled unless configured with --with-gc=zone, so
would you mind doing 'make ggc-zone.o' to make sure it still builds OK
with the change?
Joseph Myers Nov. 27, 2010, 5:57 p.m. UTC | #7
On Sat, 27 Nov 2010, N.M. Maclaren wrote:

> > fortran/gfortran.h had a pile of definitions related to alloca.  If
> > such were needed, system.h would be the right place for them, but
> > since the rest of GCC uses alloca without needing such definitions I
> > just removed them.
> 
> Do you know if any of those rely on function-scope lifetime rather than
> block-scope lifetime and are in code that is needed for bootstrapping?
> I am still trying to find out where the world is going in this respect,
> and it is most unclear.

It does appear some rely on function-scope lifetime, e.g. in reg-stack.c:

static int
check_asm_stack_operands (rtx insn)
{
[...]
  rtx *clobber_reg = 0;
[...]  if (GET_CODE (body) == PARALLEL)
    {
      clobber_reg = XALLOCAVEC (rtx, XVECLEN (body, 0));
[...]
    }
[...]
              if (REGNO (recog_data.operand[i]) == REGNO (clobber_reg[j]))

I hadn't checked carefully enough before for portability code relating to 
alloca; actually it's in libiberty.h, where it arranges for libiberty's C 
implementation of alloca to be used if not building with GCC.  So that 
might in fact avoid portability issues with any bootstrap implementations 
using a different lifetime for their built-in alloca - if the C alloca is 
actually portable enough.

I don't think anything (at least anything built for the host) in GCC, 
whether needed for bootstrapping or not, should be using VLAs; it's the 
combination of the two that is documented as reducing the lifetime of 
memory from alloca when building with GCC:

    There are other differences between these two methods.  Space allocated
    with @code{alloca} exists until the containing @emph{function} returns.
    The space for a variable-length array is deallocated as soon as the array
    name's scope ends.  (If you use both variable-length arrays and
    @code{alloca} in the same function, deallocation of a variable-length array
    will also deallocate anything more recently allocated with @code{alloca}.)

Bootstrapping with non-GCC compilers is supposed to work but isn't often 
tested.  The documented requirement on a bootstrap compiler is that it 
supports ISO C90; the undocumented requirements beyond that include at 
least "long long" support for configurations with 32-bit long that set 
need_64bit_hwint in config.gcc.
Joseph Myers Nov. 27, 2010, 5:59 p.m. UTC | #8
On Sat, 27 Nov 2010, Richard Guenther wrote:

> The non-frontend and LTO frontend changes are ok.

Thanks.  I think all the non-Java changes have now been approved.
Joseph Myers Nov. 27, 2010, 6:01 p.m. UTC | #9
On Sat, 27 Nov 2010, Laurynas Biveinis wrote:

> ggc-zone.c is not compiled unless configured with --with-gc=zone, so
> would you mind doing 'make ggc-zone.o' to make sure it still builds OK
> with the change?

It has a pre-existing build failure.

ggc-zone.c:1080:1: error: no previous prototype for 'ggc_internal_alloc_zone_stat' [-Werror=missing-prototypes]
ggc-zone.c:1347:1: error: no previous prototype for 'ggc_internal_cleared_alloc_zone_stat' [-Werror=missing-prototypes]
ggc-zone.c: In function 'ggc_pch_read':
ggc-zone.c:2467:8: error: macro names must be identifiers

The invalid syntax of

#ifdef 0 && GATHER_STATISTICS

is certainly nothing to do with my patch and I don't see any relation of 
the other failures to my patch either.
N.M. Maclaren Nov. 27, 2010, 7:42 p.m. UTC | #10
On Nov 27 2010, Joseph S. Myers wrote:

Thanks very much.

>I don't think anything (at least anything built for the host) in GCC, 
>whether needed for bootstrapping or not, should be using VLAs; it's the 
>combination of the two that is documented as reducing the lifetime of 
>memory from alloca when building with GCC:

I agree that using both is doubleplus ungood.  If existing code uses the
wider scope of alloca, then not using VLAs is the only sane approach.

While VLAs are much cleaner and potentially much more efficient, I think 
that the description you gave and I snipped seriously underestimates the 
problems, in general. I have seen similar combinations (in other languages) 
cause memory leaks, for example, and it wouldn't surprise me if that 
happened with some C compilers/libraries and that combination. They each 
'poison' the other.

Regards,
Nick Maclaren.
Tom Tromey Nov. 29, 2010, 2:38 p.m. UTC | #11
>>>>> "Joseph" == Joseph S Myers <joseph@codesourcery.com> writes:

Joseph> On Sat, 27 Nov 2010, Richard Guenther wrote:
>> The non-frontend and LTO frontend changes are ok.

Joseph> Thanks.  I think all the non-Java changes have now been approved.

The Java parts are ok too.  Thanks.

Tom
diff mbox

Patch

Index: gcc/c-family/c-opts.c
===================================================================
--- gcc/c-family/c-opts.c	(revision 167145)
+++ gcc/c-family/c-opts.c	(working copy)
@@ -1131,12 +1131,12 @@  check_deps_environment_vars (void)
 {
   char *spec;
 
-  GET_ENVIRONMENT (spec, "DEPENDENCIES_OUTPUT");
+  spec = getenv ("DEPENDENCIES_OUTPUT");
   if (spec)
     cpp_opts->deps.style = DEPS_USER;
   else
     {
-      GET_ENVIRONMENT (spec, "SUNPRO_DEPENDENCIES");
+      spec = getenv ("SUNPRO_DEPENDENCIES");
       if (spec)
 	{
 	  cpp_opts->deps.style = DEPS_SYSTEM;
Index: gcc/c-family/c-pch.c
===================================================================
--- gcc/c-family/c-pch.c	(revision 167145)
+++ gcc/c-family/c-pch.c	(working copy)
@@ -472,10 +472,6 @@  c_common_no_more_pch (void)
 
 /* Handle #pragma GCC pch_preprocess, to load in the PCH file.  */
 
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
 void
 c_common_pch_pragma (cpp_reader *pfile, const char *name)
 {
Index: gcc/c-family/c-pragma.h
===================================================================
--- gcc/c-family/c-pragma.h	(revision 167145)
+++ gcc/c-family/c-pragma.h	(working copy)
@@ -21,7 +21,7 @@  along with GCC; see the file COPYING3.  
 #ifndef GCC_C_PRAGMA_H
 #define GCC_C_PRAGMA_H
 
-#include <cpplib.h> /* For enum cpp_ttype.  */
+#include "cpplib.h" /* For enum cpp_ttype.  */
 
 /* Pragma identifiers built in to the front end parsers.  Identifiers
    for ancillary handlers will follow these.  */
Index: gcc/java/verify-impl.c
===================================================================
--- gcc/java/verify-impl.c	(revision 167145)
+++ gcc/java/verify-impl.c	(working copy)
@@ -1,4 +1,4 @@ 
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010
    Free Software Foundation
 
    This file is part of libgcj.
@@ -19,10 +19,6 @@  details.  */
 /* Hack to work around namespace pollution from java-tree.h.  */
 #undef current_class
 
-#ifdef VERIFY_DEBUG
-#include <stdio.h>
-#endif /* VERIFY_DEBUG */
-
 /* This is used to mark states which are not scheduled for
    verification. */
 #define INVALID_STATE ((state *) -1)
Index: gcc/java/class.c
===================================================================
--- gcc/java/class.c	(revision 167145)
+++ gcc/java/class.c	(working copy)
@@ -38,18 +38,12 @@  The Free Software Foundation is independ
 #include "parse.h"
 #include "function.h"
 #include "ggc.h"
-#include "stdio.h"
 #include "cgraph.h"
 #include "tree-iterator.h"
 #include "vecprim.h"
 #include "tm.h"         /* FIXME: For gcc_obstack_init from defaults.h.  */
 #include "target.h"
 
-/* DOS brain-damage */
-#ifndef O_BINARY
-#define O_BINARY 0 /* MS-DOS brain-damage */
-#endif
-
 static tree make_method_value (tree);
 static tree build_java_method_type (tree, tree, int);
 static int32 hashUtf8String (const char *, int);
Index: gcc/java/resource.c
===================================================================
--- gcc/java/resource.c	(revision 167145)
+++ gcc/java/resource.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* Functions related to building resource files.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2007, 2008 Free Software Foundation, Inc.
+   2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -34,15 +34,9 @@  The Free Software Foundation is independ
 #include "parse.h"
 #include "function.h"
 #include "ggc.h"
-#include "stdio.h"
 #include "tree-iterator.h"
 #include "cgraph.h"
 
-/* DOS brain-damage */
-#ifndef O_BINARY
-#define O_BINARY 0 /* MS-DOS brain-damage */
-#endif
-
 /* A list of all the resources files.  */
 static GTY(()) VEC(tree,gc) *resources;
 
Index: gcc/java/builtins.c
===================================================================
--- gcc/java/builtins.c	(revision 167145)
+++ gcc/java/builtins.c	(working copy)
@@ -36,7 +36,6 @@  The Free Software Foundation is independ
 #include "flags.h"
 #include "langhooks.h"
 #include "java-tree.h"
-#include <stdarg.h>
 
 /* FIXME: All these headers are necessary for sync_compare_and_swap.
    Front ends should never have to look at that.  */
Index: gcc/java/jcf-path.c
===================================================================
--- gcc/java/jcf-path.c	(revision 167145)
+++ gcc/java/jcf-path.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* Handle CLASSPATH, -classpath, and path searching.
    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006,
-   2007, 2008 Free Software Foundation, Inc.
+   2007, 2008, 2010 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -27,7 +27,6 @@  The Free Software Foundation is independ
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"		/* FIXME: For GET_ENVIRONMENT from defaults.h.  */
 
 #include <dirent.h>
 
@@ -224,7 +223,7 @@  jcf_path_init (void)
   sep[0] = DIR_SEPARATOR;
   sep[1] = '\0';
 
-  GET_ENVIRONMENT (cp, "GCC_EXEC_PREFIX");
+  cp = getenv ("GCC_EXEC_PREFIX");
   if (cp)
     {
       attempt = (char *) alloca (strlen (cp) + 50);
@@ -295,7 +294,7 @@  jcf_path_init (void)
 	jcf_path_extdirs_arg (extdirs);
     }
 
-  GET_ENVIRONMENT (cp, "CLASSPATH");
+  cp = getenv ("CLASSPATH");
   add_path (&classpath_env, cp, 0);
 }
 
Index: gcc/java/jcf-depend.c
===================================================================
--- gcc/java/jcf-depend.c	(revision 167145)
+++ gcc/java/jcf-depend.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* Functions for handling dependency tracking when reading .class files.
 
-   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2006, 2007
+   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2006, 2007, 2010
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -30,8 +30,6 @@  The Free Software Foundation is independ
 #include "coretypes.h"
 #include "mkdeps.h"
 
-#include <assert.h>
-
 #include "jcf.h"
 
 
@@ -89,7 +87,7 @@  jcf_dependency_add_target (const char *n
 void
 jcf_dependency_set_dep_file (const char *name)
 {
-  assert (dep_out != stdout);
+  gcc_assert (dep_out != stdout);
   if (dep_out)
     fclose (dep_out);
   if (! strcmp (name, "-"))
@@ -117,7 +115,7 @@  jcf_dependency_add_file (const char *fil
 void
 jcf_dependency_init (int system_p)
 {
-  assert (! dependencies);
+  gcc_assert (! dependencies);
   system_files = system_p;
   dependencies = deps_init ();
 }
@@ -134,7 +132,7 @@  jcf_dependency_write (void)
   if (! dep_out)
     return;
 
-  assert (dependencies);
+  gcc_assert (dependencies);
 
   deps_write (dependencies, dep_out, 72);
   if (print_dummies)
Index: gcc/java/jcf-io.c
===================================================================
--- gcc/java/jcf-io.c	(revision 167145)
+++ gcc/java/jcf-io.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* Utility routines for finding and reading Java(TM) .class files.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -36,11 +36,6 @@  The Free Software Foundation is independ
 
 #include "zlib.h"
 
-/* DOS brain-damage */
-#ifndef O_BINARY
-#define O_BINARY 0 /* MS-DOS brain-damage */
-#endif
-
 int
 jcf_unexpected_eof (JCF *jcf, int count ATTRIBUTE_UNUSED)
 {
Index: gcc/java/boehm.c
===================================================================
--- gcc/java/boehm.c	(revision 167145)
+++ gcc/java/boehm.c	(working copy)
@@ -1,5 +1,6 @@ 
 /* Functions related to the Boehm garbage collector.
-   Copyright (C) 2000, 2003, 2004, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2003, 2004, 2006, 2009, 2010
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -23,8 +24,7 @@  The Free Software Foundation is independ
 
 /* Written by Tom Tromey <tromey@cygnus.com>.  */
 
-#include <config.h>
-
+#include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "double-int.h"
Index: gcc/defaults.h
===================================================================
--- gcc/defaults.h	(revision 167145)
+++ gcc/defaults.h	(working copy)
@@ -28,10 +28,6 @@  see the files COPYING3 and COPYING.RUNTI
 #ifndef GCC_DEFAULTS_H
 #define GCC_DEFAULTS_H
 
-#ifndef GET_ENVIRONMENT
-#define GET_ENVIRONMENT(VALUE, NAME) do { (VALUE) = getenv (NAME); } while (0)
-#endif
-
 /* Store in OUTPUT a string (made with alloca) containing an
    assembler-name for a local static variable or function named NAME.
    LABELNO is an integer which is different for each call.  */
Index: gcc/incpath.c
===================================================================
--- gcc/incpath.c	(revision 167145)
+++ gcc/incpath.c	(working copy)
@@ -100,7 +100,7 @@  add_env_var_paths (const char *env_var, 
 {
   char *p, *q, *path;
 
-  GET_ENVIRONMENT (q, env_var);
+  q = getenv (env_var);
 
   if (!q)
     return;
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 167145)
+++ gcc/configure	(working copy)
@@ -8610,7 +8610,7 @@  fi
 
 for ac_func in times clock kill getrlimit setrlimit atoll atoq \
 	sysconf strsignal getrusage nl_langinfo \
-	gettimeofday mbstowcs wcswidth mmap mincore setlocale \
+	gettimeofday mbstowcs wcswidth mmap setlocale \
 	clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
Index: gcc/mips-tfile.c
===================================================================
--- gcc/mips-tfile.c	(revision 167145)
+++ gcc/mips-tfile.c	(working copy)
@@ -665,8 +665,6 @@  main (void)
 
 #undef index
 
-#include <signal.h>
-
 #ifndef CROSS_DIRECTORY_STRUCTURE
 #include <a.out.h>
 #else
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 167145)
+++ gcc/gcc.c	(working copy)
@@ -35,10 +35,6 @@  compilation is specified by a string cal
 #include "coretypes.h"
 #include "multilib.h" /* before tm.h */
 #include "tm.h"
-#include <signal.h>
-#if ! defined( SIGCHLD ) && defined( SIGCLD )
-#  define SIGCHLD SIGCLD
-#endif
 #include "xregex.h"
 #include "obstack.h"
 #include "intl.h"
@@ -49,18 +45,6 @@  compilation is specified by a string cal
 #include "opts.h"
 #include "vec.h"
 
-#ifdef HAVE_MMAP_FILE
-# include <sys/mman.h>
-# ifdef HAVE_MINCORE
-/* This is on Solaris.  */
-#  include <sys/types.h>
-# endif
-#endif
-
-#ifndef MAP_FAILED
-# define MAP_FAILED ((void *)-1)
-#endif
-
 /* By default there is no special suffix for target executables.  */
 /* FIXME: when autoconf is fixed, remove the host check - dj */
 #if defined(TARGET_EXECUTABLE_SUFFIX) && defined(HOST_EXECUTABLE_SUFFIX)
@@ -88,10 +72,6 @@  static const char dir_separator_str[] = 
 #define LIBRARY_PATH_ENV "LIBRARY_PATH"
 #endif
 
-#ifndef HAVE_KILL
-#define kill(p,s) raise(s)
-#endif
-
 /* If a stage of compilation returns an exit status >= 1,
    compilation of that file ceases.  */
 
@@ -3506,7 +3486,7 @@  process_command (unsigned int decoded_op
   struct cl_option_handlers handlers;
   unsigned int j;
 
-  GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
+  gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX");
 
   n_switches = 0;
   n_infiles = 0;
@@ -3611,7 +3591,7 @@  process_command (unsigned int decoded_op
   /* COMPILER_PATH and LIBRARY_PATH have values
      that are lists of directory names with colons.  */
 
-  GET_ENVIRONMENT (temp, "COMPILER_PATH");
+  temp = getenv ("COMPILER_PATH");
   if (temp)
     {
       const char *startp, *endp;
@@ -3645,7 +3625,7 @@  process_command (unsigned int decoded_op
 	}
     }
 
-  GET_ENVIRONMENT (temp, LIBRARY_PATH_ENV);
+  temp = getenv (LIBRARY_PATH_ENV);
   if (temp && *cross_compile == '0')
     {
       const char *startp, *endp;
@@ -3678,7 +3658,7 @@  process_command (unsigned int decoded_op
     }
 
   /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
-  GET_ENVIRONMENT (temp, "LPATH");
+  temp = getenv ("LPATH");
   if (temp && *cross_compile == '0')
     {
       const char *startp, *endp;
Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c	(revision 167145)
+++ gcc/toplev.c	(working copy)
@@ -28,12 +28,6 @@  along with GCC; see the file COPYING3.  
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include <signal.h>
-
-#ifdef HAVE_SYS_TIMES_H
-# include <sys/times.h>
-#endif
-
 #include "line-map.h"
 #include "input.h"
 #include "tree.h"
Index: gcc/vmsdbgout.c
===================================================================
--- gcc/vmsdbgout.c	(revision 167145)
+++ gcc/vmsdbgout.c	(working copy)
@@ -1625,9 +1625,7 @@  vmsdbgout_finish (const char *main_input
 #include <vms/stsdef.h>
 #include <vms/iodef.h>
 #include <vms/fatdef.h>
-#include <errno.h>
 #include <vms/descrip.h>
-#include <string.h>
 #include <unixlib.h>
 
 #define MAXPATH 256
Index: gcc/graph.c
===================================================================
--- gcc/graph.c	(revision 167145)
+++ gcc/graph.c	(working copy)
@@ -19,7 +19,7 @@  You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#include <config.h>
+#include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
Index: gcc/lto-wrapper.c
===================================================================
--- gcc/lto-wrapper.c	(revision 167145)
+++ gcc/lto-wrapper.c	(working copy)
@@ -40,19 +40,9 @@  along with GCC; see the file COPYING3.  
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <errno.h>
-#include <signal.h>
-#if ! defined( SIGCHLD ) && defined( SIGCLD )
-#  define SIGCHLD SIGCLD
-#endif
 #include "intl.h"
-#include "libiberty.h"
 #include "obstack.h"
 
-#ifndef HAVE_KILL
-#define kill(p,s) raise(s)
-#endif
-
 int debug;				/* true if -save-temps.  */
 int verbose;				/* true if -v.  */
 
Index: gcc/config.in
===================================================================
--- gcc/config.in	(revision 167145)
+++ gcc/config.in	(working copy)
@@ -1251,12 +1251,6 @@ 
 #endif
 
 
-/* Define to 1 if you have the `mincore' function. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_MINCORE
-#endif
-
-
 /* Define to 1 if you have the `mmap' function. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_MMAP
Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 167145)
+++ gcc/opts.c	(working copy)
@@ -21,13 +21,6 @@  along with GCC; see the file COPYING3.  
 
 #include "config.h"
 #include "system.h"
-
-#include <signal.h>
-
-#ifdef HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
 #include "intl.h"
 #include "coretypes.h"
 #include "tm.h" /* Needed by rtl.h and used for DWARF2_DEBUGGING_INFO
@@ -1067,7 +1060,7 @@  print_specific_help (unsigned int includ
     {
       const char *p;
 
-      GET_ENVIRONMENT (p, "COLUMNS");
+      p = getenv ("COLUMNS");
       if (p != NULL)
 	{
 	  int value = atoi (p);
Index: gcc/timevar.c
===================================================================
--- gcc/timevar.c	(revision 167145)
+++ gcc/timevar.c	(working copy)
@@ -1,5 +1,6 @@ 
 /* Timing variables for measuring compiler performance.
-   Copyright (C) 2000, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2003, 2004, 2005, 2007, 2010
+   Free Software Foundation, Inc.
    Contributed by Alex Samuel <samuel@codesourcery.com>
 
 This file is part of GCC.
@@ -20,12 +21,6 @@  along with GCC; see the file COPYING3.  
 
 #include "config.h"
 #include "system.h"
-#ifdef HAVE_SYS_TIMES_H
-# include <sys/times.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
 #include "timevar.h"
 
 #ifndef HAVE_CLOCK_T
Index: gcc/fortran/gfortran.h
===================================================================
--- gcc/fortran/gfortran.h	(revision 167145)
+++ gcc/fortran/gfortran.h	(working copy)
@@ -38,24 +38,6 @@  along with GCC; see the file COPYING3.  
 #include "coretypes.h"
 #include "input.h"
 #include "splay-tree.h"
-/* The following ifdefs are recommended by the autoconf documentation
-   for any code using alloca.  */
-
-/* AIX requires this to be the first thing in the file.  */
-#ifdef __GNUC__
-#else /* not __GNUC__ */
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* do not HAVE_ALLOCA_H */
-#ifdef _AIX
-#pragma alloca
-#else
-#ifndef alloca			/* predefined by HP cc +Olibcalls */
-char *alloca ();
-#endif /* not predefined */
-#endif /* not _AIX */
-#endif /* do not HAVE_ALLOCA_H */
-#endif /* not __GNUC__ */
 
 /* Major control parameters.  */
 
@@ -70,10 +52,6 @@  char *alloca ();
 #define free(x) Use_gfc_free_instead_of_free()
 #define gfc_is_whitespace(c) ((c==' ') || (c=='\t'))
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 /* Stringization.  */
 #define stringize(x) expand_macro(x)
 #define expand_macro(x) # x
Index: gcc/et-forest.h
===================================================================
--- gcc/et-forest.h	(revision 167145)
+++ gcc/et-forest.h	(working copy)
@@ -1,5 +1,6 @@ 
 /* Et-forest data structure implementation.
-   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2007, 2010
+   Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -48,9 +49,6 @@ 
 #ifndef _ET_TREE_H
 #define _ET_TREE_H
 
-#include <ansidecl.h>
-#include <stddef.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 167145)
+++ gcc/configure.ac	(working copy)
@@ -974,7 +974,7 @@  define(gcc_UNLOCKED_FUNCS, clearerr_unlo
   putchar_unlocked putc_unlocked)
 AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \
 	sysconf strsignal getrusage nl_langinfo \
-	gettimeofday mbstowcs wcswidth mmap mincore setlocale \
+	gettimeofday mbstowcs wcswidth mmap setlocale \
 	gcc_UNLOCKED_FUNCS)
 
 if test x$ac_cv_func_mbstowcs = xyes; then
Index: gcc/cppdefault.c
===================================================================
--- gcc/cppdefault.c	(revision 167145)
+++ gcc/cppdefault.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* CPP Library.
    Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+   1999, 2000, 2003, 2004, 2006, 2007, 2010 Free Software Foundation, Inc.
    Contributed by Per Bothner, 1994-95.
    Based on CCCP program by Paul Rubin, June 1986
    Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -127,7 +127,7 @@  cpp_relocated (void)
   if (relocated == -1)
     {
       /* Check if the toolchain was relocated?  */
-      GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
+      gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX");
       if (gcc_exec_prefix)
        relocated = 1;
       else
Index: gcc/sparseset.h
===================================================================
--- gcc/sparseset.h	(revision 167145)
+++ gcc/sparseset.h	(working copy)
@@ -1,5 +1,5 @@ 
 /* SparseSet implementation.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2010 Free Software Foundation, Inc.
    Contributed by Peter Bergner <bergner@vnet.ibm.com>
 
 This file is part of GCC.
@@ -21,8 +21,6 @@  along with GCC; see the file COPYING3.  
 #ifndef GCC_SPARSESET_H
 #define GCC_SPARSESET_H
 
-#include <assert.h>
-
 #define SPARSESET_ELT_BITS ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT)
 #define SPARSESET_ELT_TYPE unsigned int
 
Index: gcc/genhooks.c
===================================================================
--- gcc/genhooks.c	(revision 167145)
+++ gcc/genhooks.c	(working copy)
@@ -19,7 +19,6 @@  along with GCC; see the file COPYING3.  
 <http://www.gnu.org/licenses/>.  */
 #include "bconfig.h"
 #include "system.h"
-#include <string.h>
 #include "hashtab.h"
 #include "errors.h"
 
Index: gcc/ggc-common.c
===================================================================
--- gcc/ggc-common.c	(revision 167145)
+++ gcc/ggc-common.c	(working copy)
@@ -36,22 +36,6 @@  along with GCC; see the file COPYING3.  
 #include "vec.h"
 #include "timevar.h"
 
-#ifdef HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#ifdef HAVE_MMAP_FILE
-# include <sys/mman.h>
-# ifdef HAVE_MINCORE
-/* This is on Solaris.  */
-#  include <sys/types.h>
-# endif
-#endif
-
-#ifndef MAP_FAILED
-# define MAP_FAILED ((void *)-1)
-#endif
-
 /* When set, ggc_collect will do collection.  */
 bool ggc_force_collect;
 
Index: gcc/lto/lto.c
===================================================================
--- gcc/lto/lto.c	(revision 167145)
+++ gcc/lto/lto.c	(working copy)
@@ -26,7 +26,6 @@  along with GCC; see the file COPYING3.  
 #include "tree.h"
 #include "diagnostic-core.h"
 #include "tm.h"
-#include "libiberty.h"
 #include "cgraph.h"
 #include "ggc.h"
 #include "tree-ssa-operands.h"
@@ -46,20 +45,6 @@  along with GCC; see the file COPYING3.  
 #include "splay-tree.h"
 #include "params.h"
 
-/* This needs to be included after config.h.  Otherwise, _GNU_SOURCE will not
-   be defined in time to set __USE_GNU in the system headers, and strsignal
-   will not be declared.  */
-#if HAVE_MMAP_FILE
-#include <sys/mman.h>
-#endif
-
-/* Handle opening elf files on hosts, such as Windows, that may use 
-   text file handling that will break binary access.  */
-
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
 static GTY(()) tree first_personality_decl;
 
 /* Returns a hash code for P.  */
Index: gcc/lto/lto-endian.h
===================================================================
--- gcc/lto/lto-endian.h	(revision 167145)
+++ gcc/lto/lto-endian.h	(working copy)
@@ -1,205 +0,0 @@ 
-/* Very simple endian-ness layer for LTO object file handling
-   Copyright 2010 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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 3, or (at your option) any later
-version.
-
-GCC 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 GCC; see the file COPYING3.  If not see
-<http://www.gnu.org/licenses/>.  */
-
-/* This header file provides a simple way to handle object files in
-   another endian-ness than the host machine.  This is necesarry to
-   enable cross-compilation with LTO enabled.  Targets that use the
-   ELF binary object format do not need this (libelf already handles
-   endian-ness) but for COFF and Mach-O the functions in this header
-   are used in the minimal binary object reader/writer.
-   
-   For all functions in this header, the user is responsible for
-   making sure that the memory accesses are valid.  */
-
-#ifndef GCC_LTO_ENDIAN_H
-#define GCC_LTO_ENDIAN_H
-
-#include <stdint.h>
-#include <inttypes.h>
-
-static inline uint16_t
-get_uint16_le (const unsigned char *ptr)
-{
-  return ptr[0] | (ptr[1] << 8);
-}
-
-static inline uint32_t
-get_uint32_le (const unsigned char *ptr)
-{
-  return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
-}
-
-static inline uint64_t
-get_uint64_le (const unsigned char *ptr_)
-{
-#define ptr (uint64_t) ptr_
-  return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24)
-         | (ptr[4] << 32) | (ptr[5] << 40) | (ptr[6] << 48) | (ptr[7] << 56);
-#undef ptr
-}
-
-static inline uint16_t
-get_uint16_be (const unsigned char *ptr)
-{
-  return ptr[1] | (ptr[2] << 8);
-}
-
-static inline uint32_t
-get_uint32_be (const unsigned char *ptr)
-{
-  return ptr[3] | (ptr[2] << 8) | (ptr[1] << 16) | (ptr[0] << 24);
-}
-
-static inline uint64_t
-get_uint64_be (const unsigned char *ptr_)
-{
-#define ptr (uint64_t) ptr_
-  return ptr[7] | (ptr[6] << 8) | (ptr[5] << 16) | (ptr[4] << 24)
-         | (ptr[3] << 32) | (ptr[2] << 40) | (ptr[1] << 48) | (ptr[0] << 56);
-#undef ptr
-}
-
-static inline void
-put_uint16_le (unsigned char *ptr, uint16_t data)
-{
-  ptr[0] = data & 0xff;
-  ptr[1] = (data >> 8) & 0xff;
-}
-
-static inline void
-put_uint32_le (unsigned char *ptr, uint32_t data)
-{
-  ptr[0] = data & 0xff;
-  ptr[1] = (data >> 8) & 0xff;
-  ptr[2] = (data >> 16) & 0xff;
-  ptr[3] = (data >> 24) & 0xff;
-}
-
-static inline void
-put_uint64_le (unsigned char *ptr, uint64_t data)
-{
-  ptr[0] = data & 0xff;
-  ptr[1] = (data >> 8) & 0xff;
-  ptr[2] = (data >> 16) & 0xff;
-  ptr[3] = (data >> 24) & 0xff;
-  ptr[4] = (data >> 32) & 0xff;
-  ptr[5] = (data >> 40) & 0xff;
-  ptr[6] = (data >> 48) & 0xff;
-  ptr[7] = (data >> 56) & 0xff;
-}
-
-static inline void
-put_uint16_be (unsigned char *ptr, uint16_t data)
-{
-  ptr[1] = data & 0xff;
-  ptr[0] = (data >> 8) & 0xff;
-}
-
-static inline void
-put_uint32_be (unsigned char *ptr, uint32_t data)
-{
-  ptr[3] = data & 0xff;
-  ptr[2] = (data >> 8) & 0xff;
-  ptr[1] = (data >> 16) & 0xff;
-  ptr[0] = (data >> 24) & 0xff;
-}
-
-static inline void
-put_uint64_be (unsigned char *ptr, uint64_t data)
-{
-  ptr[7] = data & 0xff;
-  ptr[6] = (data >> 8) & 0xff;
-  ptr[5] = (data >> 16) & 0xff;
-  ptr[4] = (data >> 24) & 0xff;
-  ptr[3] = (data >> 32) & 0xff;
-  ptr[2] = (data >> 40) & 0xff;
-  ptr[1] = (data >> 48) & 0xff;
-  ptr[0] = (data >> 56) & 0xff;
-}
-
-static inline void
-get_string (unsigned char *ptr, char *dest, size_t len)
-{
-  memcpy (dest, ptr, len);
-}
-
-static inline void
-put_string (unsigned char *ptr, char *src, size_t len)
-{
-  memcpy (ptr, src, len);
-}
-
-/* Use the target macro BYTES_BIG_ENDIAN to choose.  */
-
-static inline uint16_t
-get_uint16 (const unsigned char *ptr)
-{
-  if (BYTES_BIG_ENDIAN)
-    return get_uint16_be (ptr);
-  else
-    return get_uint16_le (ptr);
-}
-
-static inline uint32_t
-get_uint32 (const unsigned char *ptr)
-{
-  if (BYTES_BIG_ENDIAN)
-    return get_uint32_be (ptr);
-  else
-    return get_uint32_le (ptr);
-}
-
-static inline uint64_t
-get_uint64 (const unsigned char *ptr)
-{
-  if (BYTES_BIG_ENDIAN)
-    return get_uint64_be (ptr);
-  else
-    return get_uint64_le (ptr);
-}
-
-static inline void
-put_uint16 (unsigned char *ptr, uint16_t data)
-{
-  if (BYTES_BIG_ENDIAN)
-    put_uint16_be (ptr, data);
-  else
-    put_uint16_le (ptr, data);
-}
-
-static inline void
-put_uint32 (unsigned char *ptr, uint32_t data)
-{
-  if (BYTES_BIG_ENDIAN)
-    put_uint32_be (ptr, data);
-  else
-    put_uint32_le (ptr, data);
-}
-
-static inline void
-put_uint64 (unsigned char *ptr, uint64_t data)
-{
-  if (BYTES_BIG_ENDIAN)
-    put_uint64_be (ptr, data);
-  else
-    put_uint64_le (ptr, data);
-}
-
-#endif /* GCC_LTO_ENDIAN_H  */
-
Index: gcc/lto/lto-object.c
===================================================================
--- gcc/lto/lto-object.c	(revision 167145)
+++ gcc/lto/lto-object.c	(working copy)
@@ -26,15 +26,8 @@  along with GCC; see the file COPYING3.  
 #include "lto.h"
 #include "tm.h"
 #include "lto-streamer.h"
-#include "libiberty.h"
 #include "simple-object.h"
 
-/* Handle opening elf files on hosts, such as Windows, that may use
-   text file handling that will break binary access.  */
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
 /* Segment name for LTO sections.  This is only used for Mach-O.
    FIXME: This needs to be kept in sync with darwin.c.  */
 
Index: gcc/tree-mudflap.c
===================================================================
--- gcc/tree-mudflap.c	(revision 167145)
+++ gcc/tree-mudflap.c	(working copy)
@@ -39,7 +39,7 @@  along with GCC; see the file COPYING3.  
 #include "tree-pass.h"
 #include "hashtab.h"
 #include "diagnostic.h"
-#include <demangle.h>
+#include "demangle.h"
 #include "langhooks.h"
 #include "ggc.h"
 #include "cgraph.h"
Index: gcc/ggc-zone.c
===================================================================
--- gcc/ggc-zone.c	(revision 167145)
+++ gcc/ggc-zone.c	(working copy)
@@ -43,22 +43,10 @@  along with GCC; see the file COPYING3.  
    file open.  Prefer either to valloc.  */
 #ifdef HAVE_MMAP_ANON
 # undef HAVE_MMAP_DEV_ZERO
-
-# include <sys/mman.h>
-# ifndef MAP_FAILED
-#  define MAP_FAILED -1
-# endif
-# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
-#  define MAP_ANONYMOUS MAP_ANON
-# endif
 # define USING_MMAP
 #endif
 
 #ifdef HAVE_MMAP_DEV_ZERO
-# include <sys/mman.h>
-# ifndef MAP_FAILED
-#  define MAP_FAILED -1
-# endif
 # define USING_MMAP
 #endif
 
Index: gcc/ggc-page.c
===================================================================
--- gcc/ggc-page.c	(revision 167145)
+++ gcc/ggc-page.c	(working copy)
@@ -40,26 +40,11 @@  along with GCC; see the file COPYING3.  
    file open.  Prefer either to valloc.  */
 #ifdef HAVE_MMAP_ANON
 # undef HAVE_MMAP_DEV_ZERO
-
-# include <sys/mman.h>
-# ifndef MAP_FAILED
-#  define MAP_FAILED -1
-# endif
-# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
-#  define MAP_ANONYMOUS MAP_ANON
-# endif
 # define USING_MMAP
-
 #endif
 
 #ifdef HAVE_MMAP_DEV_ZERO
-
-# include <sys/mman.h>
-# ifndef MAP_FAILED
-#  define MAP_FAILED -1
-# endif
 # define USING_MMAP
-
 #endif
 
 #ifndef USING_MMAP
Index: gcc/collect2-aix.c
===================================================================
--- gcc/collect2-aix.c	(revision 167145)
+++ gcc/collect2-aix.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* AIX cross support for collect2.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -25,8 +25,6 @@  along with GCC; see the file COPYING3.  
 
 #ifdef CROSS_AIX_SUPPORT
 
-#include <sys/mman.h>
-
 /* Read SIZE bytes starting at DATA as a big-endian value.  */
 
 static inline bfd_vma
Index: gcc/system.h
===================================================================
--- gcc/system.h	(revision 167145)
+++ gcc/system.h	(working copy)
@@ -180,7 +180,7 @@  extern int fprintf_unlocked (FILE *, con
 /* There are an extraordinary number of issues with <ctype.h>.
    The last straw is that it varies with the locale.  Use libiberty's
    replacement instead.  */
-#include <safe-ctype.h>
+#include "safe-ctype.h"
 
 #include <sys/types.h>
 
@@ -314,6 +314,9 @@  extern int errno;
 #ifndef O_WRONLY
 # define O_WRONLY 1
 #endif
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
 
 /* Some systems define these in, e.g., param.h.  We undefine these names
    here to avoid the warnings.  We prefer to use our definitions since we
@@ -353,6 +356,31 @@  extern int errno;
 #define WCOREFLG 0200
 #endif
 
+#include <signal.h>
+#if !defined (SIGCHLD) && defined (SIGCLD)
+# define SIGCHLD SIGCLD
+#endif
+
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
+
+#ifndef MAP_FAILED
+# define MAP_FAILED ((void *)-1)
+#endif
+
+#if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
+# define MAP_ANONYMOUS MAP_ANON
+#endif
+
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#ifdef HAVE_SYS_TIMES_H
+# include <sys/times.h>
+#endif
+
 /* The HAVE_DECL_* macros are three-state, undefined, 0 or 1.  If they
    are defined to 0 then we must provide the relevant declaration
    here.  These checks will be in the undefined state while configure
@@ -526,6 +554,10 @@  extern int vsnprintf(char *, size_t, con
 # define mkdir(a,b) mkdir(a)
 #endif
 
+#ifndef HAVE_KILL
+# define kill(p,s) raise(s)
+#endif
+
 /* Provide a way to print an address via printf.  */
 #ifndef HOST_PTR_PRINTF
 #define HOST_PTR_PRINTF "%p"
@@ -804,7 +836,7 @@  extern void fancy_abort (const char *, i
    LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
 
 /* Miscellaneous macros that are no longer used.  */
- #pragma GCC poison USE_MAPPED_LOCATION
+ #pragma GCC poison USE_MAPPED_LOCATION GET_ENVIRONMENT
 
 /* Libiberty macros that are no longer used in GCC.  */
 #undef ANSI_PROTOTYPES
Index: gcc/tlink.c
===================================================================
--- gcc/tlink.c	(revision 167145)
+++ gcc/tlink.c	(working copy)
@@ -1,8 +1,8 @@ 
 /* Scan linker error messages for missing template instantiations and provide
    them.
 
-   Copyright (C) 1995, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008
-   Free Software Foundation, Inc.
+   Copyright (C) 1995, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008,
+   2009, 2010 Free Software Foundation, Inc.
    Contributed by Jason Merrill (jason@cygnus.com).
 
 This file is part of GCC.
@@ -30,7 +30,6 @@  along with GCC; see the file COPYING3.  
 #include "hashtab.h"
 #include "demangle.h"
 #include "collect2.h"
-#include "libiberty.h"
 
 /* TARGET_64BIT may be defined to use driver specific functionality. */
 #undef TARGET_64BIT
Index: gcc/tree-switch-conversion.c
===================================================================
--- gcc/tree-switch-conversion.c	(revision 167145)
+++ gcc/tree-switch-conversion.c	(working copy)
@@ -80,8 +80,6 @@  eight) times the number of the actual sw
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include <signal.h>
-
 #include "line-map.h"
 #include "params.h"
 #include "flags.h"
Index: gcc/passes.c
===================================================================
--- gcc/passes.c	(revision 167145)
+++ gcc/passes.c	(working copy)
@@ -28,16 +28,6 @@  along with GCC; see the file COPYING3.  
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include <signal.h>
-
-#ifdef HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#ifdef HAVE_SYS_TIMES_H
-# include <sys/times.h>
-#endif
-
 #include "line-map.h"
 #include "input.h"
 #include "tree.h"
Index: gcc/config/host-hpux.c
===================================================================
--- gcc/config/host-hpux.c	(revision 167145)
+++ gcc/config/host-hpux.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* HP-UX host-specific hook definitions.
-   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007, 2010 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -20,15 +20,9 @@ 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <sys/mman.h>
-#include <unistd.h>
 #include "hosthooks.h"
 #include "hosthooks-def.h"
 
-#ifndef MAP_FAILED
-#define MAP_FAILED (void *)-1L
-#endif
-
 static void *hpux_gt_pch_get_address (size_t, int);
 static int hpux_gt_pch_use_address (void *, size_t, int, size_t);
 
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	(revision 167145)
+++ gcc/config/alpha/alpha.c	(working copy)
@@ -50,7 +50,7 @@  along with GCC; see the file COPYING3.  
 #include "target-def.h"
 #include "debug.h"
 #include "langhooks.h"
-#include <splay-tree.h>
+#include "splay-tree.h"
 #include "cfglayout.h"
 #include "gimple.h"
 #include "tree-flow.h"
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c	(revision 167145)
+++ gcc/config/frv/frv.c	(working copy)
@@ -44,7 +44,6 @@  along with GCC; see the file COPYING3.  
 #include "basic-block.h"
 #include "tm_p.h"
 #include "ggc.h"
-#include <ctype.h>
 #include "target.h"
 #include "target-def.h"
 #include "targhooks.h"
Index: gcc/config/m32c/m32c-pragma.c
===================================================================
--- gcc/config/m32c/m32c-pragma.c	(revision 167145)
+++ gcc/config/m32c/m32c-pragma.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* M32C Pragma support
-   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc.
    Contributed by Red Hat, Inc.
 
    This file is part of GCC.
@@ -18,7 +18,6 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stdio.h>
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
Index: gcc/config/mep/mep-pragma.c
===================================================================
--- gcc/config/mep/mep-pragma.c	(revision 167145)
+++ gcc/config/mep/mep-pragma.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* Definitions of Toshiba Media Processor
-   Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free
+   Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010 Free
    Software Foundation, Inc.  Contributed by Red Hat, Inc.
 
 This file is part of GCC.
@@ -18,7 +18,6 @@  You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#include <stdio.h>
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
Index: gcc/config/i386/cygming.h
===================================================================
--- gcc/config/i386/cygming.h	(revision 167145)
+++ gcc/config/i386/cygming.h	(working copy)
@@ -118,8 +118,6 @@  along with GCC; see the file COPYING3.  
 
 #define TARGET_EXECUTABLE_SUFFIX ".exe"
 
-#include <stdio.h>
-
 #define TARGET_OS_CPP_BUILTINS()					\
   do									\
     {									\
Index: gcc/config/i386/host-cygwin.c
===================================================================
--- gcc/config/i386/host-cygwin.c	(revision 167145)
+++ gcc/config/i386/host-cygwin.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* Cygwin host-specific hook definitions.
- Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc.
 
  This file is part of GCC.
 
@@ -20,7 +20,6 @@ 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <sys/mman.h>
 #include "hosthooks.h"
 #include "hosthooks-def.h"
 #include "toplev.h"
Index: gcc/config/i386/driver-i386.c
===================================================================
--- gcc/config/i386/driver-i386.c	(revision 167145)
+++ gcc/config/i386/driver-i386.c	(working copy)
@@ -21,7 +21,6 @@  along with GCC; see the file COPYING3.  
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include <stdlib.h>
 
 const char *host_detect_local_cpu (int argc, const char **argv);
 
Index: gcc/config/microblaze/microblaze.c
===================================================================
--- gcc/config/microblaze/microblaze.c	(revision 167145)
+++ gcc/config/microblaze/microblaze.c	(working copy)
@@ -22,7 +22,6 @@ 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <signal.h>
 #include "tm.h"
 #include "rtl.h"
 #include "regs.h"
Index: gcc/config/avr/driver-avr.c
===================================================================
--- gcc/config/avr/driver-avr.c	(revision 167145)
+++ gcc/config/avr/driver-avr.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* Subroutines for the gcc driver.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
    Contributed by Anatoly Sokolov <aesok@post.ru>
 
 This file is part of GCC.
@@ -22,7 +22,6 @@  along with GCC; see the file COPYING3.  
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include <stdlib.h>
 
 /* Current architecture.  */
 const struct base_arch_s *avr_current_arch = NULL;
Index: gcc/config/host-solaris.c
===================================================================
--- gcc/config/host-solaris.c	(revision 167145)
+++ gcc/config/host-solaris.c	(working copy)
@@ -20,7 +20,6 @@ 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <sys/mman.h>
 #include "hosthooks.h"
 #include "hosthooks-def.h"
 
Index: gcc/config/m68hc11/m68hc11.c
===================================================================
--- gcc/config/m68hc11/m68hc11.c	(revision 167145)
+++ gcc/config/m68hc11/m68hc11.c	(working copy)
@@ -32,7 +32,6 @@  Note:
 
 */
 
-#include <stdio.h>
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
Index: gcc/config/host-linux.c
===================================================================
--- gcc/config/host-linux.c	(revision 167145)
+++ gcc/config/host-linux.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* Linux host-specific hook definitions.
-   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007, 2008, 2010 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -20,8 +20,6 @@ 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <sys/mman.h>
-#include <limits.h>
 #include "hosthooks.h"
 #include "hosthooks-def.h"
 
Index: gcc/config/iq2000/iq2000.c
===================================================================
--- gcc/config/iq2000/iq2000.c	(revision 167145)
+++ gcc/config/iq2000/iq2000.c	(working copy)
@@ -21,7 +21,6 @@  along with GCC; see the file COPYING3.  
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <signal.h>
 #include "tm.h"
 #include "tree.h"
 #include "rtl.h"
Index: gcc/config/host-darwin.c
===================================================================
--- gcc/config/host-darwin.c	(revision 167145)
+++ gcc/config/host-darwin.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* Darwin host-specific hook definitions.
-   Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2007, 2010 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -20,7 +20,6 @@ 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <sys/mman.h>
 #include "diagnostic-core.h"
 #include "toplev.h"
 #include "config/host-darwin.h"
Index: gcc/config/rs6000/host-darwin.c
===================================================================
--- gcc/config/rs6000/host-darwin.c	(revision 167145)
+++ gcc/config/rs6000/host-darwin.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* Darwin/powerpc host-specific hook definitions.
-   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -21,7 +21,6 @@ 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <signal.h>
 #include <sys/ucontext.h>
 #include "hosthooks.h"
 #include "hosthooks-def.h"
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	(revision 167145)
+++ gcc/config/arm/arm.c	(working copy)
@@ -1352,7 +1352,7 @@  arm_target_help (void)
     {
       const char *p;
 
-      GET_ENVIRONMENT (p, "COLUMNS");
+      p = getenv ("COLUMNS");
       if (p != NULL)
 	{
 	  int value = atoi (p);
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	(revision 167145)
+++ gcc/config/mips/mips.c	(working copy)
@@ -27,7 +27,6 @@  along with GCC; see the file COPYING3.  
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include <signal.h>
 #include "rtl.h"
 #include "regs.h"
 #include "hard-reg-set.h"
Index: gcc/collect2.c
===================================================================
--- gcc/collect2.c	(revision 167145)
+++ gcc/collect2.c	(working copy)
@@ -30,10 +30,6 @@  along with GCC; see the file COPYING3.  
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include <signal.h>
-#if ! defined( SIGCHLD ) && defined( SIGCLD )
-#  define SIGCHLD SIGCLD
-#endif
 
 /* TARGET_64BIT may be defined to use driver specific functionality. */
 #undef TARGET_64BIT
@@ -822,7 +818,7 @@  static void
 prefix_from_env (const char *env, struct path_prefix *pprefix)
 {
   const char *p;
-  GET_ENVIRONMENT (p, env);
+  p = getenv (env);
 
   if (p)
     prefix_from_string (p, pprefix);