diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-01-17 21:30:39 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-01-17 21:30:39 +0000 |
commit | 113f026687f3eca824ba7d87ad6ceaf27d4f463a (patch) | |
tree | 3fb1bcc713bf0b50a9443986aa474ff823b51ca8 /libiberty/xmalloc.c | |
parent | 3fd975cfea9517665009a0b1d474c2d8e7de3fff (diff) | |
download | gcc-113f026687f3eca824ba7d87ad6ceaf27d4f463a.tar.gz |
Add mingw32 support.
* pexecute.c (pexecute): New function for mingw32. Supports pipes.
(pwait): New function for mingw32.
* config.table (i[3456]86-*-mingw32*): Support for i386-mingw32.
* config/mt-mingw32: New file.
* xmalloc.c (first_break): Not used for mingw32.
(xmalloc_set_program_name): Don't use sbrk on mingw32.
(xmalloc): Likewise.
(xrealloc): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@17395 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/xmalloc.c')
-rw-r--r-- | libiberty/xmalloc.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c index c479b1f9e95..b88105a9b74 100644 --- a/libiberty/xmalloc.c +++ b/libiberty/xmalloc.c @@ -42,16 +42,22 @@ PTR sbrk PARAMS ((ptrdiff_t)); /* The program name if set. */ static const char *name = ""; -/* The initial sbrk, set when the program name is set. */ +#if ! defined (_WIN32) || defined (__CYGWIN32__) +/* The initial sbrk, set when the program name is set. Not used for win32 + ports other than cygwin32. */ static char *first_break = NULL; +#endif void xmalloc_set_program_name (s) const char *s; { name = s; +#if ! defined (_WIN32) || defined (__CYGWIN32__) + /* Win32 ports other than cygwin32 don't have brk() */ if (first_break == NULL) first_break = (char *) sbrk (0); +#endif /* ! _WIN32 || __CYGWIN32 __ */ } PTR @@ -65,6 +71,7 @@ xmalloc (size) newmem = malloc (size); if (!newmem) { +#if ! defined (_WIN32) || defined (__CYGWIN32__) extern char **environ; size_t allocated; @@ -76,6 +83,12 @@ xmalloc (size) "\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) size, (unsigned long) allocated); +#else + fprintf (stderr, + "\n%s%sCan not allocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* ! _WIN32 || __CYGWIN32 __ */ xexit (1); } return (newmem); @@ -96,6 +109,7 @@ xrealloc (oldmem, size) newmem = realloc (oldmem, size); if (!newmem) { +#ifndef __MINGW32__ extern char **environ; size_t allocated; @@ -107,6 +121,12 @@ xrealloc (oldmem, size) "\n%s%sCan not reallocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) size, (unsigned long) allocated); +#else + fprintf (stderr, + "\n%s%sCan not reallocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* __MINGW32__ */ xexit (1); } return (newmem); |