Commit Graph

112 Commits

Author SHA1 Message Date
Jason Merrill f000c6a763 re PR c++/4926 (C++ ABI needs clarification on mangling of complex expressions)
PR c++/4926
	PR c++/38600
	* mangle.c (write_unqualified_id): Split out from write_expression.
	(write_unqualified_name): Call it.
	(write_member_name): Likewise.
	(write_expression): Support TEMPLATE_ID_EXPR.
	Disambiguate operator names.

From-SVN: r156482
2010-02-03 15:42:48 -05:00
Jason Merrill abfe01cec9 re PR c++/12909 (ambiguity in mangling vector types)
PR c++/12909
	* mangle.c (write_type) [VECTOR_TYPE]: Change mangling.

From-SVN: r156481
2010-02-03 15:42:35 -05:00
Ian Lance Taylor 79b754d47f cp-demangle.c (cplus_demangle_type): Check for invalid type after "DF".
* cp-demangle.c (cplus_demangle_type): Check for invalid type
	after "DF".
	* testsuite/demangle-expected: Add test.

From-SVN: r156226
2010-01-26 04:05:32 +00:00
Jason Merrill 4d43dcdeb5 re PR c++/42338 ([c++0x] ICE on decltype usage with templates)
PR c++/42338
	* mangle.c (write_expression): Handle tree codes that have extra
	arguments in the middle-end.
	* cp-demangle.c (d_print_comp): Fix array index printing.

From-SVN: r156103
2010-01-20 20:58:53 -05:00
H.J. Lu 9b2adcdbc1 Return dgs.alc on success
libiberty/

2010-01-09  Ian Lance Taylor  <iant@google.com>

	PR other/42230
	* cp-demangle.c (d_demangle): Return dgs.alc on success.

libstdc++-v3/

2010-01-09  H.J. Lu  <hongjiu.lu@intel.com>

	PR other/42230
	* testsuite/abi/pr42230.cc: New.

