Virgin import from GCC 2.95.1.
As of GCC 2.95 these files: choose-temp.c demangle.h getopt.h obstack.c pexecute.c cplus-dem.c getopt.c getopt1.c obstack.h were removed from the GCC compilers proper to libiberty. To continue our revision history, and to keep from having to import all of libiberty, they are imported here as if they were never moved.
This commit is contained in:
parent
4b66dfb903
commit
a2002c935c
@ -22,22 +22,19 @@ Boston, MA 02111-1307, USA. */
|
||||
/* This file lives in at least two places: libiberty and gcc.
|
||||
Don't change one without the other. */
|
||||
|
||||
#if defined (IN_GCC) || defined (HAVE_CONFIG_H)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef IN_GCC
|
||||
#include "system.h"
|
||||
#else
|
||||
|
||||
/* If we are in gcc, system.h has handled everything. When not in
|
||||
gcc, if we have a config.h we assume that HAVE_SYS_FILE_H tells us
|
||||
whether to include sys/file.h. However, libiberty does not have a
|
||||
config.h, and instead arranges to define NO_SYS_FILE_H on the
|
||||
command line when there is no sys/file.h. */
|
||||
|
||||
#if defined (HAVE_CONFIG_H) ? defined (HAVE_SYS_FILE_H) : ! defined (NO_SYS_FILE_H)
|
||||
#include <stdio.h> /* May get P_tmpdir. */
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h> /* May get R_OK, etc. on some systems. */
|
||||
#endif
|
||||
|
||||
@ -47,16 +44,11 @@ Boston, MA 02111-1307, USA. */
|
||||
#define X_OK 1
|
||||
#endif
|
||||
|
||||
#include <stdio.h> /* May get P_tmpdir. */
|
||||
#endif /* IN_GCC */
|
||||
|
||||
#ifdef IN_GCC
|
||||
#include "gansidecl.h"
|
||||
extern char *xmalloc ();
|
||||
#else
|
||||
#include "ansidecl.h"
|
||||
#include "libiberty.h"
|
||||
#if defined (__MSDOS__) || defined (_WIN32)
|
||||
extern int mkstemps ();
|
||||
|
||||
#ifndef IN_GCC
|
||||
#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN))
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#endif
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,12 +20,7 @@
|
||||
#if !defined (DEMANGLE_H)
|
||||
#define DEMANGLE_H
|
||||
|
||||
#ifdef IN_GCC
|
||||
#include "gansidecl.h"
|
||||
#define PARAMS(ARGS) PROTO(ARGS)
|
||||
#else /* ! IN_GCC */
|
||||
#include <ansidecl.h>
|
||||
#endif /* IN_GCC */
|
||||
|
||||
/* Options passed to cplus_demangle (in 2nd parameter). */
|
||||
|
||||
@ -38,8 +33,12 @@
|
||||
#define DMGL_GNU (1 << 9)
|
||||
#define DMGL_LUCID (1 << 10)
|
||||
#define DMGL_ARM (1 << 11)
|
||||
#define DMGL_HP (1 << 12) /* For the HP aCC compiler; same as ARM
|
||||
except for template arguments, etc. */
|
||||
#define DMGL_EDG (1 << 13)
|
||||
|
||||
/* If none of these are set, use 'current_demangling_style' as the default. */
|
||||
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM)
|
||||
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG)
|
||||
|
||||
/* Enumeration of possible demangling styles.
|
||||
|
||||
@ -55,7 +54,9 @@ extern enum demangling_styles
|
||||
auto_demangling = DMGL_AUTO,
|
||||
gnu_demangling = DMGL_GNU,
|
||||
lucid_demangling = DMGL_LUCID,
|
||||
arm_demangling = DMGL_ARM
|
||||
arm_demangling = DMGL_ARM,
|
||||
hp_demangling = DMGL_HP,
|
||||
edg_demangling = DMGL_EDG
|
||||
} current_demangling_style;
|
||||
|
||||
/* Define string names for the various demangling styles. */
|
||||
@ -64,6 +65,8 @@ extern enum demangling_styles
|
||||
#define GNU_DEMANGLING_STYLE_STRING "gnu"
|
||||
#define LUCID_DEMANGLING_STYLE_STRING "lucid"
|
||||
#define ARM_DEMANGLING_STYLE_STRING "arm"
|
||||
#define HP_DEMANGLING_STYLE_STRING "hp"
|
||||
#define EDG_DEMANGLING_STYLE_STRING "edg"
|
||||
|
||||
/* Some macros to test what demangling style is active. */
|
||||
|
||||
@ -71,7 +74,9 @@ extern enum demangling_styles
|
||||
#define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO)
|
||||
#define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU)
|
||||
#define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID)
|
||||
#define ARM_DEMANGLING (CURRENT_DEMANGLING_STYLE & DMGL_ARM)
|
||||
#define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM)
|
||||
#define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP)
|
||||
#define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG)
|
||||
|
||||
extern char *
|
||||
cplus_demangle PARAMS ((const char *mangled, int options));
|
||||
@ -87,22 +92,4 @@ cplus_mangle_opname PARAMS ((const char *opname, int options));
|
||||
extern void
|
||||
set_cplus_marker_for_demangling PARAMS ((int ch));
|
||||
|
||||
extern void
|
||||
do_tlink PARAMS ((char **, char **));
|
||||
|
||||
extern void
|
||||
collect_execute PARAMS ((char *, char **, char *));
|
||||
|
||||
extern void
|
||||
collect_exit PARAMS ((int));
|
||||
|
||||
extern int
|
||||
collect_wait PARAMS ((char *));
|
||||
|
||||
extern void
|
||||
dump_file PARAMS ((char *));
|
||||
|
||||
extern int
|
||||
file_exists PARAMS ((char *));
|
||||
|
||||
#endif /* DEMANGLE_H */
|
||||
|
@ -204,7 +204,9 @@ static char *posixly_correct;
|
||||
# if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# else
|
||||
# include <strings.h>
|
||||
# if HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Avoid depending on library functions or files
|
||||
|
@ -23,23 +23,34 @@ Boston, MA 02111-1307, USA. */
|
||||
/* This file lives in at least two places: libiberty and gcc.
|
||||
Don't change one without the other. */
|
||||
|
||||
#ifdef IN_GCC
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#ifdef IN_GCC
|
||||
#include "gansidecl.h"
|
||||
/* ??? Need to find a suitable header file. */
|
||||
#define PEXECUTE_FIRST 1
|
||||
#define PEXECUTE_LAST 2
|
||||
#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST)
|
||||
#define PEXECUTE_SEARCH 4
|
||||
#define PEXECUTE_VERBOSE 8
|
||||
#else
|
||||
#include "libiberty.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#define ISSPACE (x) isspace(x)
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef vfork /* Autoconf may define this to fork for us. */
|
||||
# define VFORK_STRING "fork"
|
||||
#else
|
||||
# define VFORK_STRING "vfork"
|
||||
#endif
|
||||
#ifdef HAVE_VFORK_H
|
||||
#include <vfork.h>
|
||||
#endif
|
||||
#ifdef VMS
|
||||
#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \
|
||||
lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1)
|
||||
#endif /* VMS */
|
||||
|
||||
#include "libiberty.h"
|
||||
|
||||
/* stdin file number. */
|
||||
#define STDIN_FILE_NO 0
|
||||
@ -219,53 +230,18 @@ pwait (pid, status, flags)
|
||||
|
||||
#endif /* MSDOS */
|
||||
|
||||
#if defined (_WIN32)
|
||||
#if defined (_WIN32) && ! defined (_UWIN)
|
||||
|
||||
#include <process.h>
|
||||
|
||||
#ifdef __CYGWIN32__
|
||||
#ifdef __CYGWIN__
|
||||
|
||||
#define fix_argv(argvec) (argvec)
|
||||
|
||||
extern int _spawnv ();
|
||||
extern int _spawnvp ();
|
||||
|
||||
int
|
||||
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||
const char *program;
|
||||
char * const *argv;
|
||||
const char *this_pname;
|
||||
const char *temp_base;
|
||||
char **errmsg_fmt, **errmsg_arg;
|
||||
int flags;
|
||||
{
|
||||
int pid;
|
||||
|
||||
if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
|
||||
abort ();
|
||||
pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
|
||||
(_P_NOWAIT, program, fix_argv(argv));
|
||||
if (pid == -1)
|
||||
{
|
||||
*errmsg_fmt = install_error_msg;
|
||||
*errmsg_arg = program;
|
||||
return -1;
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
|
||||
int
|
||||
pwait (pid, status, flags)
|
||||
int pid;
|
||||
int *status;
|
||||
int flags;
|
||||
{
|
||||
/* ??? Here's an opportunity to canonicalize the values in STATUS.
|
||||
Needed? */
|
||||
return cwait (status, pid, WAIT_CHILD);
|
||||
}
|
||||
|
||||
#else /* ! __CYGWIN32__ */
|
||||
#else /* ! __CYGWIN__ */
|
||||
|
||||
/* This is a kludge to get around the Microsoft C spawn functions' propensity
|
||||
to remove the outermost set of double quotes from all arguments. */
|
||||
@ -303,6 +279,7 @@ fix_argv (argvec)
|
||||
|
||||
return (const char * const *) argvec;
|
||||
}
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
@ -419,6 +396,9 @@ pwait (pid, status, flags)
|
||||
int *status;
|
||||
int flags;
|
||||
{
|
||||
#ifdef __CYGWIN__
|
||||
return wait (status);
|
||||
#else
|
||||
int termstat;
|
||||
|
||||
pid = _cwait (&termstat, pid, WAIT_CHILD);
|
||||
@ -436,11 +416,10 @@ pwait (pid, status, flags)
|
||||
*status = (((termstat) & 0xff) << 8);
|
||||
|
||||
return pid;
|
||||
#endif /* __CYGWIN__ */
|
||||
}
|
||||
|
||||
#endif /* ! defined (__CYGWIN32__) */
|
||||
|
||||
#endif /* _WIN32 */
|
||||
#endif /* _WIN32 && ! _UWIN */
|
||||
|
||||
#ifdef OS2
|
||||
|
||||
@ -623,22 +602,10 @@ pfinish ()
|
||||
|
||||
/* include for Unix-like environments but not for Dos-like environments */
|
||||
#if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \
|
||||
&& ! defined (_WIN32)
|
||||
|
||||
#ifdef VMS
|
||||
#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \
|
||||
lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1)
|
||||
#else
|
||||
#ifdef USG
|
||||
#define vfork fork
|
||||
#endif
|
||||
#endif
|
||||
&& ! (defined (_WIN32) && ! defined (_UWIN))
|
||||
|
||||
extern int execv ();
|
||||
extern int execvp ();
|
||||
#ifdef IN_GCC
|
||||
extern char * my_strerror PROTO ((int));
|
||||
#endif
|
||||
|
||||
int
|
||||
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||
@ -700,11 +667,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||
{
|
||||
case -1:
|
||||
{
|
||||
#ifdef vfork
|
||||
*errmsg_fmt = "fork";
|
||||
#else
|
||||
*errmsg_fmt = "vfork";
|
||||
#endif
|
||||
*errmsg_fmt = VFORK_STRING;
|
||||
*errmsg_arg = NULL;
|
||||
return -1;
|
||||
}
|
||||
@ -734,11 +697,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||
/* Note: Calling fprintf and exit here doesn't seem right for vfork. */
|
||||
fprintf (stderr, "%s: ", this_pname);
|
||||
fprintf (stderr, install_error_msg, program);
|
||||
#ifdef IN_GCC
|
||||
fprintf (stderr, ": %s\n", my_strerror (errno));
|
||||
#else
|
||||
fprintf (stderr, ": %s\n", xstrerror (errno));
|
||||
#endif
|
||||
exit (-1);
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
@ -772,4 +731,4 @@ pwait (pid, status, flags)
|
||||
return pid;
|
||||
}
|
||||
|
||||
#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! _WIN32 */
|
||||
#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! (_WIN32 && ! _UWIN) */
|
||||
|
Loading…
Reference in New Issue
Block a user