forked from KolibriOS/kolibrios
sdk: C++ exeptions support
git-svn-id: svn://kolibrios.org@5963 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -7,17 +7,20 @@ CPP= kos32-g++
|
||||
STRIP = kos32-strip
|
||||
|
||||
CFLAGS = -U_Win32 -U_WIN32 -U__MINGW32__ -c -O2 -fno-ident -fomit-frame-pointer
|
||||
CPPFLAGS = -fno-rtti
|
||||
|
||||
ARFLAGS= crs
|
||||
|
||||
INCLUDES= -I. -I../../newlib/libc/include
|
||||
INCLUDES= -I. -I../include/mingw32 -I../include -I../../newlib/libc/include -I/d/mingw/include
|
||||
|
||||
LIBS:= -ldll -lc.dll
|
||||
|
||||
DEFINES= -DHAVE_CONFIG_H -DIN_GCC -DUSE_EMUTLS=1 -D_GLIBCXX_HAVE_TLS
|
||||
DEFINES= -DHAVE_CONFIG_H -DIN_GCC -DIN_GLIBCPP_V3 -DUSE_EMUTLS=1 -D_GLIBCXX_HAVE_TLS
|
||||
|
||||
|
||||
SOURCES = gthr_mutex.c \
|
||||
SOURCES = \
|
||||
cp-demangle.c \
|
||||
gthr_mutex.c \
|
||||
array_type_info.cc \
|
||||
atexit_thread.cc \
|
||||
bad_alloc.cc \
|
||||
@@ -81,22 +84,22 @@ $(LIBRARY).a: $(OBJECTS) Makefile
|
||||
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
|
||||
%.o : %.cc Makefile
|
||||
$(CPP) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
$(CPP) $(CFLAGS) $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
|
||||
eh_ptr.o: eh_ptr.cc
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
|
||||
eh_throw.o: eh_throw.cc
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
|
||||
guard.o: guard.cc
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
|
||||
atexit_thread.o: atexit_thread.cc
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
|
||||
nested_exception.o: nested_exception.cc
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
||||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
|
1200
contrib/sdk/sources/libstdc++-v3/libsupc++/config.h
Normal file
1200
contrib/sdk/sources/libstdc++-v3/libsupc++/config.h
Normal file
File diff suppressed because it is too large
Load Diff
169
contrib/sdk/sources/libstdc++-v3/libsupc++/cp-demangle.h
Normal file
169
contrib/sdk/sources/libstdc++-v3/libsupc++/cp-demangle.h
Normal file
@@ -0,0 +1,169 @@
|
||||
/* Internal demangler interface for g++ V3 ABI.
|
||||
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010
|
||||
Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor <ian@wasabisystems.com>.
|
||||
|
||||
This file is part of the libiberty library, which is part of GCC.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
In addition to the permissions in the GNU General Public License, the
|
||||
Free Software Foundation gives you unlimited permission to link the
|
||||
compiled version of this file into combinations with other programs,
|
||||
and to distribute those combinations without any restriction coming
|
||||
from the use of this file. (The General Public License restrictions
|
||||
do apply in other respects; for example, they cover modification of
|
||||
the file, and distribution when not linked into a combined
|
||||
executable.)
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* This file provides some definitions shared by cp-demangle.c and
|
||||
cp-demint.c. It should not be included by any other files. */
|
||||
|
||||
/* Information we keep for operators. */
|
||||
|
||||
struct demangle_operator_info
|
||||
{
|
||||
/* Mangled name. */
|
||||
const char *code;
|
||||
/* Real name. */
|
||||
const char *name;
|
||||
/* Length of real name. */
|
||||
int len;
|
||||
/* Number of arguments. */
|
||||
int args;
|
||||
};
|
||||
|
||||
/* How to print the value of a builtin type. */
|
||||
|
||||
enum d_builtin_type_print
|
||||
{
|
||||
/* Print as (type)val. */
|
||||
D_PRINT_DEFAULT,
|
||||
/* Print as integer. */
|
||||
D_PRINT_INT,
|
||||
/* Print as unsigned integer, with trailing "u". */
|
||||
D_PRINT_UNSIGNED,
|
||||
/* Print as long, with trailing "l". */
|
||||
D_PRINT_LONG,
|
||||
/* Print as unsigned long, with trailing "ul". */
|
||||
D_PRINT_UNSIGNED_LONG,
|
||||
/* Print as long long, with trailing "ll". */
|
||||
D_PRINT_LONG_LONG,
|
||||
/* Print as unsigned long long, with trailing "ull". */
|
||||
D_PRINT_UNSIGNED_LONG_LONG,
|
||||
/* Print as bool. */
|
||||
D_PRINT_BOOL,
|
||||
/* Print as float--put value in square brackets. */
|
||||
D_PRINT_FLOAT,
|
||||
/* Print in usual way, but here to detect void. */
|
||||
D_PRINT_VOID
|
||||
};
|
||||
|
||||
/* Information we keep for a builtin type. */
|
||||
|
||||
struct demangle_builtin_type_info
|
||||
{
|
||||
/* Type name. */
|
||||
const char *name;
|
||||
/* Length of type name. */
|
||||
int len;
|
||||
/* Type name when using Java. */
|
||||
const char *java_name;
|
||||
/* Length of java name. */
|
||||
int java_len;
|
||||
/* How to print a value of this type. */
|
||||
enum d_builtin_type_print print;
|
||||
};
|
||||
|
||||
/* The information structure we pass around. */
|
||||
|
||||
struct d_info
|
||||
{
|
||||
/* The string we are demangling. */
|
||||
const char *s;
|
||||
/* The end of the string we are demangling. */
|
||||
const char *send;
|
||||
/* The options passed to the demangler. */
|
||||
int options;
|
||||
/* The next character in the string to consider. */
|
||||
const char *n;
|
||||
/* The array of components. */
|
||||
struct demangle_component *comps;
|
||||
/* The index of the next available component. */
|
||||
int next_comp;
|
||||
/* The number of available component structures. */
|
||||
int num_comps;
|
||||
/* The array of substitutions. */
|
||||
struct demangle_component **subs;
|
||||
/* The index of the next substitution. */
|
||||
int next_sub;
|
||||
/* The number of available entries in the subs array. */
|
||||
int num_subs;
|
||||
/* The number of substitutions which we actually made from the subs
|
||||
array, plus the number of template parameter references we
|
||||
saw. */
|
||||
int did_subs;
|
||||
/* The last name we saw, for constructors and destructors. */
|
||||
struct demangle_component *last_name;
|
||||
/* A running total of the length of large expansions from the
|
||||
mangled name to the demangled name, such as standard
|
||||
substitutions and builtin types. */
|
||||
int expansion;
|
||||
};
|
||||
|
||||
/* To avoid running past the ending '\0', don't:
|
||||
- call d_peek_next_char if d_peek_char returned '\0'
|
||||
- call d_advance with an 'i' that is too large
|
||||
- call d_check_char(di, '\0')
|
||||
Everything else is safe. */
|
||||
#define d_peek_char(di) (*((di)->n))
|
||||
#define d_peek_next_char(di) ((di)->n[1])
|
||||
#define d_advance(di, i) ((di)->n += (i))
|
||||
#define d_check_char(di, c) (d_peek_char(di) == c ? ((di)->n++, 1) : 0)
|
||||
#define d_next_char(di) (d_peek_char(di) == '\0' ? '\0' : *((di)->n++))
|
||||
#define d_str(di) ((di)->n)
|
||||
|
||||
/* Functions and arrays in cp-demangle.c which are referenced by
|
||||
functions in cp-demint.c. */
|
||||
#ifdef IN_GLIBCPP_V3
|
||||
#define CP_STATIC_IF_GLIBCPP_V3 static
|
||||
#else
|
||||
#define CP_STATIC_IF_GLIBCPP_V3 extern
|
||||
#endif
|
||||
|
||||
#ifndef IN_GLIBCPP_V3
|
||||
extern const struct demangle_operator_info cplus_demangle_operators[];
|
||||
#endif
|
||||
|
||||
#define D_BUILTIN_TYPE_COUNT (33)
|
||||
|
||||
CP_STATIC_IF_GLIBCPP_V3
|
||||
const struct demangle_builtin_type_info
|
||||
cplus_demangle_builtin_types[D_BUILTIN_TYPE_COUNT];
|
||||
|
||||
CP_STATIC_IF_GLIBCPP_V3
|
||||
struct demangle_component *
|
||||
cplus_demangle_mangled_name (struct d_info *, int);
|
||||
|
||||
CP_STATIC_IF_GLIBCPP_V3
|
||||
struct demangle_component *
|
||||
cplus_demangle_type (struct d_info *);
|
||||
|
||||
extern void
|
||||
cplus_demangle_init_info (const char *, int, size_t, struct d_info *);
|
||||
|
||||
/* cp-demangle.c needs to define this a little differently */
|
||||
#undef CP_STATIC_IF_GLIBCPP_V3
|
671
contrib/sdk/sources/libstdc++-v3/libsupc++/demangle.h
Normal file
671
contrib/sdk/sources/libstdc++-v3/libsupc++/demangle.h
Normal file
@@ -0,0 +1,671 @@
|
||||
/* Defs for interface to demanglers.
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License
|
||||
as published by the Free Software Foundation; either version 2, or
|
||||
(at your option) any later version.
|
||||
|
||||
In addition to the permissions in the GNU Library General Public
|
||||
License, the Free Software Foundation gives you unlimited
|
||||
permission to link the compiled version of this file into
|
||||
combinations with other programs, and to distribute those
|
||||
combinations without any restriction coming from the use of this
|
||||
file. (The Library Public License restrictions do apply in other
|
||||
respects; for example, they cover modification of the file, and
|
||||
distribution when not linked into a combined executable.)
|
||||
|
||||
This program 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
|
||||
#if !defined (DEMANGLE_H)
|
||||
#define DEMANGLE_H
|
||||
|
||||
#include "libiberty.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Options passed to cplus_demangle (in 2nd parameter). */
|
||||
|
||||
#define DMGL_NO_OPTS 0 /* For readability... */
|
||||
#define DMGL_PARAMS (1 << 0) /* Include function args */
|
||||
#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
|
||||
#define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */
|
||||
#define DMGL_VERBOSE (1 << 3) /* Include implementation details. */
|
||||
#define DMGL_TYPES (1 << 4) /* Also try to demangle type encodings. */
|
||||
#define DMGL_RET_POSTFIX (1 << 5) /* Print function return types (when
|
||||
present) after function signature.
|
||||
It applies only to the toplevel
|
||||
function type. */
|
||||
#define DMGL_RET_DROP (1 << 6) /* Suppress printing function return
|
||||
types, even if present. It applies
|
||||
only to the toplevel function type.
|
||||
*/
|
||||
|
||||
#define DMGL_AUTO (1 << 8)
|
||||
#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)
|
||||
#define DMGL_GNU_V3 (1 << 14)
|
||||
#define DMGL_GNAT (1 << 15)
|
||||
|
||||
/* 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|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT)
|
||||
|
||||
/* Enumeration of possible demangling styles.
|
||||
|
||||
Lucid and ARM styles are still kept logically distinct, even though
|
||||
they now both behave identically. The resulting style is actual the
|
||||
union of both. I.E. either style recognizes both "__pt__" and "__rf__"
|
||||
for operator "->", even though the first is lucid style and the second
|
||||
is ARM style. (FIXME?) */
|
||||
|
||||
extern enum demangling_styles
|
||||
{
|
||||
no_demangling = -1,
|
||||
unknown_demangling = 0,
|
||||
auto_demangling = DMGL_AUTO,
|
||||
gnu_demangling = DMGL_GNU,
|
||||
lucid_demangling = DMGL_LUCID,
|
||||
arm_demangling = DMGL_ARM,
|
||||
hp_demangling = DMGL_HP,
|
||||
edg_demangling = DMGL_EDG,
|
||||
gnu_v3_demangling = DMGL_GNU_V3,
|
||||
java_demangling = DMGL_JAVA,
|
||||
gnat_demangling = DMGL_GNAT
|
||||
} current_demangling_style;
|
||||
|
||||
/* Define string names for the various demangling styles. */
|
||||
|
||||
#define NO_DEMANGLING_STYLE_STRING "none"
|
||||
#define AUTO_DEMANGLING_STYLE_STRING "auto"
|
||||
#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"
|
||||
#define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3"
|
||||
#define JAVA_DEMANGLING_STYLE_STRING "java"
|
||||
#define GNAT_DEMANGLING_STYLE_STRING "gnat"
|
||||
|
||||
/* Some macros to test what demangling style is active. */
|
||||
|
||||
#define CURRENT_DEMANGLING_STYLE current_demangling_style
|
||||
#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 (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM)
|
||||
#define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP)
|
||||
#define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG)
|
||||
#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)
|
||||
#define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)
|
||||
#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
|
||||
|
||||
/* Provide information about the available demangle styles. This code is
|
||||
pulled from gdb into libiberty because it is useful to binutils also. */
|
||||
|
||||
extern const struct demangler_engine
|
||||
{
|
||||
const char *const demangling_style_name;
|
||||
const enum demangling_styles demangling_style;
|
||||
const char *const demangling_style_doc;
|
||||
} libiberty_demanglers[];
|
||||
|
||||
extern char *
|
||||
cplus_demangle (const char *mangled, int options);
|
||||
|
||||
extern int
|
||||
cplus_demangle_opname (const char *opname, char *result, int options);
|
||||
|
||||
extern const char *
|
||||
cplus_mangle_opname (const char *opname, int options);
|
||||
|
||||
/* Note: This sets global state. FIXME if you care about multi-threading. */
|
||||
|
||||
extern void
|
||||
set_cplus_marker_for_demangling (int ch);
|
||||
|
||||
extern enum demangling_styles
|
||||
cplus_demangle_set_style (enum demangling_styles style);
|
||||
|
||||
extern enum demangling_styles
|
||||
cplus_demangle_name_to_style (const char *name);
|
||||
|
||||
/* Callback typedef for allocation-less demangler interfaces. */
|
||||
typedef void (*demangle_callbackref) (const char *, size_t, void *);
|
||||
|
||||
/* V3 ABI demangling entry points, defined in cp-demangle.c. Callback
|
||||
variants return non-zero on success, zero on error. char* variants
|
||||
return a string allocated by malloc on success, NULL on error. */
|
||||
extern int
|
||||
cplus_demangle_v3_callback (const char *mangled, int options,
|
||||
demangle_callbackref callback, void *opaque);
|
||||
|
||||
extern char*
|
||||
cplus_demangle_v3 (const char *mangled, int options);
|
||||
|
||||
extern int
|
||||
java_demangle_v3_callback (const char *mangled,
|
||||
demangle_callbackref callback, void *opaque);
|
||||
|
||||
extern char*
|
||||
java_demangle_v3 (const char *mangled);
|
||||
|
||||
char *
|
||||
ada_demangle (const char *mangled, int options);
|
||||
|
||||
enum gnu_v3_ctor_kinds {
|
||||
gnu_v3_complete_object_ctor = 1,
|
||||
gnu_v3_base_object_ctor,
|
||||
gnu_v3_complete_object_allocating_ctor,
|
||||
gnu_v3_object_ctor_group
|
||||
};
|
||||
|
||||
/* Return non-zero iff NAME is the mangled form of a constructor name
|
||||
in the G++ V3 ABI demangling style. Specifically, return an `enum
|
||||
gnu_v3_ctor_kinds' value indicating what kind of constructor
|
||||
it is. */
|
||||
extern enum gnu_v3_ctor_kinds
|
||||
is_gnu_v3_mangled_ctor (const char *name);
|
||||
|
||||
|
||||
enum gnu_v3_dtor_kinds {
|
||||
gnu_v3_deleting_dtor = 1,
|
||||
gnu_v3_complete_object_dtor,
|
||||
gnu_v3_base_object_dtor,
|
||||
gnu_v3_object_dtor_group
|
||||
};
|
||||
|
||||
/* Return non-zero iff NAME is the mangled form of a destructor name
|
||||
in the G++ V3 ABI demangling style. Specifically, return an `enum
|
||||
gnu_v3_dtor_kinds' value, indicating what kind of destructor
|
||||
it is. */
|
||||
extern enum gnu_v3_dtor_kinds
|
||||
is_gnu_v3_mangled_dtor (const char *name);
|
||||
|
||||
/* The V3 demangler works in two passes. The first pass builds a tree
|
||||
representation of the mangled name, and the second pass turns the
|
||||
tree representation into a demangled string. Here we define an
|
||||
interface to permit a caller to build their own tree
|
||||
representation, which they can pass to the demangler to get a
|
||||
demangled string. This can be used to canonicalize user input into
|
||||
something which the demangler might output. It could also be used
|
||||
by other demanglers in the future. */
|
||||
|
||||
/* These are the component types which may be found in the tree. Many
|
||||
component types have one or two subtrees, referred to as left and
|
||||
right (a component type with only one subtree puts it in the left
|
||||
subtree). */
|
||||
|
||||
enum demangle_component_type
|
||||
{
|
||||
/* A name, with a length and a pointer to a string. */
|
||||
DEMANGLE_COMPONENT_NAME,
|
||||
/* A qualified name. The left subtree is a class or namespace or
|
||||
some such thing, and the right subtree is a name qualified by
|
||||
that class. */
|
||||
DEMANGLE_COMPONENT_QUAL_NAME,
|
||||
/* A local name. The left subtree describes a function, and the
|
||||
right subtree is a name which is local to that function. */
|
||||
DEMANGLE_COMPONENT_LOCAL_NAME,
|
||||
/* A typed name. The left subtree is a name, and the right subtree
|
||||
describes that name as a function. */
|
||||
DEMANGLE_COMPONENT_TYPED_NAME,
|
||||
/* A template. The left subtree is a template name, and the right
|
||||
subtree is a template argument list. */
|
||||
DEMANGLE_COMPONENT_TEMPLATE,
|
||||
/* A template parameter. This holds a number, which is the template
|
||||
parameter index. */
|
||||
DEMANGLE_COMPONENT_TEMPLATE_PARAM,
|
||||
/* A function parameter. This holds a number, which is the index. */
|
||||
DEMANGLE_COMPONENT_FUNCTION_PARAM,
|
||||
/* A constructor. This holds a name and the kind of
|
||||
constructor. */
|
||||
DEMANGLE_COMPONENT_CTOR,
|
||||
/* A destructor. This holds a name and the kind of destructor. */
|
||||
DEMANGLE_COMPONENT_DTOR,
|
||||
/* A vtable. This has one subtree, the type for which this is a
|
||||
vtable. */
|
||||
DEMANGLE_COMPONENT_VTABLE,
|
||||
/* A VTT structure. This has one subtree, the type for which this
|
||||
is a VTT. */
|
||||
DEMANGLE_COMPONENT_VTT,
|
||||
/* A construction vtable. The left subtree is the type for which
|
||||
this is a vtable, and the right subtree is the derived type for
|
||||
which this vtable is built. */
|
||||
DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE,
|
||||
/* A typeinfo structure. This has one subtree, the type for which
|
||||
this is the tpeinfo structure. */
|
||||
DEMANGLE_COMPONENT_TYPEINFO,
|
||||
/* A typeinfo name. This has one subtree, the type for which this
|
||||
is the typeinfo name. */
|
||||
DEMANGLE_COMPONENT_TYPEINFO_NAME,
|
||||
/* A typeinfo function. This has one subtree, the type for which
|
||||
this is the tpyeinfo function. */
|
||||
DEMANGLE_COMPONENT_TYPEINFO_FN,
|
||||
/* A thunk. This has one subtree, the name for which this is a
|
||||
thunk. */
|
||||
DEMANGLE_COMPONENT_THUNK,
|
||||
/* A virtual thunk. This has one subtree, the name for which this
|
||||
is a virtual thunk. */
|
||||
DEMANGLE_COMPONENT_VIRTUAL_THUNK,
|
||||
/* A covariant thunk. This has one subtree, the name for which this
|
||||
is a covariant thunk. */
|
||||
DEMANGLE_COMPONENT_COVARIANT_THUNK,
|
||||
/* A Java class. This has one subtree, the type. */
|
||||
DEMANGLE_COMPONENT_JAVA_CLASS,
|
||||
/* A guard variable. This has one subtree, the name for which this
|
||||
is a guard variable. */
|
||||
DEMANGLE_COMPONENT_GUARD,
|
||||
/* The init and wrapper functions for C++11 thread_local variables. */
|
||||
DEMANGLE_COMPONENT_TLS_INIT,
|
||||
DEMANGLE_COMPONENT_TLS_WRAPPER,
|
||||
/* A reference temporary. This has one subtree, the name for which
|
||||
this is a temporary. */
|
||||
DEMANGLE_COMPONENT_REFTEMP,
|
||||
/* A hidden alias. This has one subtree, the encoding for which it
|
||||
is providing alternative linkage. */
|
||||
DEMANGLE_COMPONENT_HIDDEN_ALIAS,
|
||||
/* A standard substitution. This holds the name of the
|
||||
substitution. */
|
||||
DEMANGLE_COMPONENT_SUB_STD,
|
||||
/* The restrict qualifier. The one subtree is the type which is
|
||||
being qualified. */
|
||||
DEMANGLE_COMPONENT_RESTRICT,
|
||||
/* The volatile qualifier. The one subtree is the type which is
|
||||
being qualified. */
|
||||
DEMANGLE_COMPONENT_VOLATILE,
|
||||
/* The const qualifier. The one subtree is the type which is being
|
||||
qualified. */
|
||||
DEMANGLE_COMPONENT_CONST,
|
||||
/* The restrict qualifier modifying a member function. The one
|
||||
subtree is the type which is being qualified. */
|
||||
DEMANGLE_COMPONENT_RESTRICT_THIS,
|
||||
/* The volatile qualifier modifying a member function. The one
|
||||
subtree is the type which is being qualified. */
|
||||
DEMANGLE_COMPONENT_VOLATILE_THIS,
|
||||
/* The const qualifier modifying a member function. The one subtree
|
||||
is the type which is being qualified. */
|
||||
DEMANGLE_COMPONENT_CONST_THIS,
|
||||
/* C++11 A reference modifying a member function. The one subtree is the
|
||||
type which is being referenced. */
|
||||
DEMANGLE_COMPONENT_REFERENCE_THIS,
|
||||
/* C++11: An rvalue reference modifying a member function. The one
|
||||
subtree is the type which is being referenced. */
|
||||
DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS,
|
||||
/* A vendor qualifier. The left subtree is the type which is being
|
||||
qualified, and the right subtree is the name of the
|
||||
qualifier. */
|
||||
DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
|
||||
/* A pointer. The one subtree is the type which is being pointed
|
||||
to. */
|
||||
DEMANGLE_COMPONENT_POINTER,
|
||||
/* A reference. The one subtree is the type which is being
|
||||
referenced. */
|
||||
DEMANGLE_COMPONENT_REFERENCE,
|
||||
/* C++0x: An rvalue reference. The one subtree is the type which is
|
||||
being referenced. */
|
||||
DEMANGLE_COMPONENT_RVALUE_REFERENCE,
|
||||
/* A complex type. The one subtree is the base type. */
|
||||
DEMANGLE_COMPONENT_COMPLEX,
|
||||
/* An imaginary type. The one subtree is the base type. */
|
||||
DEMANGLE_COMPONENT_IMAGINARY,
|
||||
/* A builtin type. This holds the builtin type information. */
|
||||
DEMANGLE_COMPONENT_BUILTIN_TYPE,
|
||||
/* A vendor's builtin type. This holds the name of the type. */
|
||||
DEMANGLE_COMPONENT_VENDOR_TYPE,
|
||||
/* A function type. The left subtree is the return type. The right
|
||||
subtree is a list of ARGLIST nodes. Either or both may be
|
||||
NULL. */
|
||||
DEMANGLE_COMPONENT_FUNCTION_TYPE,
|
||||
/* An array type. The left subtree is the dimension, which may be
|
||||
NULL, or a string (represented as DEMANGLE_COMPONENT_NAME), or an
|
||||
expression. The right subtree is the element type. */
|
||||
DEMANGLE_COMPONENT_ARRAY_TYPE,
|
||||
/* A pointer to member type. The left subtree is the class type,
|
||||
and the right subtree is the member type. CV-qualifiers appear
|
||||
on the latter. */
|
||||
DEMANGLE_COMPONENT_PTRMEM_TYPE,
|
||||
/* A fixed-point type. */
|
||||
DEMANGLE_COMPONENT_FIXED_TYPE,
|
||||
/* A vector type. The left subtree is the number of elements,
|
||||
the right subtree is the element type. */
|
||||
DEMANGLE_COMPONENT_VECTOR_TYPE,
|
||||
/* An argument list. The left subtree is the current argument, and
|
||||
the right subtree is either NULL or another ARGLIST node. */
|
||||
DEMANGLE_COMPONENT_ARGLIST,
|
||||
/* A template argument list. The left subtree is the current
|
||||
template argument, and the right subtree is either NULL or
|
||||
another TEMPLATE_ARGLIST node. */
|
||||
DEMANGLE_COMPONENT_TEMPLATE_ARGLIST,
|
||||
/* An initializer list. The left subtree is either an explicit type or
|
||||
NULL, and the right subtree is a DEMANGLE_COMPONENT_ARGLIST. */
|
||||
DEMANGLE_COMPONENT_INITIALIZER_LIST,
|
||||
/* An operator. This holds information about a standard
|
||||
operator. */
|
||||
DEMANGLE_COMPONENT_OPERATOR,
|
||||
/* An extended operator. This holds the number of arguments, and
|
||||
the name of the extended operator. */
|
||||
DEMANGLE_COMPONENT_EXTENDED_OPERATOR,
|
||||
/* A typecast, represented as a unary operator. The one subtree is
|
||||
the type to which the argument should be cast. */
|
||||
DEMANGLE_COMPONENT_CAST,
|
||||
/* A nullary expression. The left subtree is the operator. */
|
||||
DEMANGLE_COMPONENT_NULLARY,
|
||||
/* A unary expression. The left subtree is the operator, and the
|
||||
right subtree is the single argument. */
|
||||
DEMANGLE_COMPONENT_UNARY,
|
||||
/* A binary expression. The left subtree is the operator, and the
|
||||
right subtree is a BINARY_ARGS. */
|
||||
DEMANGLE_COMPONENT_BINARY,
|
||||
/* Arguments to a binary expression. The left subtree is the first
|
||||
argument, and the right subtree is the second argument. */
|
||||
DEMANGLE_COMPONENT_BINARY_ARGS,
|
||||
/* A trinary expression. The left subtree is the operator, and the
|
||||
right subtree is a TRINARY_ARG1. */
|
||||
DEMANGLE_COMPONENT_TRINARY,
|
||||
/* Arguments to a trinary expression. The left subtree is the first
|
||||
argument, and the right subtree is a TRINARY_ARG2. */
|
||||
DEMANGLE_COMPONENT_TRINARY_ARG1,
|
||||
/* More arguments to a trinary expression. The left subtree is the
|
||||
second argument, and the right subtree is the third argument. */
|
||||
DEMANGLE_COMPONENT_TRINARY_ARG2,
|
||||
/* A literal. The left subtree is the type, and the right subtree
|
||||
is the value, represented as a DEMANGLE_COMPONENT_NAME. */
|
||||
DEMANGLE_COMPONENT_LITERAL,
|
||||
/* A negative literal. Like LITERAL, but the value is negated.
|
||||
This is a minor hack: the NAME used for LITERAL points directly
|
||||
to the mangled string, but since negative numbers are mangled
|
||||
using 'n' instead of '-', we want a way to indicate a negative
|
||||
number which involves neither modifying the mangled string nor
|
||||
allocating a new copy of the literal in memory. */
|
||||
DEMANGLE_COMPONENT_LITERAL_NEG,
|
||||
/* A libgcj compiled resource. The left subtree is the name of the
|
||||
resource. */
|
||||
DEMANGLE_COMPONENT_JAVA_RESOURCE,
|
||||
/* A name formed by the concatenation of two parts. The left
|
||||
subtree is the first part and the right subtree the second. */
|
||||
DEMANGLE_COMPONENT_COMPOUND_NAME,
|
||||
/* A name formed by a single character. */
|
||||
DEMANGLE_COMPONENT_CHARACTER,
|
||||
/* A number. */
|
||||
DEMANGLE_COMPONENT_NUMBER,
|
||||
/* A decltype type. */
|
||||
DEMANGLE_COMPONENT_DECLTYPE,
|
||||
/* Global constructors keyed to name. */
|
||||
DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS,
|
||||
/* Global destructors keyed to name. */
|
||||
DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS,
|
||||
/* A lambda closure type. */
|
||||
DEMANGLE_COMPONENT_LAMBDA,
|
||||
/* A default argument scope. */
|
||||
DEMANGLE_COMPONENT_DEFAULT_ARG,
|
||||
/* An unnamed type. */
|
||||
DEMANGLE_COMPONENT_UNNAMED_TYPE,
|
||||
/* A transactional clone. This has one subtree, the encoding for
|
||||
which it is providing alternative linkage. */
|
||||
DEMANGLE_COMPONENT_TRANSACTION_CLONE,
|
||||
/* A non-transactional clone entry point. In the i386/x86_64 abi,
|
||||
the unmangled symbol of a tm_callable becomes a thunk and the
|
||||
non-transactional function version is mangled thus. */
|
||||
DEMANGLE_COMPONENT_NONTRANSACTION_CLONE,
|
||||
/* A pack expansion. */
|
||||
DEMANGLE_COMPONENT_PACK_EXPANSION,
|
||||
/* A name with an ABI tag. */
|
||||
DEMANGLE_COMPONENT_TAGGED_NAME,
|
||||
/* A cloned function. */
|
||||
DEMANGLE_COMPONENT_CLONE
|
||||
};
|
||||
|
||||
/* Types which are only used internally. */
|
||||
|
||||
struct demangle_operator_info;
|
||||
struct demangle_builtin_type_info;
|
||||
|
||||
/* A node in the tree representation is an instance of a struct
|
||||
demangle_component. Note that the field names of the struct are
|
||||
not well protected against macros defined by the file including
|
||||
this one. We can fix this if it ever becomes a problem. */
|
||||
|
||||
struct demangle_component
|
||||
{
|
||||
/* The type of this component. */
|
||||
enum demangle_component_type type;
|
||||
|
||||
union
|
||||
{
|
||||
/* For DEMANGLE_COMPONENT_NAME. */
|
||||
struct
|
||||
{
|
||||
/* A pointer to the name (which need not NULL terminated) and
|
||||
its length. */
|
||||
const char *s;
|
||||
int len;
|
||||
} s_name;
|
||||
|
||||
/* For DEMANGLE_COMPONENT_OPERATOR. */
|
||||
struct
|
||||
{
|
||||
/* Operator. */
|
||||
const struct demangle_operator_info *op;
|
||||
} s_operator;
|
||||
|
||||
/* For DEMANGLE_COMPONENT_EXTENDED_OPERATOR. */
|
||||
struct
|
||||
{
|
||||
/* Number of arguments. */
|
||||
int args;
|
||||
/* Name. */
|
||||
struct demangle_component *name;
|
||||
} s_extended_operator;
|
||||
|
||||
/* For DEMANGLE_COMPONENT_FIXED_TYPE. */
|
||||
struct
|
||||
{
|
||||
/* The length, indicated by a C integer type name. */
|
||||
struct demangle_component *length;
|
||||
/* _Accum or _Fract? */
|
||||
short accum;
|
||||
/* Saturating or not? */
|
||||
short sat;
|
||||
} s_fixed;
|
||||
|
||||
/* For DEMANGLE_COMPONENT_CTOR. */
|
||||
struct
|
||||
{
|
||||
/* Kind of constructor. */
|
||||
enum gnu_v3_ctor_kinds kind;
|
||||
/* Name. */
|
||||
struct demangle_component *name;
|
||||
} s_ctor;
|
||||
|
||||
/* For DEMANGLE_COMPONENT_DTOR. */
|
||||
struct
|
||||
{
|
||||
/* Kind of destructor. */
|
||||
enum gnu_v3_dtor_kinds kind;
|
||||
/* Name. */
|
||||
struct demangle_component *name;
|
||||
} s_dtor;
|
||||
|
||||
/* For DEMANGLE_COMPONENT_BUILTIN_TYPE. */
|
||||
struct
|
||||
{
|
||||
/* Builtin type. */
|
||||
const struct demangle_builtin_type_info *type;
|
||||
} s_builtin;
|
||||
|
||||
/* For DEMANGLE_COMPONENT_SUB_STD. */
|
||||
struct
|
||||
{
|
||||
/* Standard substitution string. */
|
||||
const char* string;
|
||||
/* Length of string. */
|
||||
int len;
|
||||
} s_string;
|
||||
|
||||
/* For DEMANGLE_COMPONENT_*_PARAM. */
|
||||
struct
|
||||
{
|
||||
/* Parameter index. */
|
||||
long number;
|
||||
} s_number;
|
||||
|
||||
/* For DEMANGLE_COMPONENT_CHARACTER. */
|
||||
struct
|
||||
{
|
||||
int character;
|
||||
} s_character;
|
||||
|
||||
/* For other types. */
|
||||
struct
|
||||
{
|
||||
/* Left (or only) subtree. */
|
||||
struct demangle_component *left;
|
||||
/* Right subtree. */
|
||||
struct demangle_component *right;
|
||||
} s_binary;
|
||||
|
||||
struct
|
||||
{
|
||||
/* subtree, same place as d_left. */
|
||||
struct demangle_component *sub;
|
||||
/* integer. */
|
||||
int num;
|
||||
} s_unary_num;
|
||||
|
||||
} u;
|
||||
};
|
||||
|
||||
/* People building mangled trees are expected to allocate instances of
|
||||
struct demangle_component themselves. They can then call one of
|
||||
the following functions to fill them in. */
|
||||
|
||||
/* Fill in most component types with a left subtree and a right
|
||||
subtree. Returns non-zero on success, zero on failure, such as an
|
||||
unrecognized or inappropriate component type. */
|
||||
|
||||
extern int
|
||||
cplus_demangle_fill_component (struct demangle_component *fill,
|
||||
enum demangle_component_type,
|
||||
struct demangle_component *left,
|
||||
struct demangle_component *right);
|
||||
|
||||
/* Fill in a DEMANGLE_COMPONENT_NAME. Returns non-zero on success,
|
||||
zero for bad arguments. */
|
||||
|
||||
extern int
|
||||
cplus_demangle_fill_name (struct demangle_component *fill,
|
||||
const char *, int);
|
||||
|
||||
/* Fill in a DEMANGLE_COMPONENT_BUILTIN_TYPE, using the name of the
|
||||
builtin type (e.g., "int", etc.). Returns non-zero on success,
|
||||
zero if the type is not recognized. */
|
||||
|
||||
extern int
|
||||
cplus_demangle_fill_builtin_type (struct demangle_component *fill,
|
||||
const char *type_name);
|
||||
|
||||
/* Fill in a DEMANGLE_COMPONENT_OPERATOR, using the name of the
|
||||
operator and the number of arguments which it takes (the latter is
|
||||
used to disambiguate operators which can be both binary and unary,
|
||||
such as '-'). Returns non-zero on success, zero if the operator is
|
||||
not recognized. */
|
||||
|
||||
extern int
|
||||
cplus_demangle_fill_operator (struct demangle_component *fill,
|
||||
const char *opname, int args);
|
||||
|
||||
/* Fill in a DEMANGLE_COMPONENT_EXTENDED_OPERATOR, providing the
|
||||
number of arguments and the name. Returns non-zero on success,
|
||||
zero for bad arguments. */
|
||||
|
||||
extern int
|
||||
cplus_demangle_fill_extended_operator (struct demangle_component *fill,
|
||||
int numargs,
|
||||
struct demangle_component *nm);
|
||||
|
||||
/* Fill in a DEMANGLE_COMPONENT_CTOR. Returns non-zero on success,
|
||||
zero for bad arguments. */
|
||||
|
||||
extern int
|
||||
cplus_demangle_fill_ctor (struct demangle_component *fill,
|
||||
enum gnu_v3_ctor_kinds kind,
|
||||
struct demangle_component *name);
|
||||
|
||||
/* Fill in a DEMANGLE_COMPONENT_DTOR. Returns non-zero on success,
|
||||
zero for bad arguments. */
|
||||
|
||||
extern int
|
||||
cplus_demangle_fill_dtor (struct demangle_component *fill,
|
||||
enum gnu_v3_dtor_kinds kind,
|
||||
struct demangle_component *name);
|
||||
|
||||
/* This function translates a mangled name into a struct
|
||||
demangle_component tree. The first argument is the mangled name.
|
||||
The second argument is DMGL_* options. This returns a pointer to a
|
||||
tree on success, or NULL on failure. On success, the third
|
||||
argument is set to a block of memory allocated by malloc. This
|
||||
block should be passed to free when the tree is no longer
|
||||
needed. */
|
||||
|
||||
extern struct demangle_component *
|
||||
cplus_demangle_v3_components (const char *mangled, int options, void **mem);
|
||||
|
||||
/* This function takes a struct demangle_component tree and returns
|
||||
the corresponding demangled string. The first argument is DMGL_*
|
||||
options. The second is the tree to demangle. The third is a guess
|
||||
at the length of the demangled string, used to initially allocate
|
||||
the return buffer. The fourth is a pointer to a size_t. On
|
||||
success, this function returns a buffer allocated by malloc(), and
|
||||
sets the size_t pointed to by the fourth argument to the size of
|
||||
the allocated buffer (not the length of the returned string). On
|
||||
failure, this function returns NULL, and sets the size_t pointed to
|
||||
by the fourth argument to 0 for an invalid tree, or to 1 for a
|
||||
memory allocation error. */
|
||||
|
||||
extern char *
|
||||
cplus_demangle_print (int options,
|
||||
const struct demangle_component *tree,
|
||||
int estimated_length,
|
||||
size_t *p_allocated_size);
|
||||
|
||||
/* This function takes a struct demangle_component tree and passes back
|
||||
a demangled string in one or more calls to a callback function.
|
||||
The first argument is DMGL_* options. The second is the tree to
|
||||
demangle. The third is a pointer to a callback function; on each call
|
||||
this receives an element of the demangled string, its length, and an
|
||||
opaque value. The fourth is the opaque value passed to the callback.
|
||||
The callback is called once or more to return the full demangled
|
||||
string. The demangled element string is always nul-terminated, though
|
||||
its length is also provided for convenience. In contrast to
|
||||
cplus_demangle_print(), this function does not allocate heap memory
|
||||
to grow output strings (except perhaps where alloca() is implemented
|
||||
by malloc()), and so is normally safe for use where the heap has been
|
||||
corrupted. On success, this function returns 1; on failure, 0. */
|
||||
|
||||
extern int
|
||||
cplus_demangle_print_callback (int options,
|
||||
const struct demangle_component *tree,
|
||||
demangle_callbackref callback, void *opaque);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* DEMANGLE_H */
|
@@ -93,9 +93,9 @@ struct __eh_globals_init
|
||||
bool _M_init;
|
||||
|
||||
__eh_globals_init() : _M_init(false)
|
||||
{
|
||||
{
|
||||
if (__gthread_active_p())
|
||||
_M_init = __gthread_key_create(&_M_key, eh_globals_dtor) == 0;
|
||||
_M_init = __gthread_key_create(&_M_key, eh_globals_dtor) == 0;
|
||||
}
|
||||
|
||||
~__eh_globals_init()
|
||||
|
@@ -95,7 +95,7 @@ get_ttype_entry (lsda_header_info *info, _uleb128_t i)
|
||||
i *= size_of_encoded_value (info->ttype_encoding);
|
||||
read_encoded_value_with_base (info->ttype_encoding, info->ttype_base,
|
||||
info->TType - i, &ptr);
|
||||
|
||||
|
||||
return reinterpret_cast<const std::type_info *>(ptr);
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
|
||||
|
||||
|
||||
extern "C" void
|
||||
__cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo,
|
||||
__cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo,
|
||||
void (_GLIBCXX_CDTOR_CALLABI *dest) (void *))
|
||||
{
|
||||
PROBE2 (throw, obj, tinfo);
|
||||
@@ -100,7 +100,7 @@ __cxxabiv1::__cxa_rethrow ()
|
||||
globals->caughtExceptions = 0;
|
||||
else
|
||||
{
|
||||
header->handlerCount = -header->handlerCount;
|
||||
header->handlerCount = -header->handlerCount;
|
||||
// Only notify probe for C++ exceptions.
|
||||
PROBE2 (rethrow, __get_object_from_ambiguous_exception(header),
|
||||
header->exceptionType);
|
||||
|
@@ -77,7 +77,7 @@ namespace std
|
||||
// One past the last element.
|
||||
constexpr const_iterator
|
||||
end() const noexcept { return begin() + size(); }
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Return an iterator pointing to the first element of
|
||||
|
686
contrib/sdk/sources/libstdc++-v3/libsupc++/libiberty.h
Normal file
686
contrib/sdk/sources/libstdc++-v3/libsupc++/libiberty.h
Normal file
@@ -0,0 +1,686 @@
|
||||
/* Function declarations for libiberty.
|
||||
|
||||
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
|
||||
Note - certain prototypes declared in this header file are for
|
||||
functions whoes implementation copyright does not belong to the
|
||||
FSF. Those prototypes are present in this file for reference
|
||||
purposes only and their presence in this file should not construed
|
||||
as an indication of ownership by the FSF of the implementation of
|
||||
those functions in any way or form whatsoever.
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
Written by Cygnus Support, 1994.
|
||||
|
||||
The libiberty library provides a number of functions which are
|
||||
missing on some operating systems. We do not declare those here,
|
||||
to avoid conflicts with the system header files on operating
|
||||
systems that do support those functions. In this file we only
|
||||
declare those functions which are specific to libiberty. */
|
||||
|
||||
#ifndef LIBIBERTY_H
|
||||
#define LIBIBERTY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ansidecl.h"
|
||||
|
||||
/* Get a definition for size_t. */
|
||||
#include <stddef.h>
|
||||
/* Get a definition for va_list. */
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* If the OS supports it, ensure that the supplied stream is setup to
|
||||
avoid any multi-threaded locking. Otherwise leave the FILE pointer
|
||||
unchanged. If the stream is NULL do nothing. */
|
||||
|
||||
extern void unlock_stream (FILE *);
|
||||
|
||||
/* If the OS supports it, ensure that the standard I/O streams, stdin,
|
||||
stdout and stderr are setup to avoid any multi-threaded locking.
|
||||
Otherwise do nothing. */
|
||||
|
||||
extern void unlock_std_streams (void);
|
||||
|
||||
/* Open and return a FILE pointer. If the OS supports it, ensure that
|
||||
the stream is setup to avoid any multi-threaded locking. Otherwise
|
||||
return the FILE pointer unchanged. */
|
||||
|
||||
extern FILE *fopen_unlocked (const char *, const char *);
|
||||
extern FILE *fdopen_unlocked (int, const char *);
|
||||
extern FILE *freopen_unlocked (const char *, const char *, FILE *);
|
||||
|
||||
/* Build an argument vector from a string. Allocates memory using
|
||||
malloc. Use freeargv to free the vector. */
|
||||
|
||||
extern char **buildargv (const char *) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Free a vector returned by buildargv. */
|
||||
|
||||
extern void freeargv (char **);
|
||||
|
||||
/* Duplicate an argument vector. Allocates memory using malloc. Use
|
||||
freeargv to free the vector. */
|
||||
|
||||
extern char **dupargv (char **) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Expand "@file" arguments in argv. */
|
||||
|
||||
extern void expandargv PARAMS ((int *, char ***));
|
||||
|
||||
/* Write argv to an @-file, inserting necessary quoting. */
|
||||
|
||||
extern int writeargv PARAMS ((char **, FILE *));
|
||||
|
||||
/* Return the number of elements in argv. */
|
||||
|
||||
extern int countargv (char**);
|
||||
|
||||
/* Return the last component of a path name. Note that we can't use a
|
||||
prototype here because the parameter is declared inconsistently
|
||||
across different systems, sometimes as "char *" and sometimes as
|
||||
"const char *" */
|
||||
|
||||
/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
|
||||
undefined, we haven't run the autoconf check so provide the
|
||||
declaration without arguments. If it is 0, we checked and failed
|
||||
to find the declaration so provide a fully prototyped one. If it
|
||||
is 1, we found it so don't provide any declaration at all. */
|
||||
#if !HAVE_DECL_BASENAME
|
||||
#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
|
||||
extern char *basename (const char *);
|
||||
#else
|
||||
/* Do not allow basename to be used if there is no prototype seen. We
|
||||
either need to use the above prototype or have one from
|
||||
autoconf which would result in HAVE_DECL_BASENAME being set. */
|
||||
#define basename basename_cannot_be_used_without_a_prototype
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* A well-defined basename () that is always compiled in. */
|
||||
|
||||
extern const char *lbasename (const char *);
|
||||
|
||||
/* Same, but assumes DOS semantics (drive name, backslash is also a
|
||||
dir separator) regardless of host. */
|
||||
|
||||
extern const char *dos_lbasename (const char *);
|
||||
|
||||
/* Same, but assumes Unix semantics (absolute paths always start with
|
||||
a slash, only forward slash is accepted as dir separator)
|
||||
regardless of host. */
|
||||
|
||||
extern const char *unix_lbasename (const char *);
|
||||
|
||||
/* A well-defined realpath () that is always compiled in. */
|
||||
|
||||
extern char *lrealpath (const char *);
|
||||
|
||||
/* Concatenate an arbitrary number of strings. You must pass NULL as
|
||||
the last argument of this function, to terminate the list of
|
||||
strings. Allocates memory using xmalloc. */
|
||||
|
||||
extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL;
|
||||
|
||||
/* Concatenate an arbitrary number of strings. You must pass NULL as
|
||||
the last argument of this function, to terminate the list of
|
||||
strings. Allocates memory using xmalloc. The first argument is
|
||||
not one of the strings to be concatenated, but if not NULL is a
|
||||
pointer to be freed after the new string is created, similar to the
|
||||
way xrealloc works. */
|
||||
|
||||
extern char *reconcat (char *, const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL;
|
||||
|
||||
/* Determine the length of concatenating an arbitrary number of
|
||||
strings. You must pass NULL as the last argument of this function,
|
||||
to terminate the list of strings. */
|
||||
|
||||
extern unsigned long concat_length (const char *, ...) ATTRIBUTE_SENTINEL;
|
||||
|
||||
/* Concatenate an arbitrary number of strings into a SUPPLIED area of
|
||||
memory. You must pass NULL as the last argument of this function,
|
||||
to terminate the list of strings. The supplied memory is assumed
|
||||
to be large enough. */
|
||||
|
||||
extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_SENTINEL;
|
||||
|
||||
/* Concatenate an arbitrary number of strings into a GLOBAL area of
|
||||
memory. You must pass NULL as the last argument of this function,
|
||||
to terminate the list of strings. The supplied memory is assumed
|
||||
to be large enough. */
|
||||
|
||||
extern char *concat_copy2 (const char *, ...) ATTRIBUTE_SENTINEL;
|
||||
|
||||
/* This is the global area used by concat_copy2. */
|
||||
|
||||
extern char *libiberty_concat_ptr;
|
||||
|
||||
/* Concatenate an arbitrary number of strings. You must pass NULL as
|
||||
the last argument of this function, to terminate the list of
|
||||
strings. Allocates memory using alloca. The arguments are
|
||||
evaluated twice! */
|
||||
#define ACONCAT(ACONCAT_PARAMS) \
|
||||
(libiberty_concat_ptr = (char *) alloca (concat_length ACONCAT_PARAMS + 1), \
|
||||
concat_copy2 ACONCAT_PARAMS)
|
||||
|
||||
/* Check whether two file descriptors refer to the same file. */
|
||||
|
||||
extern int fdmatch (int fd1, int fd2);
|
||||
|
||||
/* Return the position of the first bit set in the argument. */
|
||||
/* Prototypes vary from system to system, so we only provide a
|
||||
prototype on systems where we know that we need it. */
|
||||
#if defined (HAVE_DECL_FFS) && !HAVE_DECL_FFS
|
||||
extern int ffs(int);
|
||||
#endif
|
||||
|
||||
/* Get the working directory. The result is cached, so don't call
|
||||
chdir() between calls to getpwd(). */
|
||||
|
||||
extern char * getpwd (void);
|
||||
|
||||
/* Get the current time. */
|
||||
/* Prototypes vary from system to system, so we only provide a
|
||||
prototype on systems where we know that we need it. */
|
||||
#ifdef __MINGW32__
|
||||
/* Forward declaration to avoid #include <sys/time.h>. */
|
||||
struct timeval;
|
||||
extern int gettimeofday (struct timeval *, void *);
|
||||
#endif
|
||||
|
||||
/* Get the amount of time the process has run, in microseconds. */
|
||||
|
||||
extern long get_run_time (void);
|
||||
|
||||
/* Generate a relocated path to some installation directory. Allocates
|
||||
return value using malloc. */
|
||||
|
||||
extern char *make_relative_prefix (const char *, const char *,
|
||||
const char *) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Generate a relocated path to some installation directory without
|
||||
attempting to follow any soft links. Allocates
|
||||
return value using malloc. */
|
||||
|
||||
extern char *make_relative_prefix_ignore_links (const char *, const char *,
|
||||
const char *) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Choose a temporary directory to use for scratch files. */
|
||||
|
||||
extern char *choose_temp_base (void) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Return a temporary file name or NULL if unable to create one. */
|
||||
|
||||
extern char *make_temp_file (const char *) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Remove a link to a file unless it is special. */
|
||||
|
||||
extern int unlink_if_ordinary (const char *);
|
||||
|
||||
/* Allocate memory filled with spaces. Allocates using malloc. */
|
||||
|
||||
extern const char *spaces (int count);
|
||||
|
||||
/* Return the maximum error number for which strerror will return a
|
||||
string. */
|
||||
|
||||
extern int errno_max (void);
|
||||
|
||||
/* Return the name of an errno value (e.g., strerrno (EINVAL) returns
|
||||
"EINVAL"). */
|
||||
|
||||
extern const char *strerrno (int);
|
||||
|
||||
/* Given the name of an errno value, return the value. */
|
||||
|
||||
extern int strtoerrno (const char *);
|
||||
|
||||
/* ANSI's strerror(), but more robust. */
|
||||
|
||||
extern char *xstrerror (int);
|
||||
|
||||
/* Return the maximum signal number for which strsignal will return a
|
||||
string. */
|
||||
|
||||
extern int signo_max (void);
|
||||
|
||||
/* Return a signal message string for a signal number
|
||||
(e.g., strsignal (SIGHUP) returns something like "Hangup"). */
|
||||
/* This is commented out as it can conflict with one in system headers.
|
||||
We still document its existence though. */
|
||||
|
||||
/*extern const char *strsignal (int);*/
|
||||
|
||||
/* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
|
||||
"SIGHUP"). */
|
||||
|
||||
extern const char *strsigno (int);
|
||||
|
||||
/* Given the name of a signal, return its number. */
|
||||
|
||||
extern int strtosigno (const char *);
|
||||
|
||||
/* Register a function to be run by xexit. Returns 0 on success. */
|
||||
|
||||
extern int xatexit (void (*fn) (void));
|
||||
|
||||
/* Exit, calling all the functions registered with xatexit. */
|
||||
|
||||
extern void xexit (int status) ATTRIBUTE_NORETURN;
|
||||
|
||||
/* Set the program name used by xmalloc. */
|
||||
|
||||
extern void xmalloc_set_program_name (const char *);
|
||||
|
||||
/* Report an allocation failure. */
|
||||
extern void xmalloc_failed (size_t) ATTRIBUTE_NORETURN;
|
||||
|
||||
/* Allocate memory without fail. If malloc fails, this will print a
|
||||
message to stderr (using the name set by xmalloc_set_program_name,
|
||||
if any) and then call xexit. */
|
||||
|
||||
extern void *xmalloc (size_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Reallocate memory without fail. This works like xmalloc. Note,
|
||||
realloc type functions are not suitable for attribute malloc since
|
||||
they may return the same address across multiple calls. */
|
||||
|
||||
extern void *xrealloc (void *, size_t);
|
||||
|
||||
/* Allocate memory without fail and set it to zero. This works like
|
||||
xmalloc. */
|
||||
|
||||
extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Copy a string into a memory buffer without fail. */
|
||||
|
||||
extern char *xstrdup (const char *) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Copy at most N characters from string into a buffer without fail. */
|
||||
|
||||
extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Copy an existing memory buffer to a new memory buffer without fail. */
|
||||
|
||||
extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Physical memory routines. Return values are in BYTES. */
|
||||
extern double physmem_total (void);
|
||||
extern double physmem_available (void);
|
||||
|
||||
/* Compute the 32-bit CRC of a block of memory. */
|
||||
extern unsigned int xcrc32 (const unsigned char *, int, unsigned int);
|
||||
|
||||
/* These macros provide a K&R/C89/C++-friendly way of allocating structures
|
||||
with nice encapsulation. The XDELETE*() macros are technically
|
||||
superfluous, but provided here for symmetry. Using them consistently
|
||||
makes it easier to update client code to use different allocators such
|
||||
as new/delete and new[]/delete[]. */
|
||||
|
||||
/* Scalar allocators. */
|
||||
|
||||
#define XALLOCA(T) ((T *) alloca (sizeof (T)))
|
||||
#define XNEW(T) ((T *) xmalloc (sizeof (T)))
|
||||
#define XCNEW(T) ((T *) xcalloc (1, sizeof (T)))
|
||||
#define XDUP(T, P) ((T *) xmemdup ((P), sizeof (T), sizeof (T)))
|
||||
#define XDELETE(P) free ((void*) (P))
|
||||
|
||||
/* Array allocators. */
|
||||
|
||||
#define XALLOCAVEC(T, N) ((T *) alloca (sizeof (T) * (N)))
|
||||
#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N)))
|
||||
#define XCNEWVEC(T, N) ((T *) xcalloc ((N), sizeof (T)))
|
||||
#define XDUPVEC(T, P, N) ((T *) xmemdup ((P), sizeof (T) * (N), sizeof (T) * (N)))
|
||||
#define XRESIZEVEC(T, P, N) ((T *) xrealloc ((void *) (P), sizeof (T) * (N)))
|
||||
#define XDELETEVEC(P) free ((void*) (P))
|
||||
|
||||
/* Allocators for variable-sized structures and raw buffers. */
|
||||
|
||||
#define XALLOCAVAR(T, S) ((T *) alloca ((S)))
|
||||
#define XNEWVAR(T, S) ((T *) xmalloc ((S)))
|
||||
#define XCNEWVAR(T, S) ((T *) xcalloc (1, (S)))
|
||||
#define XDUPVAR(T, P, S1, S2) ((T *) xmemdup ((P), (S1), (S2)))
|
||||
#define XRESIZEVAR(T, P, S) ((T *) xrealloc ((P), (S)))
|
||||
|
||||
/* Type-safe obstack allocator. */
|
||||
|
||||
#define XOBNEW(O, T) ((T *) obstack_alloc ((O), sizeof (T)))
|
||||
#define XOBNEWVEC(O, T, N) ((T *) obstack_alloc ((O), sizeof (T) * (N)))
|
||||
#define XOBNEWVAR(O, T, S) ((T *) obstack_alloc ((O), (S)))
|
||||
#define XOBFINISH(O, T) ((T) obstack_finish ((O)))
|
||||
|
||||
/* hex character manipulation routines */
|
||||
|
||||
#define _hex_array_size 256
|
||||
#define _hex_bad 99
|
||||
extern const unsigned char _hex_value[_hex_array_size];
|
||||
extern void hex_init (void);
|
||||
#define hex_p(c) (hex_value (c) != _hex_bad)
|
||||
/* If you change this, note well: Some code relies on side effects in
|
||||
the argument being performed exactly once. */
|
||||
#define hex_value(c) ((unsigned int) _hex_value[(unsigned char) (c)])
|
||||
|
||||
/* Flags for pex_init. These are bits to be or'ed together. */
|
||||
|
||||
/* Record subprocess times, if possible. */
|
||||
#define PEX_RECORD_TIMES 0x1
|
||||
|
||||
/* Use pipes for communication between processes, if possible. */
|
||||
#define PEX_USE_PIPES 0x2
|
||||
|
||||
/* Save files used for communication between processes. */
|
||||
#define PEX_SAVE_TEMPS 0x4
|
||||
|
||||
/* Prepare to execute one or more programs, with standard output of
|
||||
each program fed to standard input of the next.
|
||||
FLAGS As above.
|
||||
PNAME The name of the program to report in error messages.
|
||||
TEMPBASE A base name to use for temporary files; may be NULL to
|
||||
use a random name.
|
||||
Returns NULL on error. */
|
||||
|
||||
extern struct pex_obj *pex_init (int flags, const char *pname,
|
||||
const char *tempbase);
|
||||
|
||||
/* Flags for pex_run. These are bits to be or'ed together. */
|
||||
|
||||
/* Last program in pipeline. Standard output of program goes to
|
||||
OUTNAME, or, if OUTNAME is NULL, to standard output of caller. Do
|
||||
not set this if you want to call pex_read_output. After this is
|
||||
set, pex_run may no longer be called with the same struct
|
||||
pex_obj. */
|
||||
#define PEX_LAST 0x1
|
||||
|
||||
/* Search for program in executable search path. */
|
||||
#define PEX_SEARCH 0x2
|
||||
|
||||
/* OUTNAME is a suffix. */
|
||||
#define PEX_SUFFIX 0x4
|
||||
|
||||
/* Send program's standard error to standard output. */
|
||||
#define PEX_STDERR_TO_STDOUT 0x8
|
||||
|
||||
/* Input file should be opened in binary mode. This flag is ignored
|
||||
on Unix. */
|
||||
#define PEX_BINARY_INPUT 0x10
|
||||
|
||||
/* Output file should be opened in binary mode. This flag is ignored
|
||||
on Unix. For proper behaviour PEX_BINARY_INPUT and
|
||||
PEX_BINARY_OUTPUT have to match appropriately--i.e., a call using
|
||||
PEX_BINARY_OUTPUT should be followed by a call using
|
||||
PEX_BINARY_INPUT. */
|
||||
#define PEX_BINARY_OUTPUT 0x20
|
||||
|
||||
/* Capture stderr to a pipe. The output can be read by
|
||||
calling pex_read_err and reading from the returned
|
||||
FILE object. This flag may be specified only for
|
||||
the last program in a pipeline.
|
||||
|
||||
This flag is supported only on Unix and Windows. */
|
||||
#define PEX_STDERR_TO_PIPE 0x40
|
||||
|
||||
/* Capture stderr in binary mode. This flag is ignored
|
||||
on Unix. */
|
||||
#define PEX_BINARY_ERROR 0x80
|
||||
|
||||
|
||||
/* Execute one program. Returns NULL on success. On error returns an
|
||||
error string (typically just the name of a system call); the error
|
||||
string is statically allocated.
|
||||
|
||||
OBJ Returned by pex_init.
|
||||
|
||||
FLAGS As above.
|
||||
|
||||
EXECUTABLE The program to execute.
|
||||
|
||||
ARGV NULL terminated array of arguments to pass to the program.
|
||||
|
||||
OUTNAME Sets the output file name as follows:
|
||||
|
||||
PEX_SUFFIX set (OUTNAME may not be NULL):
|
||||
TEMPBASE parameter to pex_init not NULL:
|
||||
Output file name is the concatenation of TEMPBASE
|
||||
and OUTNAME.
|
||||
TEMPBASE is NULL:
|
||||
Output file name is a random file name ending in
|
||||
OUTNAME.
|
||||
PEX_SUFFIX not set:
|
||||
OUTNAME not NULL:
|
||||
Output file name is OUTNAME.
|
||||
OUTNAME NULL, TEMPBASE not NULL:
|
||||
Output file name is randomly chosen using
|
||||
TEMPBASE.
|
||||
OUTNAME NULL, TEMPBASE NULL:
|
||||
Output file name is randomly chosen.
|
||||
|
||||
If PEX_LAST is not set, the output file name is the
|
||||
name to use for a temporary file holding stdout, if
|
||||
any (there will not be a file if PEX_USE_PIPES is set
|
||||
and the system supports pipes). If a file is used, it
|
||||
will be removed when no longer needed unless
|
||||
PEX_SAVE_TEMPS is set.
|
||||
|
||||
If PEX_LAST is set, and OUTNAME is not NULL, standard
|
||||
output is written to the output file name. The file
|
||||
will not be removed. If PEX_LAST and PEX_SUFFIX are
|
||||
both set, TEMPBASE may not be NULL.
|
||||
|
||||
ERRNAME If not NULL, this is the name of a file to which
|
||||
standard error is written. If NULL, standard error of
|
||||
the program is standard error of the caller.
|
||||
|
||||
ERR On an error return, *ERR is set to an errno value, or
|
||||
to 0 if there is no relevant errno.
|
||||
*/
|
||||
|
||||
extern const char *pex_run (struct pex_obj *obj, int flags,
|
||||
const char *executable, char * const *argv,
|
||||
const char *outname, const char *errname,
|
||||
int *err);
|
||||
|
||||
/* As for pex_run (), but takes an extra parameter to enable the
|
||||
environment for the child process to be specified.
|
||||
|
||||
ENV The environment for the child process, specified as
|
||||
an array of character pointers. Each element of the
|
||||
array should point to a string of the form VAR=VALUE,
|
||||
with the exception of the last element which must be
|
||||
a null pointer.
|
||||
*/
|
||||
|
||||
extern const char *pex_run_in_environment (struct pex_obj *obj, int flags,
|
||||
const char *executable,
|
||||
char * const *argv,
|
||||
char * const *env,
|
||||
const char *outname,
|
||||
const char *errname, int *err);
|
||||
|
||||
/* Return a stream for a temporary file to pass to the first program
|
||||
in the pipeline as input. The file name is chosen as for pex_run.
|
||||
pex_run closes the file automatically; don't close it yourself. */
|
||||
|
||||
extern FILE *pex_input_file (struct pex_obj *obj, int flags,
|
||||
const char *in_name);
|
||||
|
||||
/* Return a stream for a pipe connected to the standard input of the
|
||||
first program in the pipeline. You must have passed
|
||||
`PEX_USE_PIPES' to `pex_init'. Close the returned stream
|
||||
yourself. */
|
||||
|
||||
extern FILE *pex_input_pipe (struct pex_obj *obj, int binary);
|
||||
|
||||
/* Read the standard output of the last program to be executed.
|
||||
pex_run can not be called after this. BINARY should be non-zero if
|
||||
the file should be opened in binary mode; this is ignored on Unix.
|
||||
Returns NULL on error. Don't call fclose on the returned FILE; it
|
||||
will be closed by pex_free. */
|
||||
|
||||
extern FILE *pex_read_output (struct pex_obj *, int binary);
|
||||
|
||||
/* Read the standard error of the last program to be executed.
|
||||
pex_run can not be called after this. BINARY should be non-zero if
|
||||
the file should be opened in binary mode; this is ignored on Unix.
|
||||
Returns NULL on error. Don't call fclose on the returned FILE; it
|
||||
will be closed by pex_free. */
|
||||
|
||||
extern FILE *pex_read_err (struct pex_obj *, int binary);
|
||||
|
||||
/* Return exit status of all programs in VECTOR. COUNT indicates the
|
||||
size of VECTOR. The status codes in the vector are in the order of
|
||||
the calls to pex_run. Returns 0 on error, 1 on success. */
|
||||
|
||||
extern int pex_get_status (struct pex_obj *, int count, int *vector);
|
||||
|
||||
/* Return times of all programs in VECTOR. COUNT indicates the size
|
||||
of VECTOR. struct pex_time is really just struct timeval, but that
|
||||
is not portable to all systems. Returns 0 on error, 1 on
|
||||
success. */
|
||||
|
||||
struct pex_time
|
||||
{
|
||||
unsigned long user_seconds;
|
||||
unsigned long user_microseconds;
|
||||
unsigned long system_seconds;
|
||||
unsigned long system_microseconds;
|
||||
};
|
||||
|
||||
extern int pex_get_times (struct pex_obj *, int count,
|
||||
struct pex_time *vector);
|
||||
|
||||
/* Clean up a pex_obj. If you have not called pex_get_times or
|
||||
pex_get_status, this will try to kill the subprocesses. */
|
||||
|
||||
extern void pex_free (struct pex_obj *);
|
||||
|
||||
/* Just execute one program. Return value is as for pex_run.
|
||||
FLAGS Combination of PEX_SEARCH and PEX_STDERR_TO_STDOUT.
|
||||
EXECUTABLE As for pex_run.
|
||||
ARGV As for pex_run.
|
||||
PNAME As for pex_init.
|
||||
OUTNAME As for pex_run when PEX_LAST is set.
|
||||
ERRNAME As for pex_run.
|
||||
STATUS Set to exit status on success.
|
||||
ERR As for pex_run.
|
||||
*/
|
||||
|
||||
extern const char *pex_one (int flags, const char *executable,
|
||||
char * const *argv, const char *pname,
|
||||
const char *outname, const char *errname,
|
||||
int *status, int *err);
|
||||
|
||||
/* pexecute and pwait are the old pexecute interface, still here for
|
||||
backward compatibility. Don't use these for new code. Instead,
|
||||
use pex_init/pex_run/pex_get_status/pex_free, or pex_one. */
|
||||
|
||||
/* Definitions used by the pexecute routine. */
|
||||
|
||||
#define PEXECUTE_FIRST 1
|
||||
#define PEXECUTE_LAST 2
|
||||
#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST)
|
||||
#define PEXECUTE_SEARCH 4
|
||||
#define PEXECUTE_VERBOSE 8
|
||||
|
||||
/* Execute a program. */
|
||||
|
||||
extern int pexecute (const char *, char * const *, const char *,
|
||||
const char *, char **, char **, int);
|
||||
|
||||
/* Wait for pexecute to finish. */
|
||||
|
||||
extern int pwait (int, int *, int);
|
||||
|
||||
#if !HAVE_DECL_ASPRINTF
|
||||
/* Like sprintf but provides a pointer to malloc'd storage, which must
|
||||
be freed by the caller. */
|
||||
|
||||
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_VASPRINTF
|
||||
/* Like vsprintf but provides a pointer to malloc'd storage, which
|
||||
must be freed by the caller. */
|
||||
|
||||
extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF
|
||||
/* Like sprintf but prints at most N characters. */
|
||||
extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF
|
||||
/* Like vsprintf but prints at most N characters. */
|
||||
extern int vsnprintf (char *, size_t, const char *, va_list) ATTRIBUTE_PRINTF(3,0);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP
|
||||
/* Compare version strings. */
|
||||
extern int strverscmp (const char *, const char *);
|
||||
#endif
|
||||
|
||||
/* Set the title of a process */
|
||||
extern void setproctitle (const char *name, ...);
|
||||
|
||||
/* Increase stack limit if possible. */
|
||||
extern void stack_limit_increase (unsigned long);
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
|
||||
|
||||
/* Drastically simplified alloca configurator. If we're using GCC,
|
||||
we use __builtin_alloca; otherwise we use the C alloca. The C
|
||||
alloca is always available. You can override GCC by defining
|
||||
USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is
|
||||
also set/unset as it is often used to indicate whether code needs
|
||||
to call alloca(0). */
|
||||
extern void *C_alloca (size_t) ATTRIBUTE_MALLOC;
|
||||
#undef alloca
|
||||
#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA
|
||||
# define alloca(x) __builtin_alloca(x)
|
||||
# undef C_ALLOCA
|
||||
# define ASTRDUP(X) \
|
||||
(__extension__ ({ const char *const libiberty_optr = (X); \
|
||||
const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \
|
||||
char *const libiberty_nptr = (char *const) alloca (libiberty_len); \
|
||||
(char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); }))
|
||||
#else
|
||||
# define alloca(x) C_alloca(x)
|
||||
# undef USE_C_ALLOCA
|
||||
# define USE_C_ALLOCA 1
|
||||
# undef C_ALLOCA
|
||||
# define C_ALLOCA 1
|
||||
extern const char *libiberty_optr;
|
||||
extern char *libiberty_nptr;
|
||||
extern unsigned long libiberty_len;
|
||||
# define ASTRDUP(X) \
|
||||
(libiberty_optr = (X), \
|
||||
libiberty_len = strlen (libiberty_optr) + 1, \
|
||||
libiberty_nptr = (char *) alloca (libiberty_len), \
|
||||
(char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* ! defined (LIBIBERTY_H) */
|
@@ -7,12 +7,12 @@
|
||||
// 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.
|
||||
//
|
||||
//
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
@@ -77,7 +77,7 @@ namespace __cxxabiv1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace std
|
||||
namespace std
|
||||
{
|
||||
/**
|
||||
* @brief Part of RTTI.
|
||||
@@ -85,7 +85,7 @@ namespace std
|
||||
* The @c type_info class describes type information generated by
|
||||
* an implementation.
|
||||
*/
|
||||
class type_info
|
||||
class type_info
|
||||
{
|
||||
public:
|
||||
/** Destructor first. Being the first non-inline virtual function, this
|
||||
@@ -169,9 +169,9 @@ namespace std
|
||||
|
||||
protected:
|
||||
const char *__name;
|
||||
|
||||
|
||||
explicit type_info(const char *__n): __name(__n) { }
|
||||
|
||||
|
||||
private:
|
||||
/// Assigning type_info is not supported.
|
||||
type_info& operator=(const type_info&);
|
||||
@@ -184,7 +184,7 @@ namespace std
|
||||
*
|
||||
* If you attempt an invalid @c dynamic_cast expression, an instance of
|
||||
* this class (or something derived from this class) is thrown. */
|
||||
class bad_cast : public exception
|
||||
class bad_cast : public exception
|
||||
{
|
||||
public:
|
||||
bad_cast() _GLIBCXX_USE_NOEXCEPT { }
|
||||
@@ -196,12 +196,12 @@ namespace std
|
||||
// See comment in eh_exception.cc.
|
||||
virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* @brief Thrown when a NULL pointer in a @c typeid expression is used.
|
||||
* @ingroup exceptions
|
||||
*/
|
||||
class bad_typeid : public exception
|
||||
class bad_typeid : public exception
|
||||
{
|
||||
public:
|
||||
bad_typeid () _GLIBCXX_USE_NOEXCEPT { }
|
||||
|
@@ -174,7 +174,7 @@ typedef enum {
|
||||
} __cxa_type_match_result;
|
||||
extern "C" __cxa_type_match_result __cxa_type_match(_Unwind_Exception*,
|
||||
const std::type_info*,
|
||||
bool, void**);
|
||||
bool, void**);
|
||||
extern "C" bool __cxa_begin_cleanup (_Unwind_Exception*);
|
||||
extern "C" void __cxa_end_cleanup (void);
|
||||
#endif
|
||||
|
@@ -47,7 +47,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
if (terminating)
|
||||
{
|
||||
fputs("terminate called recursively\n", stderr);
|
||||
abort ();
|
||||
abort ();
|
||||
}
|
||||
terminating = true;
|
||||
|
||||
@@ -61,8 +61,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
{
|
||||
int status = -1;
|
||||
char *dem = 0;
|
||||
|
||||
// dem = __cxa_demangle(name, 0, 0, &status);
|
||||
|
||||
dem = __cxa_demangle(name, 0, 0, &status);
|
||||
|
||||
fputs("terminate called after throwing an instance of '", stderr);
|
||||
if (status == 0)
|
||||
@@ -91,7 +91,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
}
|
||||
else
|
||||
fputs("terminate called without an active exception\n", stderr);
|
||||
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user