Commit 29382d66 by Jeff Law

pexecute.c: Updates from gcc.

        * pexecute.c: Updates from gcc.  Copy in gcc has been removed.  This
        is the canonical copy.  Define ISSPACE if !IN_GCC.
        * alloca.c, vfprintf.c: Similarly.

From-SVN: r22249
parent 39802f41
...@@ -22,10 +22,26 @@ ...@@ -22,10 +22,26 @@
your main control loop, etc. to force garbage collection. */ your main control loop, etc. to force garbage collection. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include <config.h>
#endif #endif
/* If compiling with GCC, this file's not needed. */ #ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef emacs
#include "blockinput.h"
#endif
/* If compiling with GCC 2, this file's not needed. Except of course if
the C alloca is explicitly requested. */
#if defined (USE_C_ALLOCA) || !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
#ifndef alloca #ifndef alloca
#ifdef emacs #ifdef emacs
...@@ -53,11 +69,9 @@ long i00afunc (); ...@@ -53,11 +69,9 @@ long i00afunc ();
#endif #endif
#if __STDC__ #if __STDC__
#include <stddef.h>
typedef void *pointer; typedef void *pointer;
#else #else
typedef char *pointer; typedef char *pointer;
typedef unsigned size_t;
#endif #endif
#ifndef NULL #ifndef NULL
...@@ -76,8 +90,8 @@ typedef unsigned size_t; ...@@ -76,8 +90,8 @@ typedef unsigned size_t;
#ifndef emacs #ifndef emacs
#define malloc xmalloc #define malloc xmalloc
extern pointer xmalloc ();
#endif #endif
extern pointer malloc ();
/* Define STACK_DIRECTION if you know the direction of stack /* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically growth for your system; otherwise it will be automatically
...@@ -156,7 +170,7 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */ ...@@ -156,7 +170,7 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
pointer pointer
alloca (size) alloca (size)
size_t size; unsigned size;
{ {
auto char probe; /* Probes stack depth: */ auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe); register char *depth = ADDRESS_FUNCTION (probe);
...@@ -167,11 +181,15 @@ alloca (size) ...@@ -167,11 +181,15 @@ alloca (size)
#endif #endif
/* Reclaim garbage, defined as all alloca'd storage that /* Reclaim garbage, defined as all alloca'd storage that
was allocated from deeper in the stack than currently. */ was allocated from deeper in the stack than currently. */
{ {
register header *hp; /* Traverses linked list. */ register header *hp; /* Traverses linked list. */
#ifdef emacs
BLOCK_INPUT;
#endif
for (hp = last_alloca_header; hp != NULL;) for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth) if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth)) || (STACK_DIR < 0 && hp->h.deep < depth))
...@@ -186,6 +204,10 @@ alloca (size) ...@@ -186,6 +204,10 @@ alloca (size)
break; /* Rest are not deeper. */ break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */ last_alloca_header = hp; /* -> last valid storage. */
#ifdef emacs
UNBLOCK_INPUT;
#endif
} }
if (size == 0) if (size == 0)
...@@ -197,6 +219,9 @@ alloca (size) ...@@ -197,6 +219,9 @@ alloca (size)
register pointer new = malloc (sizeof (header) + size); register pointer new = malloc (sizeof (header) + size);
/* Address of header. */ /* Address of header. */
if (new == 0)
abort();
((header *) new)->h.next = last_alloca_header; ((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth; ((header *) new)->h.deep = depth;
...@@ -326,7 +351,7 @@ struct stk_trailer ...@@ -326,7 +351,7 @@ struct stk_trailer
#ifdef CRAY2 #ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS. /* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */ I doubt that "lint" will like this much. */
static long static long
i00afunc (long *address) i00afunc (long *address)
...@@ -477,3 +502,4 @@ i00afunc (long address) ...@@ -477,3 +502,4 @@ i00afunc (long address)
#endif /* CRAY */ #endif /* CRAY */
#endif /* no alloca */ #endif /* no alloca */
#endif /* not GCC version 2 */
#include <stdio.h> /* Provide a version vfprintf in terms of _doprnt.
By Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
Copyright (C) 1998 Free Software Foundation, Inc.
*/
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h> #include <varargs.h>
#include <ansidecl.h> #endif
#include <stdio.h>
#undef vfprintf #undef vfprintf
int int
vfprintf (file, format, ap) vfprintf (stream, format, ap)
FILE *file; FILE * stream;
const char *format; const char * format;
va_list ap; va_list ap;
{ {
return _doprnt (format, ap, file); return _doprnt (format, ap, stream);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment