forked from KolibriOS/kolibrios
libsupc++ Makefile
git-svn-id: svn://kolibrios.org@6556 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b6f602747e
commit
3c17dd1ccd
@ -35,13 +35,13 @@ cxx98_sources = \
|
|||||||
src/c++98/compatibility-debug_list-2.cc
|
src/c++98/compatibility-debug_list-2.cc
|
||||||
|
|
||||||
cxx11_sources = \
|
cxx11_sources = \
|
||||||
compatibility-c++0x.cc \
|
src/c++11/compatibility-c++0x.cc \
|
||||||
compatibility-atomic-c++0x.cc \
|
src/c++11/compatibility-atomic-c++0x.cc \
|
||||||
compatibility-thread-c++0x.cc \
|
src/c++11/compatibility-thread-c++0x.cc \
|
||||||
compatibility-chrono.cc \
|
src/c++11/compatibility-chrono.cc \
|
||||||
compatibility-condvar.cc
|
src/c++11/compatibility-condvar.cc
|
||||||
|
|
||||||
compat_sources = $(cxx98_sources)
|
compat_sources = $(cxx98_sources) $(cxx11_sources)
|
||||||
|
|
||||||
cow_string_host_sources = \
|
cow_string_host_sources = \
|
||||||
src/c++98/collate_members_cow.cc \
|
src/c++98/collate_members_cow.cc \
|
||||||
@ -244,7 +244,19 @@ src/c++98/parallel_settings.o: src/c++98/parallel_settings.cc
|
|||||||
|
|
||||||
|
|
||||||
src/c++11/hashtable_c++0x.o: src/c++11/hashtable_c++0x.cc
|
src/c++11/hashtable_c++0x.o: src/c++11/hashtable_c++0x.cc
|
||||||
$(CXXCOMPILE) -fimplicit-templates -o $@ $<
|
$(CXXCOMPILE) -std=gnu++11 -fimplicit-templates -o $@ $<
|
||||||
|
|
||||||
|
src/c++11/compatibility-c++0x.o: src/c++11/compatibility-c++0x.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
src/c++11/compatibility-thread-c++0x.o: src/c++11/compatibility-thread-c++0x.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
src/c++11/compatibility-chrono.o: src/c++11/compatibility-chrono.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
src/c++11/compatibility-condvar.o: src/c++11/compatibility-condvar.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f *.o
|
-rm -f *.o
|
||||||
|
@ -6,68 +6,81 @@ LD = kos32-ld
|
|||||||
CPP= kos32-g++
|
CPP= kos32-g++
|
||||||
STRIP = kos32-strip
|
STRIP = kos32-strip
|
||||||
|
|
||||||
|
INSTALLDIR:= /home/autobuild/tools/win32/mingw32/lib
|
||||||
|
|
||||||
|
export SDK_DIR:= $(abspath ../../../../../sdk)
|
||||||
|
|
||||||
CFLAGS = -U_Win32 -U_WIN32 -U__MINGW32__ -c -O2 -fno-ident -fomit-frame-pointer
|
CFLAGS = -U_Win32 -U_WIN32 -U__MINGW32__ -c -O2 -fno-ident -fomit-frame-pointer
|
||||||
CPPFLAGS = -fno-rtti
|
CFLAGSCPP = -nostdinc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi
|
||||||
|
CFLAGSCPP+= -fdiagnostics-show-location=once -ffunction-sections -fdata-sections
|
||||||
|
|
||||||
ARFLAGS= crs
|
ARFLAGS= crs
|
||||||
|
|
||||||
INCLUDES= -I. -I../include/mingw32 -I../include -I../../newlib/libc/include -I/home/autobuild/tools/win32/include
|
GLIBCXX_INCLUDE_DIR= ../include
|
||||||
|
INCLUDES= -I../include/mingw32 -I../include -I./ -I$(SDK_DIR)/sources/newlib/libc/include
|
||||||
|
|
||||||
LIBS:= -ldll -lc.dll
|
DEFINES= -D_GLIBCXX_HAVE_TLS
|
||||||
|
|
||||||
DEFINES= -DHAVE_CONFIG_H -DIN_GCC -DIN_GLIBCPP_V3 -DUSE_EMUTLS=1 -D_GLIBCXX_HAVE_TLS
|
C_COMPILE= $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES)
|
||||||
|
CXXCOMPILE= $(CPP) $(CFLAGS) $(CFLAGSCPP) $(INCLUDES) $(DEFINES)
|
||||||
|
|
||||||
|
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
cp-demangle.c \
|
cp-demangle.c \
|
||||||
array_type_info.cc \
|
array_type_info.cc \
|
||||||
atexit_thread.cc \
|
atexit_arm.cc \
|
||||||
bad_alloc.cc \
|
atexit_thread.cc \
|
||||||
bad_cast.cc \
|
bad_alloc.cc \
|
||||||
bad_typeid.cc \
|
bad_array_length.cc \
|
||||||
class_type_info.cc \
|
bad_array_new.cc \
|
||||||
del_op.cc \
|
bad_cast.cc \
|
||||||
del_opnt.cc \
|
bad_typeid.cc \
|
||||||
del_opv.cc \
|
class_type_info.cc \
|
||||||
del_opvnt.cc \
|
del_op.cc \
|
||||||
dyncast.cc \
|
del_ops.cc \
|
||||||
eh_alloc.cc \
|
del_opnt.cc \
|
||||||
eh_aux_runtime.cc \
|
del_opv.cc \
|
||||||
eh_call.cc \
|
del_opvs.cc \
|
||||||
eh_catch.cc \
|
del_opvnt.cc \
|
||||||
eh_exception.cc \
|
dyncast.cc \
|
||||||
eh_globals.cc \
|
eh_alloc.cc \
|
||||||
eh_personality.cc \
|
eh_arm.cc \
|
||||||
eh_ptr.cc \
|
eh_aux_runtime.cc \
|
||||||
eh_term_handler.cc \
|
eh_call.cc \
|
||||||
eh_terminate.cc \
|
eh_catch.cc \
|
||||||
eh_throw.cc \
|
eh_exception.cc \
|
||||||
eh_tm.cc \
|
eh_globals.cc \
|
||||||
eh_type.c \
|
eh_personality.cc \
|
||||||
eh_unex_handler.cc \
|
eh_ptr.cc \
|
||||||
enum_type_info.cc \
|
eh_term_handler.cc \
|
||||||
function_type_info.cc \
|
eh_terminate.cc \
|
||||||
fundamental_type_info.cc \
|
eh_tm.cc \
|
||||||
guard.cc \
|
eh_throw.cc \
|
||||||
guard_error.cc \
|
eh_type.cc \
|
||||||
hash_bytes.cc \
|
eh_unex_handler.cc \
|
||||||
nested_exception.cc \
|
enum_type_info.cc \
|
||||||
new_handler.cc \
|
function_type_info.cc \
|
||||||
new_op.cc \
|
fundamental_type_info.cc \
|
||||||
new_opnt.cc \
|
guard.cc \
|
||||||
new_opv.cc \
|
guard_error.cc \
|
||||||
new_opvnt.cc \
|
hash_bytes.cc \
|
||||||
pbase_type_info.cc \
|
nested_exception.cc \
|
||||||
pmem_type_info.cc \
|
new_handler.cc \
|
||||||
pointer_type_info.cc \
|
new_op.cc \
|
||||||
pure.cc \
|
new_opnt.cc \
|
||||||
si_class_type_info.cc \
|
new_opv.cc \
|
||||||
tinfo.cc \
|
new_opvnt.cc \
|
||||||
tinfo2.cc \
|
pbase_type_info.cc \
|
||||||
vec.cc \
|
pmem_type_info.cc \
|
||||||
vmi_class_type_info.cc \
|
pointer_type_info.cc \
|
||||||
vterminate.cc
|
pure.cc \
|
||||||
|
si_class_type_info.cc \
|
||||||
|
tinfo.cc \
|
||||||
|
tinfo2.cc \
|
||||||
|
vec.cc \
|
||||||
|
vmi_class_type_info.cc \
|
||||||
|
vterminate.cc
|
||||||
|
|
||||||
|
|
||||||
OBJECTS = $(patsubst %.cc, %.o, $(patsubst %.c, %.o, $(SOURCES)))
|
OBJECTS = $(patsubst %.cc, %.o, $(patsubst %.c, %.o, $(SOURCES)))
|
||||||
|
|
||||||
@ -76,29 +89,60 @@ OBJECTS = $(patsubst %.cc, %.o, $(patsubst %.c, %.o, $(SOURCES)))
|
|||||||
all:$(LIBRARY).a
|
all:$(LIBRARY).a
|
||||||
|
|
||||||
$(LIBRARY).a: $(OBJECTS) Makefile
|
$(LIBRARY).a: $(OBJECTS) Makefile
|
||||||
$(AR) $(ARFLAGS) $(LIBRARY).a $(OBJECTS)
|
$(AR) $(ARFLAGS) $(LIBRARY).a $(OBJECTS)
|
||||||
mv -f $(LIBRARY).a ../../../lib
|
mv -f $(LIBRARY).a $(INSTALLDIR)
|
||||||
|
|
||||||
|
|
||||||
%.o : %.c Makefile
|
|
||||||
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
|
||||||
|
|
||||||
%.o : %.cc Makefile
|
%.o : %.cc Makefile
|
||||||
$(CPP) $(CFLAGS) $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
$(CXXCOMPILE) -o $@ $<
|
||||||
|
|
||||||
eh_ptr.o: eh_ptr.cc
|
|
||||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
cp-demangle.o: cp-demangle.c
|
||||||
|
$(C_COMPILE) -DHAVE_CONFIG_H -D_USE_32BIT_TIME_T -DIN_GLIBCPP_V3 -Wno-error -o $@ $<
|
||||||
|
|
||||||
|
bad_array_length.o: bad_array_length.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
bad_array_new.o: bad_array_new.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
eh_aux_runtime.o: eh_aux_runtime.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
eh_ptr.o: eh_ptr.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
eh_terminate.o: eh_terminate.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
eh_throw.o: eh_throw.cc
|
eh_throw.o: eh_throw.cc
|
||||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
guard.o: guard.cc
|
guard.o: guard.cc
|
||||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
atexit_thread.o: atexit_thread.cc
|
atexit_thread.o: atexit_thread.cc
|
||||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
nested_exception.o: nested_exception.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
new_handler.o: new_handler.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
new_op.o: new_op.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
new_opnt.o: new_opnt.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
|
||||||
|
|
||||||
|
del_ops.o: del_ops.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++14 -o $@ $<
|
||||||
|
|
||||||
|
del_opvs.o: del_opvs.cc
|
||||||
|
$(CXXCOMPILE) -std=gnu++14 -o $@ $<
|
||||||
|
|
||||||
nested_exception.o: nested_exception.cc
|
|
||||||
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f *.o
|
-rm -f *.o
|
||||||
|
@ -2302,7 +2302,7 @@ cplus_demangle_type (struct d_info *di)
|
|||||||
*pret = d_function_type (di);
|
*pret = d_function_type (di);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*pret = cplus_demangle_type (di);
|
*pret = cplus_demangle_type (di);
|
||||||
if (!*pret)
|
if (!*pret)
|
||||||
return NULL;
|
return NULL;
|
||||||
if ((*pret)->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS
|
if ((*pret)->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS
|
||||||
@ -2397,11 +2397,11 @@ cplus_demangle_type (struct d_info *di)
|
|||||||
candidate. */
|
candidate. */
|
||||||
if (! di->is_conversion)
|
if (! di->is_conversion)
|
||||||
{
|
{
|
||||||
if (! d_add_substitution (di, ret))
|
if (! d_add_substitution (di, ret))
|
||||||
return NULL;
|
return NULL;
|
||||||
ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
|
ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
|
||||||
d_template_args (di));
|
d_template_args (di));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct demangle_component *args;
|
struct demangle_component *args;
|
||||||
@ -4109,7 +4109,7 @@ cplus_demangle_print_callback (int options,
|
|||||||
* sizeof (*dpi.copy_templates));
|
* sizeof (*dpi.copy_templates));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
d_print_comp (&dpi, options, dc);
|
d_print_comp (&dpi, options, dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
d_print_flush (&dpi);
|
d_print_flush (&dpi);
|
||||||
@ -4334,7 +4334,7 @@ d_get_saved_scope (struct d_print_info *dpi,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
d_print_comp_inner (struct d_print_info *dpi, int options,
|
d_print_comp_inner (struct d_print_info *dpi, int options,
|
||||||
const struct demangle_component *dc)
|
const struct demangle_component *dc)
|
||||||
{
|
{
|
||||||
/* Magic variable to let reference smashing skip over the next modifier
|
/* Magic variable to let reference smashing skip over the next modifier
|
||||||
without needing to modify *dc. */
|
without needing to modify *dc. */
|
||||||
@ -5785,9 +5785,9 @@ d_print_expr_op (struct d_print_info *dpi, int options,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
d_print_cast (struct d_print_info *dpi, int options,
|
d_print_cast (struct d_print_info *dpi, int options,
|
||||||
const struct demangle_component *dc)
|
const struct demangle_component *dc)
|
||||||
{
|
{
|
||||||
d_print_comp (dpi, options, d_left (dc));
|
d_print_comp (dpi, options, d_left (dc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print a conversion operator. */
|
/* Print a conversion operator. */
|
||||||
@ -5821,7 +5821,7 @@ d_print_conversion (struct d_print_info *dpi, int options,
|
|||||||
parameters from scope after printing the operator name,
|
parameters from scope after printing the operator name,
|
||||||
so we need to handle the template printing here. */
|
so we need to handle the template printing here. */
|
||||||
if (dpi->current_template != NULL)
|
if (dpi->current_template != NULL)
|
||||||
dpi->templates = dpt.next;
|
dpi->templates = dpt.next;
|
||||||
|
|
||||||
if (d_last_char (dpi) == '<')
|
if (d_last_char (dpi) == '<')
|
||||||
d_append_char (dpi, ' ');
|
d_append_char (dpi, ' ');
|
||||||
|
@ -122,6 +122,11 @@ struct d_info
|
|||||||
mangled name to the demangled name, such as standard
|
mangled name to the demangled name, such as standard
|
||||||
substitutions and builtin types. */
|
substitutions and builtin types. */
|
||||||
int expansion;
|
int expansion;
|
||||||
|
/* Non-zero if we are parsing an expression. */
|
||||||
|
int is_expression;
|
||||||
|
/* Non-zero if we are parsing the type operand of a conversion
|
||||||
|
operator, but not when in an expression. */
|
||||||
|
int is_conversion;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* To avoid running past the ending '\0', don't:
|
/* To avoid running past the ending '\0', don't:
|
||||||
|
@ -63,9 +63,10 @@ extern "C" {
|
|||||||
#define DMGL_EDG (1 << 13)
|
#define DMGL_EDG (1 << 13)
|
||||||
#define DMGL_GNU_V3 (1 << 14)
|
#define DMGL_GNU_V3 (1 << 14)
|
||||||
#define DMGL_GNAT (1 << 15)
|
#define DMGL_GNAT (1 << 15)
|
||||||
|
#define DMGL_DLANG (1 << 16)
|
||||||
|
|
||||||
/* If none of these are set, use 'current_demangling_style' as the default. */
|
/* 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)
|
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG)
|
||||||
|
|
||||||
/* Enumeration of possible demangling styles.
|
/* Enumeration of possible demangling styles.
|
||||||
|
|
||||||
@ -87,7 +88,8 @@ extern enum demangling_styles
|
|||||||
edg_demangling = DMGL_EDG,
|
edg_demangling = DMGL_EDG,
|
||||||
gnu_v3_demangling = DMGL_GNU_V3,
|
gnu_v3_demangling = DMGL_GNU_V3,
|
||||||
java_demangling = DMGL_JAVA,
|
java_demangling = DMGL_JAVA,
|
||||||
gnat_demangling = DMGL_GNAT
|
gnat_demangling = DMGL_GNAT,
|
||||||
|
dlang_demangling = DMGL_DLANG
|
||||||
} current_demangling_style;
|
} current_demangling_style;
|
||||||
|
|
||||||
/* Define string names for the various demangling styles. */
|
/* Define string names for the various demangling styles. */
|
||||||
@ -102,6 +104,7 @@ extern enum demangling_styles
|
|||||||
#define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3"
|
#define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3"
|
||||||
#define JAVA_DEMANGLING_STYLE_STRING "java"
|
#define JAVA_DEMANGLING_STYLE_STRING "java"
|
||||||
#define GNAT_DEMANGLING_STYLE_STRING "gnat"
|
#define GNAT_DEMANGLING_STYLE_STRING "gnat"
|
||||||
|
#define DLANG_DEMANGLING_STYLE_STRING "dlang"
|
||||||
|
|
||||||
/* Some macros to test what demangling style is active. */
|
/* Some macros to test what demangling style is active. */
|
||||||
|
|
||||||
@ -115,6 +118,7 @@ extern enum demangling_styles
|
|||||||
#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)
|
#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)
|
||||||
#define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)
|
#define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)
|
||||||
#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
|
#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
|
||||||
|
#define DLANG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_DLANG)
|
||||||
|
|
||||||
/* Provide information about the available demangle styles. This code is
|
/* Provide information about the available demangle styles. This code is
|
||||||
pulled from gdb into libiberty because it is useful to binutils also. */
|
pulled from gdb into libiberty because it is useful to binutils also. */
|
||||||
@ -169,10 +173,17 @@ java_demangle_v3 (const char *mangled);
|
|||||||
char *
|
char *
|
||||||
ada_demangle (const char *mangled, int options);
|
ada_demangle (const char *mangled, int options);
|
||||||
|
|
||||||
|
extern char *
|
||||||
|
dlang_demangle (const char *mangled, int options);
|
||||||
|
|
||||||
enum gnu_v3_ctor_kinds {
|
enum gnu_v3_ctor_kinds {
|
||||||
gnu_v3_complete_object_ctor = 1,
|
gnu_v3_complete_object_ctor = 1,
|
||||||
gnu_v3_base_object_ctor,
|
gnu_v3_base_object_ctor,
|
||||||
gnu_v3_complete_object_allocating_ctor,
|
gnu_v3_complete_object_allocating_ctor,
|
||||||
|
/* These are not part of the V3 ABI. Unified constructors are generated
|
||||||
|
as a speed-for-space optimization when the -fdeclone-ctor-dtor option
|
||||||
|
is used, and are always internal symbols. */
|
||||||
|
gnu_v3_unified_ctor,
|
||||||
gnu_v3_object_ctor_group
|
gnu_v3_object_ctor_group
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -188,6 +199,10 @@ enum gnu_v3_dtor_kinds {
|
|||||||
gnu_v3_deleting_dtor = 1,
|
gnu_v3_deleting_dtor = 1,
|
||||||
gnu_v3_complete_object_dtor,
|
gnu_v3_complete_object_dtor,
|
||||||
gnu_v3_base_object_dtor,
|
gnu_v3_base_object_dtor,
|
||||||
|
/* These are not part of the V3 ABI. Unified destructors are generated
|
||||||
|
as a speed-for-space optimization when the -fdeclone-ctor-dtor option
|
||||||
|
is used, and are always internal symbols. */
|
||||||
|
gnu_v3_unified_dtor,
|
||||||
gnu_v3_object_dtor_group
|
gnu_v3_object_dtor_group
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -365,6 +380,10 @@ enum demangle_component_type
|
|||||||
/* A typecast, represented as a unary operator. The one subtree is
|
/* A typecast, represented as a unary operator. The one subtree is
|
||||||
the type to which the argument should be cast. */
|
the type to which the argument should be cast. */
|
||||||
DEMANGLE_COMPONENT_CAST,
|
DEMANGLE_COMPONENT_CAST,
|
||||||
|
/* A conversion operator, represented as a unary operator. The one
|
||||||
|
subtree is the type to which the argument should be converted
|
||||||
|
to. */
|
||||||
|
DEMANGLE_COMPONENT_CONVERSION,
|
||||||
/* A nullary expression. The left subtree is the operator. */
|
/* A nullary expression. The left subtree is the operator. */
|
||||||
DEMANGLE_COMPONENT_NULLARY,
|
DEMANGLE_COMPONENT_NULLARY,
|
||||||
/* A unary expression. The left subtree is the operator, and the
|
/* A unary expression. The left subtree is the operator, and the
|
||||||
|
@ -1,150 +0,0 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#include <sys/errno.h>
|
|
||||||
#include <kos32sys.h>
|
|
||||||
|
|
||||||
void __mutex_lock(volatile int *val);
|
|
||||||
|
|
||||||
static inline int tls_get(int key)
|
|
||||||
{
|
|
||||||
int val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"movl %%fs:(%1), %0"
|
|
||||||
:"=r"(val)
|
|
||||||
:"r"(key));
|
|
||||||
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int done;
|
|
||||||
long started;
|
|
||||||
} __gthread_once_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int counter;
|
|
||||||
void *sema;
|
|
||||||
} __gthread_mutex_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int counter;
|
|
||||||
int depth;
|
|
||||||
unsigned long owner;
|
|
||||||
int sema;
|
|
||||||
} __gthread_recursive_mutex_t;
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
__gthr_win32_once (__gthread_once_t *once, void (*func) (void))
|
|
||||||
{
|
|
||||||
if (once == NULL || func == NULL)
|
|
||||||
return EINVAL;
|
|
||||||
|
|
||||||
if (! once->done)
|
|
||||||
{
|
|
||||||
if (__sync_add_and_fetch (&(once->started), 1) == 0)
|
|
||||||
{
|
|
||||||
(*func) ();
|
|
||||||
once->done = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Another thread is currently executing the code, so wait for it
|
|
||||||
to finish; yield the CPU in the meantime. If performance
|
|
||||||
does become an issue, the solution is to use an Event that
|
|
||||||
we wait on here (and set above), but that implies a place to
|
|
||||||
create the event before this routine is called. */
|
|
||||||
while (! once->done)
|
|
||||||
delay(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void __gthr_win32_mutex_init_function (__gthread_mutex_t *mutex)
|
|
||||||
{
|
|
||||||
mutex->counter = 0;
|
|
||||||
mutex->sema = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __gthr_win32_mutex_lock (__gthread_mutex_t *mutex)
|
|
||||||
{
|
|
||||||
__mutex_lock(&mutex->counter);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__gthr_win32_mutex_unlock (__gthread_mutex_t *mutex)
|
|
||||||
{
|
|
||||||
mutex->counter = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
__gthr_win32_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
|
|
||||||
{
|
|
||||||
mutex->counter = -1;
|
|
||||||
mutex->depth = 0;
|
|
||||||
mutex->owner = 0;
|
|
||||||
mutex->sema = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
__gthr_win32_mutex_destroy (__gthread_mutex_t *mutex)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
int
|
|
||||||
__gthr_win32_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
|
|
||||||
{
|
|
||||||
int me = tls_get(0);
|
|
||||||
if ( __sync_add_and_fetch(&mutex->counter, 1) == 0)
|
|
||||||
{
|
|
||||||
mutex->depth = 1;
|
|
||||||
mutex->owner = me;
|
|
||||||
mutex->sema = 1;
|
|
||||||
}
|
|
||||||
else if (mutex->owner == me)
|
|
||||||
{
|
|
||||||
__sync_sub_and_fetch(&mutex->counter, 1);
|
|
||||||
++(mutex->depth);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
__mutex_lock(&mutex->sema);
|
|
||||||
mutex->depth = 1;
|
|
||||||
mutex->owner = me;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__gthr_win32_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
|
|
||||||
{
|
|
||||||
int me = tls_get(0);
|
|
||||||
if (__sync_val_compare_and_swap (&mutex->counter, -1, 0) < 0)
|
|
||||||
{
|
|
||||||
mutex->depth = 1;
|
|
||||||
mutex->owner = me;
|
|
||||||
mutex->sema = 1;
|
|
||||||
}
|
|
||||||
else if (mutex->owner == me)
|
|
||||||
++(mutex->depth);
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__gthr_win32_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
|
|
||||||
{
|
|
||||||
--(mutex->depth);
|
|
||||||
if (mutex->depth == 0)
|
|
||||||
{
|
|
||||||
mutex->owner = 0;
|
|
||||||
|
|
||||||
if (__sync_sub_and_fetch (&mutex->counter, 1) >= 0)
|
|
||||||
mutex->sema = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user