From-SVN: r155785
2010-01-09 16:24:52 -08:00
Jason Merrill d5f4edddeb merge in cxx0x-lambdas-branch@152308
From-SVN: r152318
2009-09-29 23:01:30 -04:00
Jan Kratochvil 23b1a789fd demangle.h (enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>) (enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS>): New.
include
2009-07-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* demangle.h
	(enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
	(enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS>):
	New.
libiberty
2009-07-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* cp-demangle.c (d_print_comp <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
	(d_print_comp <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS): New.
	(d_make_comp <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
	(d_make_comp <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS): New.
	(d_demangle_callback): The variable type is now declared as enum.
	Replace parser of _GLOBAL_ symbols by a d_make_comp call.

From-SVN: r149756
2009-07-17 19:09:54 +00:00
Ian Lance Taylor 7859dde7ee cp-demangle.c (cplus_demangle_fill_ctor): Fix logic bug.
* cp-demangle.c (cplus_demangle_fill_ctor): Fix logic bug.
	(cplus_demangle_fill_dtor): Likewise.

Co-Authored-By: Ben Elliston <bje@au.ibm.com>

From-SVN: r147699
2009-05-19 12:42:13 +10:00
Jason Merrill 6afcfe0a80 pt.c (make_fnparm_pack): Split out from...
* gcc/cp/pt.c (make_fnparm_pack): Split out from...
        (instantiate_decl): ...here.
        (tsubst_pack_expansion): Handle being called in a late-specified
        return type.
        * libiberty/cp-demangle.c (d_expression): Handle pack expansion.
        (d_find_pack): Handle DEMANGLE_COMPONENT_FUNCTION_PARAM.
        (d_print_subexpr): Don't wrap function parms in ().
        (d_print_comp) [DEMANGLE_COMPONENT_PACK_EXPANSION]: Handle
        not finding a pack.

From-SVN: r145013
2009-03-23 17:03:01 -04:00
Jason Merrill 448545cb51 decl.c (grokfndecl): Set DECL_CONTEXT on parms.
cp/:
        * decl.c (grokfndecl): Set DECL_CONTEXT on parms.
        (duplicate_decls): Adjust DECL_CONTEXT of newdecl's parms.
        * pt.c (check_explicit_specialization): Likewise.
        (tsubst_copy) [PARM_DECL]: Return a dummy parm if we don't have a
        local specialization.
        * tree.c (cp_tree_equal) [PARM_DECL]: Check type and index, not name.
        * decl2.c (parm_index): New fn.
        * semantics.c (finish_decltype_type): Don't use describable_type.
        * mangle.c (write_expression): Likewise.  Mangle ALIGNOF_EXPR.
        Give a sorry for unsupported codes rather than crash.  Mangle
        conversions with other than 1 operand.  New mangling for PARM_DECL.
        * operators.def (ALIGNOF_EXPR): Mangle as az.
  
        * include/demangle.h (enum demangle_component_type): Add
        DEMANGLE_COMPONENT_FUNCTION_PARAM.
        * libiberty/cp-demangle.c (d_make_function_param): new fn.
        (cplus_demangle_mangled_name): Work around abi v2 bug.
        (d_expr_primary): Likewise.
        (cplus_demangle_operators): Add alignof ops.
        (d_expression): Handle function parameters and conversions
        with other than 1 operand.
        (d_print_comp): Handle function parameters.  Fix bug with
        function used in type of function.

From-SVN: r144924
2009-03-17 19:31:18 -04:00
Jason Merrill 30471e01ad * cp-demangle.c (d_expression): Remove mangling for zero-op casts.
From-SVN: r143161
2009-01-07 12:08:20 -05:00
Ben Elliston 381009fe75 cp-demangle.c (cplus_demangle_type): Return NULL if the character following a 'D' cannot be recognised.
* cp-demangle.c (cplus_demangle_type): Return NULL if the
	character following a 'D' cannot be recognised.

From-SVN: r143098
2009-01-06 09:14:16 +11:00
Jason Merrill 938e76ad6d re PR c++/38561 (Revision 142799 may cause C++ demangle failures)
PR c++/38561
        * cp-demangle.c (d_expression, d_print_comp): Revert
        cast changes.

From-SVN: r142814
2008-12-18 09:51:56 -05:00
Jason Merrill a77f94e240 semantics.c (describable_type): New function.
gcc/cp:
        * semantics.c (describable_type): New function.
        (finish_decltype_type): Use it for dependent exprs.
        * cp-tree.h: Declare it.
        * mangle.c (write_type) [DECLTYPE_TYPE]: Set skip_evaluation.
        (write_expression): If skip_evaluation, use type stubs.
        * tree.c (cp_tree_equal): Handle PARM_DECLs from different
        declarations of a function.
        * init.c (build_new): Do auto deduction if type is describable.
        * decl.c (cp_finish_decl): Likewise.
        * parser.c (cp_parser_omp_for_loop): Likewise.
gcc/testsuite:
        * g++.dg/cpp0x/auto6.C: Test more stuff.
        * g++.dg/cpp0x/auto12.C: New test.
libiberty:
        * cp-demangle.c (d_expression): Handle rvalue stubs too.
        [DEMANGLE_COMPONENT_CAST]: Update mangling.
        (d_print_comp): Avoid extra ", " with empty template argument packs.
        Remove handling for obsolete T() mangling.

From-SVN: r142799
2008-12-17 14:08:14 -05:00
Jason Merrill 07523e7c08 re PR c++/35319 (ICE throwing fixed-point types)
PR c++/35319
        * mangle.c (write_builtin_type): Add mangling for decimal floating
        point and fixed point types.
        (write_type): Pass FIXED_POINT_TYPE along.
        * cp-demangle.c (cplus_demangle_type): Support fixed-point types.
        (d_print_comp, d_dump): Likewise.

From-SVN: r142661
2008-12-10 17:11:44 -05:00
Jason Merrill 38179091cc PR c++/37376, other mangling issues
gcc/cp/:
        PR c++/37376, other mangling issues
        * mangle.c (write_type): Update TYPE_PACK_EXPANSION mangling.
        (write_member_name): Break out from...
        (write_expression): ...here.  Handle dependent COMPONENT_REF.
        (write_template_arg): Wrap an argument pack in 'I'/'E'.
        (write_builtin_type): Update char16/32_t mangling.
        (write_nested_name, write_prefix): Don't forget template args
        for typename types.
        * operators.def: Add ARROW_EXPR, update COMPONENT_REF and
        EXPR_PACK_EXPANSION.
libstdc++-v3/:
        * config/abi/pre/gnu.ver: Update char16/32_t manglings.
include/:
        * demangle.h (enum demangle_component_type): Add
        DEMANGLE_COMPONENT_PACK_EXPANSION.
libiberty/:
        * cp-demangle.c (struct d_print_info): Add pack_index.
        (d_dump): Add DEMANGLE_COMPONENT_PACK_EXPANSION.
        (d_make_comp): Likewise.  DEMANGLE_COMPONENT_ARGLIST and
        DEMANGLE_COMPONENT_TEMPLATE_ARGLIST can have two null args.
        (cplus_demangle_builtin_types): Add char16/32_t.
        (cplus_demangle_type): Recognize them.
        (d_template_args): Handle empty argument packs.
        (d_template_arg): Handle argument packs.
        (d_expression): Handle dependent name.
        (d_index_template_argument): New fn.
        (d_lookup_template_argument): New fn.
        (d_find_pack, d_pack_length): New fn.
        (d_print_subexpr): Split out...
        (d_print_comp): ...from here.  Use d_*_template_argument.
        Handle empty arg lists.  Support pack expansions.
        * cp-demangle.h (D_BUILTIN_TYPE_COUNT): Increase to 32.

From-SVN: r140916
2008-10-06 18:29:42 -04:00
Jason Merrill 5a3d7e74ca demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_DECLTYPE.
* include/demangle.h (enum demangle_component_type): Add
        DEMANGLE_COMPONENT_DECLTYPE.
        * libiberty/cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_DECLTYPE.
        (d_make_comp): Likewise.
        (cplus_demangle_type): Handle decltype and DFP types.
        (cplus_demangle_operators): Call operator takes 2 args.
        (cplus_demangle_builtin_types): Add DFP types.
        (d_exprlist): New fn.
        (d_expression): Handle parm placeholders, T() and calls.
        (d_print_comp): Handle decltype, T() and calls.
        * libiberty/testsuite/demangle-expected: Test the above.

From-SVN: r140162
2008-09-09 13:38:10 -04:00
Ian Lance Taylor 8935c4b347 Update copyright date.
From-SVN: r133762
2008-03-31 17:44:22 +00:00
Ian Lance Taylor eeda7b98fd cp-demangle.c (d_substitution): Correct overflow check to avoid -fstrict-overflow optimizations.
* cp-demangle.c (d_substitution): Correct overflow check to avoid
	-fstrict-overflow optimizations.

From-SVN: r133761
2008-03-31 17:38:38 +00:00
David Daney e5df4fb1fa demangle.h (demangle_component_type): Add DEMANGLE_COMPONENT_JAVA_RESOURCE...
include/
2008-01-26  David Daney  <ddaney@avtrex.com>

	* demangle.h (demangle_component_type):  Add
	DEMANGLE_COMPONENT_JAVA_RESOURCE,
	DEMANGLE_COMPONENT_COMPOUND_NAME, and
	DEMANGLE_COMPONENT_CHARACTER as new enum values.
	(demangle_component): Add struct s_character to union u.

libiberty/
2008-01-26  David Daney  <ddaney@avtrex.com>

	* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_JAVA_RESOURCE,
	DEMANGLE_COMPONENT_COMPOUND_NAME, and
	DEMANGLE_COMPONENT_CHARACTER cases.
	(d_make_comp): Handle DEMANGLE_COMPONENT_COMPOUND_NAME and
	DEMANGLE_COMPONENT_JAVA_RESOURCE cases.
	(d_make_character): New function.
	(d_java_resource): Same.
	(d_special_name): Handle "Gr" case.
	(d_print_comp): Handle DEMANGLE_COMPONENT_JAVA_RESOURCE,
	DEMANGLE_COMPONENT_COMPOUND_NAME, and
	DEMANGLE_COMPONENT_CHARACTER cases.
	* testsuite/demangle-expected: Add test for java resource name
	mangling.

From-SVN: r131883
2008-01-27 06:01:00 +00:00
Doug Gregor 1ab28be596 mangle.c (write_type): Change mangling of rvalue reference from `RR' to `O'.
2007-08-31  Douglas Gregor  <doug.gregor@gmail.com>

	* mangle.c (write_type): Change mangling of rvalue reference from
	`RR' to `O'. 

2007-08-31  Douglas Gregor  <doug.gregor@gmail.com>
	
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_RVALUE_REFERENCE. 

2007-08-31  Douglas Gregor  <doug.gregor@gmail.com>
	
	* cp-demangle.c (d_dump): Handle
	DEMANGLE_COMPONENT_RVALUE_REFERENCE. 
	(d_make_comp): Ditto.
	(cplus_demangle_type): Ditto.
	(d_print_comp): Ditto.
	(d_print_mod): Ditto.
	(d_print_function_type): Ditto.

2007-08-31  Douglas Gregor  <doug.gregor@gmail.com>

	* testsuite/abi/demangle/cxx0x/rref.cc: New.

From-SVN: r127999
2007-08-31 19:15:26 +00:00
Michael Snyder ac847e32a0 * cp-demangle.c (d_print_comp): Guard against null.
From-SVN: r127139
2007-08-01 17:29:40 -04:00
Geoffrey Keating a2aa65f063 Index: libiberty/ChangeLog
2007-05-04  Geoffrey Keating  <geoffk@apple.com>

	* cp-demangle.c (d_name): Detect local-source-name.
	(d_prefix): Likewise.
	(d_unqualified_name): Implement local-source-name.

Index: gcc/cp/ChangeLog
2007-05-04  Geoffrey Keating  <geoffk@apple.com>

	PR 31775
	* mangle.c (write_mangled_name): Mangle static variable names.
	(write_unqualified_name): Use local-source-name for
	namespace-scope static variables.

Index: gcc/testsuite/ChangeLog
2007-05-04  Geoffrey Keating  <geoffk@apple.com>

	PR 31775
	* g++.dg/other/nested-extern.cc: New.
	* g++.dg/other/nested-extern-1.C: New.
	* g++.dg/other/nested-extern-2.C: New.

From-SVN: r124467
2007-05-06 00:01:36 +00:00
Geoffrey Keating 771904f1e6 cp-demangle.c (d_encoding): Exit early on error.
* cp-demangle.c (d_encoding): Exit early on error.
	(d_pointer_to_member_type): Exit early if cplus_demangle_type
	returns NULL.
	(cplus_demangle_type): Likewise.
	* testsuite/demangle-expected: New testcase.

From-SVN: r122972
2007-03-16 01:07:52 +00:00
Simon Baldwin 456cc5cf65 demangle.h: New cplus_demangle_print_callback...
include/:
	* demangle.h: New cplus_demangle_print_callback,
	cplus_demangle_v3_callback, and java_demangle_v3_callback function
	prototypes, and demangle_callbackref type definition.
libiberty/:
	* cp-demangle.h (cplus_demangle_operators): External definition
	suppressed if not building for libstdc++.
	* cp-demangle.c (__gcclibcxx_demangle_callback): Augmented interface
	to demangling, provides a malloc-less version of __cxa_demangle.
	(cplus_demangle_print_callback): Public callback version of
	cplus_demangle_print.
	(struct d_growable_string): New growable string structure.
	(d_growable_string_init): New function, provides support for
	growable strings separate from print info.
	(d_growable_string_resize): Likewise.
	(d_growable_string_append_buffer): Likewise.
	(d_growable_string_callback_adapter):): Likewise.
	(d_print_init): New print info initialization function.
	(d_print_error): Macro replace by inline function.
	(d_print_saw_error): Likewise.
	(d_append_char): Likewise.
	(d_append_buffer): Likewise.
	(d_append_string): New inline function, replaces the
	d_append_string_constant macro.
	(d_flush_buffer): New function, flushes buffer to callback.
	(d_demangle_callback, is_ctor_or_dtor): Malloc-based fallback
	for unsupported dynamic arrays replaced by alloca().
	(d_demangle): Return string length estimating removed.
	(d_dump): Moved error case handling from call site into function.
	(d_print_resize): Function removed.
	(d_print_append_char): Likewise.
	(d_print_append_buffer): Likewise.
	(d_print_error): Likewise.
	(d_print_comp): Added special case handling for Java arrays.
	(java_demangle_v3): Removed string post-processing for Java arrays,
	now replaced by special case handling in d_print_comp.
	(cplus_demangle_v3_callback): Augmented interface to demangling,
	provides a malloc-less version of cplus_demangle_v3.
	(java_demangle_v3_callback): Augmented interface to demangling,
	provides a malloc-less version of java_demangle_v3.

From-SVN: r121305
2007-01-29 20:07:49 +00:00
Geoffrey Keating 5165f1258b cp-demangle.h: Add comment explaining what to do to avoid overrunning string.
* cp-demangle.h: Add comment explaining what to do to avoid
	overrunning string.
	(d_check_char): New.
	(d_next_char): Don't advance past trailing '\0'.
	* cp-demangle.c (cplus_demangle_mangled_name): Use d_check_char.
	(d_nested_name): Likewise.
	(d_special_name): Likewise.
	(d_call_offset): Likewise.
	(d_function_type): Likewise.
	(d_array_type): Likewise.
	(d_pointer_to_member_type): Likewise.
	(d_template_param): Likewise.
	(d_template_args): Likewise.
	(d_template_arg): Likewise.
	(d_expr_primary): Likewise.
	(d_local_name): Likewise.
	(d_substitution): Likewise.
	(d_ctor_dtor_name): Use d_advance rather than d_next_char.
	* testsuite/test-demangle.c: Include sys/mman.h.
	(MAP_ANONYMOUS): Define.
	(protect_end): New.
	(main): Use protect_end.
	* testsuite/demangle-expected: Add testcases for overrunning
	the end of the string.

From-SVN: r120097
2006-12-21 01:29:27 +00:00
Ian Lance Taylor 53e3e587a9 re PR other/29176 (Seg fault in demangler)
PR other/29176
	* cp-demangle.c (d_substitution): Check for overflow when
	computing substitution index.

From-SVN: r117144
2006-09-22 13:52:29 +00:00
Ian Lance Taylor 022d41663d re PR other/28797 (Problems with demangling (__cxa_demangle()))
PR other/28797
	* cp-demangle.c (d_pointer_to_member_type): Do add a substitution
	for a qualified member which is not a function.
	* testsuite/demangle-expected: Add test case.

From-SVN: r116493
2006-08-27 21:42:55 +00:00
Terry Laurenzo 92aed1cbf4 Fixes java/PR9861
From-SVN: r108374
2005-12-11 01:34:02 +00:00
Ian Lance Taylor 8c7262afc3 re PR other/22268 (libiberty demanger crashes on (invalid) mangled name)
PR other/22268
	* cp-demangle.c (d_expr_primary): Don't run off the end of the
	string while looking for the end of a literal value.
	* testsuite/demangle-expected: Add test case.

From-SVN: r101506
2005-07-01 16:39:36 +00:00
Richard Henderson 15da280693 demangle.h (DEMANGLE_COMPONENT_HIDDEN_ALIAS): New.
include/
	* demangle.h (DEMANGLE_COMPONENT_HIDDEN_ALIAS): New.
libiberty/
	* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_HIDDEN_ALIAS.
	(d_make_comp, d_print_comp): Likewise.
	(d_special_name): Generate one.
	* testsuite/demangle-expected: Add a hidden alias test.

From-SVN: r100174
2005-05-25 16:29:54 -07:00
Gabriel Dos Reis d7cf8390c7 libiberty.h (ACONCAT): Properly cast value of alloca().
include/
2005-05-24  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* libiberty.h (ACONCAT): Properly cast value of alloca().

	* ansidecl.h (ATTRIBUTE_UNUSED_LABEL): Don't define if
	__cplusplus.

libiberty/
2005-05-24  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* configure.ac: Check declarations for calloc(), getenv(),
	malloc(), realloc() and sbrk().
	* config.in: Regenerate.
	* configure: Likewise.

	* alloca.c (C_alloca): Change "new" to "new_storage".  Use XNEWVEC
	instead of xmalloc.
	* choose-temp.c (choose_temp_base): Use XNEWVEC instea od xmalloc.
	* concat.c (liiberty_concat_ptr): Surround definition with an
	extern "C" block, if __cplusplus.
	(concat): Use XNEWVEC instead of xmalloc.
	(reconcat): Likewise.
	* cp-demangle.c (struct d_print_template): Rename member
	"template" to "template_decl".  Adjust use throughout the file.
	(d_print_resize): Properly cast return value of realloc().
	(cplus_demangle_print): Same for malloc().
	(d_demangle): Likewise.
	* cp-demint.c (cplus_demangle_fill_builtin_type): Rename parameter
	"typename" to "type_name".
	* cplus-dem.c (grow_vect): Use XRESIZEVEC instead of xrealloc().
	(work_stuff_copy_to_from): Use XNEWVEC insteand of xmalloc().
	(demangle_template_value_parm): Likewise.
	(demangle_template): Likewise.
	(recursively_demangle): Likewise.
	(do_hpacc_template_literal): Likewise.
	(do_arg): Likewise.
	(remember_type): Likewise.
	(remember_Ktype): Likewise.
	(register_Btype): Likewise.
	(string_need): Use XRESIZEVEC instead of xrealloc().
	* dyn-string.c (dyn_string_init): Use XNEWVEC.
	(dyn_string_new): Use XNEW.
	(dyn_string_resize): Use XRESIZEVEC.
	* fnmatch.c (fnmatch): Rename local variable "not" to "negate".
	* getopt.c (getenv): Declare only if !__cplusplus and !getenv.
	Otherwise include <stdlib.h>.
	(exchange): Cast return value of malloc().
	* hashtab.c (htab_size): Define as both macro and non-inline
	function.
	(htab_elements): Likewise.
	* getpwd.c (getpwd): Use XNEWVEC.
	(htab_create_alloc_ex): Use C90 prototype-style.
	* lrealpath.c (lrealpath): Appropriately cast return value of
	malloc().
	* make-relative-prefix.c (save_string): Likewise.
	* make-temp-file.c (try_dir): Rename from "try".  Adjust use in
	the file.
	(choose_tmpdir): Use XNEWVEC.
	* mkstemps.c (mkstemps): Rename parameter "template" to "pattern".
	* pex-common.c (pex_init_common): Use XNEW.
	(pex_add_remove): Use XRESIZEVEC.
	(pex_run): Likewise.
	(pex_get_status_and_time): Likewise.
	* pex-djgpp.c (pex_djgpp_exec_child): Likewise.
	* pex-msdos.c (pex_init): Use XNEW.
	(pex_msdos_exec_child): Likewise.
	(pex_msdos_exec_child): Use XRESIZEVEC.
	* pex-unix.c (pex_wait): Use XNEW.
	* pex-win32.c (fix_argv): Use XNEWVEC.
	* pexecute.c (pwait): Likewise.
	* setenv.c (setenv): Properly cast return value of malloc().
	* sigsetmask.c (sigsetmask): Rename local variables "old" and
	"new" to "old_sig" and "new_sig".
	* sort.c (main): Use XNEWVEC.
	* spaces.c (spaces): Cast return value of malloc().
	* strndup.c (strndup): Likewise.
	* ternary.c (ternary_insert): Use XNEW.
	* xmalloc.c (malloc, realloc, calloc, sbrk): Surround declaration
	with an extern "C" block if __cplusplus.
	* xstrdup.c (xstrdup): Cast return value of memcpy().
	* xstrerror.c (strerror): Enclose declaration in an extern "C"
	block if __cplusplus.
	* xstrndup.c (xstrndup): Use XNEW. Cast return value of memcpy().

From-SVN: r100115
2005-05-24 20:48:25 +00:00
Nick Clifton ee58dffdbc Update the address and phone number of the FSF organization.
From-SVN: r99519
2005-05-10 15:33:18 +00:00
Ian Lance Taylor 23ea4f4a80 * cp-demangle.c: Update copyright.
From-SVN: r97452
2005-04-02 17:17:02 +00:00
Gabriel Dos Reis 93079c819b xregex2.h (_RE_ARGS): Remove definition and uses.
include/
2005-03-27  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        * xregex2.h (_RE_ARGS): Remove definition and uses.

libiberty/
2005-03-27  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        Convert libiberty to use ISO C prototype style 7/n.
        * regex.c (PARAMS): Remove definition.
        (PREFIX): Unconditionaly define using ISO C ## operator.
        (init_syntax_once, extract_number, extract_number_and_incr,
        print_fastmap, print_partial_compiled_pattern,
        print_compiled_pattern, print_double_string, printchar,
        convert_mbs_to_wcs, re_set_syntax, regex_grow_registers,
        regex_compile, store_op1, store_op2, insert_op1, insert_op2,
        at_begline_loc_p, at_endline_p, group_in_compile_stack,
        insert_space, wcs_compile_range, byte_compile_range,
        truncate_wchar, re_compile_fastmap, re_compile_fastmap,
        re_set_registers, re_search, re_search_2, re_search_3,
        re_match,
        re_match_2, count_mbs_length, wcs_re_match_2_internal,
        byte_re_match_2_internal, group_match_null_string_p,
        alt_match_null_string_p, common_op_match_null_string_p,
        bcmp_translate, re_compile_pattern, re_comp, re_exec, regcomp,
        regexec, regerror, regfree): Use ISO C prototype style.
        * partition.c: (elem_compare): Likewise.
        * cp-demangle.c (print_usage): Likewise.

From-SVN: r97129
2005-03-28 08:34:12 +00:00
Gabriel Dos Reis 9486db4fb6 demangle.h: Remove uses of PARAMS.
include/
2005-03-26  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        * demangle.h: Remove uses of PARAMS.

        * libiberty.h (ANSI_PROTOTYPES): Remove guard since
        ANSI_PROTOTYPES is always assumed.
        Remove uses of PARAMS throughout.

libiberty/
2005-03-26  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        Convert libiberty to use ISO C prototype style 2/n.
        * cp-demangle.h: Remove uses of PARAMS.
        * cp-demangle.c: Likewise.
        (d_dump, cplus_demangle_fill_name,
        cplus_demangle_fill_extended_operator,
        cplus_demangle_fill_ctor,
        cplus_demangle_fill_dtor, d_make_empty, d_make_comp,
        d_make_name,
        d_make_builtin_type, d_make_operator,
        d_make_extended_operator,
        d_make_ctor, d_make_dtor, d_make_template_param, d_make_sub,
        cplus_demangle_mangled_name, has_return_type,
        is_ctor_dtor_or_conversion, d_encoding, d_name, d_nested_name,
        d_prefix, d_unqualified_name, d_source_name, d_number,
        d_identifier, d_operator_name, d_special_name, d_call_offset,
        d_ctor_dtor_name, cplus_demangle_type, d_cv_qualifiers,
        d_function_type, d_bare_function_type, d_class_enum_type,
        d_array_type, d_pointer_to_member_type, d_template_param,
        d_template_args, d_template_arg, d_expression, d_expr_primary,
        d_local_name, d_discriminator, d_add_substitution,
        d_substitution, d_print_resize, d_print_append_char,
        d_print_append_buffer, d_print_error, cplus_demangle_print,
        d_print_comp, d_print_java_identifier, d_print_mod_list,
        d_print_mod, d_print_function_type, d_print_array_type,
        d_print_expr_op, d_print_cast, cplus_demangle_init_info,
        d_demangle, __cxa_demangle, cplus_demangle_v3,
        java_demangle_v3,
        is_ctor_or_dtor, is_gnu_v3_mangled_ctor,
        is_gnu_v3_mangled_dtor,
        print_usage, main):

2005-03-26  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        Convert libiberty to ISO C prototype style 1/n.
        * _doprnt.c: Remove conditional #include <varargs.h> on
        ANSI_PROTOTYPES as the latter is always assumed.
        (_doprnt, checkit, main): Use ISO C prototype.
        * alloca.c (find_stack_direction, C_alloca): Use ISO C
        prototype.
        * argv.c: Remove conditional #includes on ANSI_PROTOTYPES.
        (dupargv, freeargv, buildargv, main): Use ISO C prototype.
        * atexit.c (atexit): Likewise
        * asprintf.c: Remove conditional include on ANSI_PROTOTYPES.
        (asprintf): Use ISO C prototype.
        * basename.c (basename): Likewise
        * bcmp.c (bcmp): Likewise.
        * bcopy.c (bcopy): Likewise.
        * bzero.c (bzero): Likewise.
        * bsearch.c (bsearch): Likewise.  Improve const-correctness.
        * choose-temp.c (choose_temp_base): Likewise.
        * calloc.c: Remove conditional #include on ANSI_PROTOTYPES.
        (calloc): Use ISO C prototype.
        * clock.c (clock): Likewise.
        * concat.c: Remove conditional #include on ANSI_PROTOTYPES.
        (vconcat_length, vconcat_copy, concat_length, concat_copy,
        concat_copy2, concat, reconcat, main): Use ISO C prototype.
        * copysign.c (copysign): Likewise.

From-SVN: r97085
2005-03-26 19:24:33 +00:00
Jason Merrill b8b3c655b0 cp-demangle.c (__cxa_demangle): Change resolution of ambiguous arguments.
* cp-demangle.c (__cxa_demangle): Change resolution of ambiguous
        arguments.

From-SVN: r94980
2005-02-13 01:58:20 -05:00
Ian Lance Taylor 0b167d51ed re PR other/18623 (4 * libiberty local variables set but never used)
PR other/18623
	* cp-demangle.c (d_call_offset): Remove useless local variables
	offset and virtual_offset.
	* cplus-dem.c (ada_demangle): Remove useless local variable
	at_start_name.
	(demangle_template): Remove useless local variable start.

From-SVN: r91133
2004-11-24 02:19:10 +00:00
Ian Lance Taylor 00a5aa9c30 re PR c++/16240 (g++ generates incorrect mangled name)
PR other/16240
	* cp-demangle.c (d_expr_primary): Check for a failure return from
	cplus_demangle_type.

From-SVN: r83791
2004-06-28 15:23:33 +00:00
Ian Lance Taylor 31058ee354 cp-demangle.h (enum d_builtin_type_print): Add D_PRINT_UNSIGNED...
* cp-demangle.h (enum d_builtin_type_print): Add D_PRINT_UNSIGNED,
	D_PRINT_UNSIGNED_LONG, D_PRINT_LONG_LONG,
	D_PRINT_UNSIGNED_LONG_LONG, D_PRINT_FLOAT.
	* cp-demangle.c (cplus_demangle_builtin_types): Change char and
	short types to D_PRINT_DEFAULT.  Change other integer types to use
	new D_PRINT_* values where appropriate.  Change float types to
	D_PRINT_FLOAT.
	(d_print_comp) [LITERAL, LITERAL_NEG]: Handle new D_PRINT_*
	values.
	* testsuite/demangle-expected: Adjust two test cases.

	* cp-demangle.c (d_print_function_type): Print a space before the
	parenthesis around the function type in more cases.
	* testsuite/demangle-expected: Adjust one test case.

From-SVN: r78421
2004-02-25 04:51:39 +00:00
Ian Lance Taylor 93f20626db cp-demangle.c (d_print_comp): Don't emit extra parentheses around a cast.
* cp-demangle.c (d_print_comp) [UNARY]: Don't emit extra
	parentheses around a cast.
	* testsuite/demangle-expected: Adjust two test cases to match new
	output.

From-SVN: r78416
2004-02-25 01:45:49 +00:00
Ian Lance Taylor dbd6ec2bdc * cp-demangle.c (__cxa_demangle): Pass DMGL_PARAMS to d_demangle.
From-SVN: r78355
2004-02-24 06:42:26 +00:00
Ian Lance Taylor 80a19ac825 cp-demangle.c (d_print_comp): Don't push more than one of the same CV-qualifier on the top of the stack.
* cp-demangle.c (d_print_comp) [RESTRICT, VOLATILE, CONST]: Don't
	push more than one of the same CV-qualifier on the top of the
	stack.
	(d_print_comp) [ARRAY_TYPE]: If the array itself is CV-qualified,
	move the CV-qualifiers to apply to the element type instead.
	(d_print_array_type): When checking the modifiers, keep looking
	past ones which have been printed already.
	* testsuite/demangle-expected: Add three test cases.

From-SVN: r78354
2004-02-24 06:32:16 +00:00
Ian Lance Taylor e8ed4ac21e cp-demangle.c (__cxa_demangle): Adjust last patch to handle empty string correctly.
* cp-demangle.c (__cxa_demangle): Adjust last patch to handle
	empty string correctly.

From-SVN: r78353
2004-02-24 04:02:22 +00:00
Ian Lance Taylor 4a368ffd95 cp-demangle.c (__cxa_demangle): It is not an error if status is not NULL.
2004-02-23  Ian Lance Taylor  <ian@wasabisystems.com>

	* cp-demangle.c (__cxa_demangle): It is not an error if status is
	not NULL.  It is an error if the mangled name is the same as a
	built-in type name.
	(main): If IN_GLIBCPP_V3 is defined, test __cxa_demangle rather
	than cplus_demangle_v3.

From-SVN: r78348
2004-02-24 02:49:24 +00:00
Daniel Jacobowitz d4f3ce5cc0 cp-demangle.c (d_make_comp): DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE takes two parameters.
* cp-demangle.c (d_make_comp): DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE
	takes two parameters.
	* cp-demint.c (cplus_demangle_fill_component): Likewise.

From-SVN: r75819
2004-01-13 21:35:12 +00:00
Ian Lance Taylor 5e777af517 demangle.h (enum demangle_component_type): Define.
* demangle.h (enum demangle_component_type): Define.
	(struct demangle_operator_info): Declare.
	(struct demangle_builtin_type_info): Declare.
	(struct demangle_component): Define.
	(cplus_demangle_fill_component): Declare.
	(cplus_demangle_fill_name): Declare.
	(cplus_demangle_fill_builtin_type): Declare.
	(cplus_demangle_fill_operator): Declare.
	(cplus_demangle_fill_extended_operator): Declare.
	(cplus_demangle_fill_ctor, cplus_demangle_fill_dtor): Declare.
	(cplus_demangle_v3_components): Declare.
	(cplus_demangle_print): Declare.

	* cp-demangle.c: Include "cp-demangle.h".  If IN_GLIBCPP_V3 is
	defined, rename some functions which are to become static via
	#define.
	(CP_STATIC_IF_GLIBCPP_V3): Define.
	(struct d_operator_info): Move definition to cp-demangle.h, and
	rename to demangle_operator_info.  Change all uses.
	(enum d_builtin_type_print): Move definition to cp-demangle.h.
	(struct d_builtin_type_info): Move definition to cp-demangle.h,
	and rename to demangle_builtin_type_info.  Change all uses.
	(enum d_comp_type): Move definition to include/demangle.h, and
	rename to demangle_component_type, and change all enums to start
	with DEMANGLE_COMPONENT_ instead of D_.  Change all uses.
	(struct d_comp): Move definition to include/demangle.h, and rename
	to demangle_component.  Change all uses.
	(struct d_info): Move definition to cp-demangle.h.
	(cplus_demangle_fill_name): New function.
	(cplus_demangle_fill_extended_operator): New function.
	(cplus_demangle_fill_ctor): New function.
	(cplus_demangle_fill_dtor): New function.
	(d_make_empty): Remove type parameter.  Change all callers.
	(d_make_name): Use cplus_demangle_fill_name.
	(d_make_extended_operator): Use
	cplus_demangle_fill_extended_operator.
	(d_make_ctor): Use cplus_demangle_fill_ctor.
	(d_make_dtor): Use cplus_demangle_fill_dtor.
	(cplus_demangle_mangled_name): Rename from d_mangled_name.  Make
	non-static by default.  Change all callers.
	(cplus_demangle_operators): Rename from d_operators.  Change all
	uses.  Make non-static by default.  Add sentinel at end of array.
	(d_operator_name): Adjust initialization of high for new sentinel
	in cplus_demangle_operators.
	(cplus_demangle_builtin_types): Rename from d_builtin_types.
	Change all uses.  Make non-static by default.  Change initializer
	to use D_BUILTIN_TYPE_COUNT instead of magic number 26.
	(cplus_demangle_type): Rename from d_type.  Make non-static by
	default.  Change all callers.
	(cplus_demangle_init_info): Rename from d_init_info.  Make
	non-static by default.  Change all callers.
	* cp-demangle.h: New file.
	* cp-demint.c: New file.
	* Makefile.in: Rebuild dependencies.
	(CFILES): Add cp-demint.c.
	(REQUIRED_OFILES): Add cp-demint.o.

From-SVN: r75748
2004-01-12 19:46:31 +00:00
Ian Lance Taylor e4796f1c88 cp-demangle.c (d_encoding): When DMGL_PARAMS is not set...
* cp-demangle.c (d_encoding): When DMGL_PARAMS is not set, strip
	CV-qualifiers from D_COMP_LOCAL_NAME right subtree.
	* cplus-dem.c (demangle_arm_hp_template): Set DMGL_PARAMS when
	demangling template parameters.
	* testsuite/test-demangle.c (fail): New static function.
	(main): Support new options in input file: --no-params,
	--is-v3-ctor, and --is-v3-dtor.
	* testsuite/demangle-expected: Add --no-params to most tests, and
	add the correct result when parameters are not demangled.  Add
	some simple tests for V3 constructor/destructor recognition.

From-SVN: r75336
2004-01-02 20:33:55 +00:00
Kaveh R. Ghazi 4d42522958 * cp-demangle.c (is_ctor_or_dtor): Fix error in last change.
From-SVN: r75030
2003-12-26 01:54:43 +00:00
Ian Lance Taylor 2d6c4025cc cp-demangle.c (CP_DYNAMIC_ARRAYS): Define if compiler supports dynamic arrays.
* cp-demangle.c (CP_DYNAMIC_ARRAYS): Define if compiler supports
	dynamic arrays.
	(struct d_operator_info): Add len field.
	(struct d_builtin_type_info): Add len and java_len fields.
	(struct d_standard_sub_info): Add simple_len, full_len, and
	set_last_name_len fields.
	(struct d_comp): Add len field to s_string.
	(struct d_info): Add send, did_subs, and expansion fields.
	(d_append_string_constant): Define.
	(d_append_string): Remove.  Change all users to use
	d_append_string_constant or d_append_buffer instead.
	(d_make_sub): Add len parameter.  Change all callers.
	(d_name): Increase expansion when substituting std::.
	(d_unqualified_name): Increase expansion for an operator.
	(d_number): Don't use multiplication for negative numbers.
	(d_identifier): Make sure there are enough characters in the
	string for the specified length.  Adjust expansion for an
	anonymous namespace.
	(d_operators): Initialize len field.
	(d_special_name, d_ctor_dtor_name): Increase expansion.
	(d_builtin_types): Initialize len and java_len fields.
	(d_type): Increase expansion for a builtin type.
	(d_cv_qualifiers): Increase expansion for each qualifier.
	(d_bare_function_type): Decrease expansion when removing single
	void parameter.
	(d_template_param): Increment did_subs.
	(d_expression): Increase expansion for an operator.
	(d_expr_primary): Decrease expansion for a type we will print
	specially.
	(standard_subs): Initialize new fields.
	(d_substitution): Increment did_subs when doing a normal
	substitution.  Increase expansion for a special substitution.
	(d_print): Add estimate parameter.  Change all callers.
	(d_print_comp) [D_COMP_NAME]: Handle C++ case inline.
	(d_print_comp) [D_COMP_BINARY]: Use length to avoid strcmp call.
	(d_print_java_identifier): Rename from d_print_identifier.  Handle
	only Java case.  Change caller.
	(d_init_info): Change return type to void.  Change all callers.
	Initialize send, did_subs, and expansion fields.  Do not
	initialize comps and subs fields.
	(d_demangle): Ifdef CP_DYNAMIC_ARRAYS, allocate comps and subs
	arrays on stack.  Make an estimate of the length of the demangled
	name.  Ifdef CP_DEMANGLE_DEBUG, print estimation failures.
	(is_ctor_or_dtor): Ifdef CP_DYNAMIC_ARRAYS, allocate comps and
	subs arrays on stack.

From-SVN: r74933
2003-12-22 15:45:12 +00:00