aboutsummaryrefslogtreecommitdiff
path: root/libiberty/cplus-dem.c
AgeCommit message (Collapse)AuthorFilesLines
2003-03-11cplus-dem.c (demangle_integral_value): Correction to reflect patch of ↵Carlo Wood1-23/+26
2002-01-10 in order to also make negative... * cplus-dem.c (demangle_integral_value): Correction to reflect patch of 2002-01-10 in order to also make negative multi-digits without leading underscore work. From-SVN: r64179
2003-03-04* cplus-dem.c: Add license exception to copyright notice.Mark Mitchell1-0/+9
From-SVN: r63760
2003-02-20* cplus_dem.c: Fix typo: intializes -> initializes.jmc1-1/+1
From-SVN: r63182
2003-02-13re PR c++/7612 (Memory leaks in cplus-dem.c)Daniel Jacobowitz1-15/+16
Fix PR c++/7612. * cplus-dem.c (demangle_signature): Call string_delete. Remove extra string_init. (demangle_arm_hp_template): Call string_delete instead of string_clear. Add missing string_delete call. (demangle_qualified): Add missing string_delete call. (do_type): Remove unused variable btype. Add missing string_delete call. Call string_delete instead of string_clear. (demangle_fund_type): Move variable btype inside of the switch statement. Add missing string_delete call. (do_arg): Call string_delete instead of string_clear. Remove extra string_init. (demangle_nested_args): Free work->previous_argument. From-SVN: r62852
2002-10-06cplus-dem.c (ada_demangle): Get rid of unneeded variable and of ↵Andreas Jaeger1-10/+8
strict-aliasing warning. * libiberty/cplus-dem.c (ada_demangle): Get rid of unneeded variable and of strict-aliasing warning. (grow_vect): Use char as first parameter. From-SVN: r57866
2002-09-20cp-demangle.c (demangling_new): Cast 0 to enum.John David Anglin1-2/+2
* cp-demangle.c (demangling_new): Cast 0 to enum. (demangle_char): Cast return of strdup to char *. (is_gnu_v3_mangled_ctor): Cast 0 to enum. (is_gnu_v3_mangled_dtor): Likewise. * cplus-dem.c (grow_vect): Cast return of xrealloc to void *. (work_stuff_copy_to_from): Cast return of xmalloc to char **. * fibheap.c (fibnode_new): Cast return of xcalloc to fibnode_t. * md5.c (md5_process_bytes): Cast results back to const void *. (md5_process_block): Add cast to const md5_uint32 *. * regex.c (re_compile_fastmap): Cast enum to UCHAR_T. * safe-ctype.c (L, XL, U, XU, D, P, _, C, Z, M, V, T, S): Add cast to unsigned short. * splay-tree.c (splay_tree_xmalloc_allocate): Cast return of xmalloc to void *. * vasprintf.c (int_vasprintf): Cast return of malloc to char *. From-SVN: r57330
2002-09-11Makefile.in: Remove all references to s-under and underscore.c.Zack Weinberg1-334/+0
gcc: * Makefile.in: Remove all references to s-under and underscore.c. * collect2.c, tlink.c: Change all uses of prepends_underscore to look directly at USER_LABEL_PREFIX. gcc/cp: * Make-lang.in: Build cp/cxxfilt.o from $(srcdir)/cp/cxxfilt.c, and c++filt from cxxfilt.o + version.o + $(LIBDEPS). * cxxfilt.c: New file: split from libiberty/cplus-dem.c, with minor adjustments (use version_string, eliminate yet another duplicate of xmalloc) libiberty: * cplus-dem.c: Code code under #ifdef MAIN moved to gcc/cp/cxxfilt.c. * testsuite/Makefile.in: Adjust for test-demangle. * testsuite/regress-demangle: Deleted. * testsuite/test-demangle.c: New file. * testsuite/demangle-expected: Change \$ to $ throughout, now that this file is not being read by a shell script. From-SVN: r57037
2002-07-29* cplus-dem.c (PREPEND_BLANK): Remove.Neil Booth1-2/+0
From-SVN: r55837
2002-02-19demangle-expected: Add test case for infinite loop in demangler.Scott Snyder1-2/+9
* testsuite/demangle-expected: Add test case for infinite loop in demangler. * cplus-dem.c (demangle_arm_hp_template): Stop trying to demangle if do_type() doesn't make any progress --- prevents an infinite loop. From-SVN: r49875
2002-02-18re PR other/5390 ([3.3 only?] Libiberty fails to demangle multi-digit ↵Carlo Wood1-5/+16
template parameters.) 2002-02-18 Carlo Wood <carlo@gnu.org> PR c++/5390 * cplus-dem.c (demangle_integral_value): Accept multi-digit numbers that do not start with an underscore; This is needed for integer template parameters. This doesn't break anything because multi-digit numbers are never followed by a digit. * testsuite/demangle-expected: Corrected all mangled test cases with multi-digit template parameters: g++ 2.95.x does not generate underscores around these parameters. From-SVN: r49851
2002-02-05demangle.h (cplus_demangle_v3): Add "options" parm.Jason Merrill1-7/+4
* demangle.h (cplus_demangle_v3): Add "options" parm. (cplus_demangle_v3_type): Remove prototype. (DMGL_VERBOSE): New macro. (DMGL_TYPES): New macro. * cplus-dem.c (flags): Add DMGL_VERBOSE (cplus_demangle_v3_p): Remove. (demangle_it): Add DMGL_TYPES to passed flags. * cp-demangle.c (cplus_demangle_v3_all): Remove. (cplus_demangle_v3_type): Remove. (cplus_demangle_v3): Add options parm. * collect2.c (dump_file): Pass DMGL_VERBOSE to cplus_demangle. From-SVN: r49525
2002-02-02cp-demangle.c (cp_demangle_type): Do not protect with IN_LIBGCC2.H.J. Lu1-1/+5
2002-02-02 H.J. Lu (hjl@gnu.org) * cp-demangle.c (cp_demangle_type): Do not protect with IN_LIBGCC2. (cplus_demangle_v3_all): New. (cplus_demangle_v3): Call cplus_demangle_v3_all. (cplus_demangle_v3_type): Call cplus_demangle_v3_all. * cplus-dem.c (cplus_demangle_v3_p): New function pointer. Initialized to cplus_demangle_v3. (cplus_demangle_with_style): Call cplus_demangle_v3_p instead of cplus_demangle_v3. (main): Set cplus_demangle_v3_p to cplus_demangle_v3_type for command line symbol. * testsuite/regress-demangle: Pass the mangled name at the command line. From-SVN: r49456
2002-01-02gcc.c (default_compilers): Const-ify.Kaveh R. Ghazi1-1/+1
* gcc.c (default_compilers): Const-ify. * mips-tdump.c (stab_names): Likewise. * mips-tfile.c (map_coff_types, map_coff_storage, map_coff_sym_type, map_coff_derived_type, stabs_symbol, pseudo_ops_t, pseudo_ops): Likewise. * protoize.c (default_include): Likewise f: * com.c (clear_binding_level): Const-ify. (ffecom_arglist_expr_): Likewise. * info.c (ffeinfo_types_): Don't needlessly zero init. * lex.c (ffelex_hash_kludge): Const-ify. java: * parse.y (src_parse_roots): Don't needlessly zero init. libiberty: * cp-demangle.c (long_options): Const-ify. * cplus-dem.c (long_options): Likewise. From-SVN: r48485
2002-01-02cplus-dem.c (mystrstr): Delete.Kaveh R. Ghazi1-27/+8
* cplus-dem.c (mystrstr): Delete. All callers changed to use strstr instead. From-SVN: r48476
2001-12-12re PR other/2719 (demangler crash)Craig Rodrigues1-0/+3
2001-12-12 Craig Rodrigues <rodrigc@gcc.gnu.org> PR other/2719 * cplus-dem.c (consume_count): Treat negative count as an error. * testsuite/demangle-expected: Added testcase. From-SVN: r47952
2001-12-06demangle.h (no_demangling): New.Richard Henderson1-0/+10
* demangle.h (no_demangling): New. (NO_DEMANGLING_STYLE_STRING): New. * cplus-dem.c (libiberty_demanglers): Add no_demangling case. (cplus_demangle): Support no_demangling. From-SVN: r47733
2001-10-17argv.c, [...]: Improve manual formatting.DJ Delorie1-1/+1
* argv.c, asprintf.c, choose-temp.c, concat.c, cplus-dem.c, ffs.c, fnmatch.txh, getruntime.c, make-temp-file.c, mkstemps.c, pexecute.c, random.c, strsitnal.c, vasprintf.c: Improve manual formatting. * functions.texi: Regenerate. From-SVN: r46323
2001-10-07demangle.h (demangler_engine): Const-ify.Kaveh R. Ghazi1-7/+7
include: * demangle.h (demangler_engine): Const-ify. * libiberty.h (buildargv): Likewise. libiberty: * argv.c (buildargv, tests, main): Const-ify. * cp-demangle.c (operator_code): Likewise. * cplus-dem.c (optable, libiberty_demanglers, cplus_demangle_set_style, cplus_demangle_name_to_style, print_demangler_list): Likewise. * hashtab.c (higher_prime_number): Likewise. * strcasecmp.c (charmap): Likewise. * strerror.c (error_info, strerror, main): Likewise. * strncasecmp.c (charmap): Likewise. * strsignal.c (signal_info): Likewise. From-SVN: r46060
2001-03-20* cplus-dem.c (main): Skip initial $.Jason Merrill1-1/+1
From-SVN: r40655
2001-03-05* cplus-dem.c (main): Cast enum style to int.John David Anglin1-1/+1
From-SVN: r40242
2001-02-16cplus-dem.c (main): Initialize style.Loren J. Rittle1-1/+1
2001-02-16 Loren J. Rittle <ljrittle@acm.org> * cplus-dem.c (main): Initialize style. From-SVN: r39782
2001-02-02Add support for Java demangling under the v3 ABI:Bryce McKinlay1-9/+11
* cp-demangle.c (NAMESPACE_SEPARATOR): New define. (struct demangling_def): Add `style' field. (demangling_new): New parameter `style'. Set it in demangling_t. (demangle_prefix): Use NAMESPACE_SEPARATOR. (demangle_type_ptr): Don't emit pointer symbol if doing Java output. (cp_demangle): New parameter `style'. Pass it to demangling_new(). (main): Call cp_demangle with extra parameter. (java_demangle_v3): New function. (java_builtin_type_names): New. Table of primitive type names used for Java demangling. (demangle_builtin_type): Look up in java_builtin_type_names if doing Java output. * cplus-dem.c (cplus_demangle): Use java_demangle_v3 to do Java demangling. (long_options): Remove obsolete `java' option. (main): Remove explicit handling of `java' option. Instead, pass style parameter in cplus_demangle flags as gdb does. * testsuite/demangle.expected: Add some Java test cases. From-SVN: r39399
2000-12-08safe-ctype.h: New file.Zack Weinberg1-32/+33
include: * safe-ctype.h: New file. libiberty: * safe-ctype.c: New file. * Makefile.in (CFILES): Add safe-ctype.c. (REQUIRED_OFILES): Add safe-ctype.o. * argv.c: Define ISBLANK and use it, not isspace. * basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c, strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h. Use uppercase ctype macros. Don't test ISUPPER(c)/ISLOWER(c) before calling TOLOWER(c)/TOUPPER(c). gcc: * Makefile.in (HOST_RTL): Add safe-ctype.o. (safe-ctype.o): New rule. * system.h: Include safe-ctype.h, not ctype.h. No need to wrap ctype macros. * cpphash.h: Zap IStable and related macros. Define is_* in terms of safe-ctype.h macros. * cppinit.c: Delete the IStable and all related code. * tradcpp.c: Delete is_idchar, is_idstart, is_hor_space, and is_space arrays. Delete initialize_char_syntax. Change all references to the above arrays to use macros instead. * tradcpp.h: Define is_idchar, is_idstart, is_space, and is_nvspace in terms of safe_ctype.h's macros. * tradcif.y: is_idchar, is_idstart are macros not arrays. * config/i370/i370.c, config/winnt/dirent.c, config/winnt/fixinc-nt.c, config/winnt/ld.c: Use uppercase ctype macros. If we included ctype.h, include safe-ctype.h instead. * fixinc/fixfixes.c: Use uppercase ctype macros. Don't test ISLOWER(c) before calling TOUPPER(c). * fixinc/fixincl.c (extract_quoted_files): Simplify out some gunk. * fixinc/gnu-regex.c: Include safe-ctype.h, not ctype.h. No need to wrap ctype macros. Don't test ISUPPER(x) before calling TOLOWER(x). gcc/ch: * lex.c: Don't bother checking whether ISUPPER(c) before calling TOLOWER(c). Don't bother checking whether isascii(c) before testing ISSPACE(c); ISSPACE(c) includes '\n'. gcc/f: * Make-lang.in: Link f/fini with safe-ctype.o. * bad.c: Don't test ISUPPER(c) || ISLOWER(c) before calling TOUPPER(c). * com.c: Use TOUPPER, not ffesrc_toupper. * fini.c: Don't test ISALPHA(c) before calling TOUPPER(c)/TOLOWER(c). * intrin.c: Don't test IN_CTYPE_DOMAIN(c). * src.c: Delete ffesrc_toupper_ and ffesrc_tolower_ and their initializing code; use TOUPPER and TOLOWER instead of ffesrc_toupper and ffesrc_tolower. * src.h: Don't declare ffesrc_toupper_ or ffesrc_tolower_. Don't define ffesrc_toupper or ffesrc_tolower. gcc/java: * jvgenmain.c: Use ISPRINT not isascii. From-SVN: r38124
2000-12-04cp-demangle.c: s/new_abi/v3/.Jason Merrill1-12/+17
* cp-demangle.c: s/new_abi/v3/. * cplus-dem.c: Likewise. (current_demangling_style): Now auto_demangling. (cplus_demangle): Try v3 demangling if AUTO_DEMANGLING. (main): Use standard symbol chars for auto_demangling. From-SVN: r38002
2000-11-22* cplus-dem.c (main): Handle gnat_demangling.H.J. Lu1-0/+1
From-SVN: r37679
2000-11-21cplus-dem.c (cplus_demangle): Fix formatting.Hans-Peter Nilsson1-31/+33
* cplus-dem.c (cplus_demangle): Fix formatting. (grow_vect): Ditto. (ada_demangle): Ditto. (internal_cplus_demangle): Ditto. (mop_up): Ditto. * cplus-dem.c (main): Handle java_demangling. From-SVN: r37612
2000-11-19cplus-dem.c (grow_vect): Prototype.Kaveh R. Ghazi1-4/+8
* cplus-dem.c (grow_vect): Prototype. (ada_demangle): Cast the arg of ctype macros to unsigned char. From-SVN: r37563
2000-11-16cplus-dem.c (ada_demangle): Add back ATTRIBUTE_UNUSED for parameter `option'.Hans-Peter Nilsson1-1/+1
* cplus-dem.c (ada_demangle): Add back ATTRIBUTE_UNUSED for parameter `option'. Do s/cplus_dem.c/cplus-dem.c/g on ChangeLog. From-SVN: r37494
2000-11-15cplus_dem.c: Eliminate use of DEFUN, it is obsolete and cannot be used in GCC.Kenneth Block1-8/+8
* cplus_dem.c: Eliminate use of DEFUN, it is obsolete and cannot be used in GCC. From-SVN: r37483
2000-11-15cplus_dem.c: Add gnat demangler.Kenneth Block1-0/+148
* cplus_dem.c: Add gnat demangler. Add java to demangle style list. From-SVN: r37475
2000-09-13demangle-expected: Add two tests for anonymous namespaces.Hans-Peter Nilsson1-0/+19
* testsuite/demangle-expected: Add two tests for anonymous namespaces. * cplus-dem.c (gnu_special): Handle anonymous namespaces. From-SVN: r36398
2000-09-10demangle-expected: Add four tests for type_info mangling.Hans-Peter Nilsson1-1/+1
* testsuite/demangle-expected: Add four tests for type_info mangling. * cplus-dem.c (gnu_special): Use do_type, not demangle_fund_type, for a non-template non-qualified type_info function or node. From-SVN: r36301
2000-09-05In include:Alex Samuel1-1/+1
* dyn-string.h: Adjust formatting. (dyn_string_insert_char): New macro. New declaration. In libiberty: * cp-demangle.c (ANONYMOUS_NAMESPACE_PREFIX): New macro. (substitution_def): Remove template_parm_number. (NOT_TEMPLATE_PARM): Remove. (result_insert_string): New macro. (result_insert): Likewise. (result_insert_char): Likewise. (substitution_add): Remove last parameter. Don't store template parm number. (BFT_NO_RETURN_TYPE): Define as NULL. (demangle_encoding): Adjust call to demangle_bare_function_type. (demangle_name): Adjust substitution. Adjust call to substitution_add. (demangle_prefix): Adjust call to substitution_add. (demangle_identifier): Handle anonymous namespaces. (demangle_operator_name): Change demangling of vendor-extended operator to match ABI changes. (demangle_type_ptr): Change parameters. Make recursive. Handle substitutions here. (demangle_type): Adjust calls to demangle_template_param, substitution_add, and demangle_type_ptr. Fix substitution of templated types. (demangle_function_type): Change parameter to a pointer. (demangle_bare_function_type): Likewise. Adjust insertion point. (demangle_template_param): Remove last parameter. (demangle_expr_primary): Remove unused variable. Adjust call to demangle_template_param. (is_mangled_char): Accept `$' and `.'. * cplus-dem.c (gnu_new_abi_symbol_characters): Add '$' and '.'. * dyn-string.c (dyn_string_insert_char): New function. From-SVN: r36148
2000-08-24cplus-dem.c (cplus_demangle_opname, [...]): Use ARRAY_SIZE.Greg McGary1-13/+12
* libiberty/cplus-dem.c (cplus_demangle_opname, cplus_mangle_opname, demangle_expression, demangle_function_name): Use ARRAY_SIZE. * libiberty/random.c (end_ptr): Likewise. From-SVN: r35948
2000-08-11cplus-dem.c (demangle_signature): Change if (GNU_DEMANGLING) to if ↵Daniel Berlin1-31/+243
(AUTO_DEMANGLING || GNU_DEMANGLING) * cplus-dem.c (demangle_signature): Change if (GNU_DEMANGLING) to if (AUTO_DEMANGLING || GNU_DEMANGLING) From-SVN: r35652
2000-07-20cplus-dem.c (demangle_fund_type): Make 'dec' an unsigned int, and print it ↵Joseph Myers1-2/+2
with %u. * cplus-dem.c (demangle_fund_type): Make 'dec' an unsigned int, and print it with %u. From-SVN: r35153
2000-07-07cplus-dem.c (main): fflush() after emitting last char before waiting for input.Andrew Haley1-0/+1
2000-07-07 Andrew Haley <aph@cygnus.com> * cplus-dem.c (main): fflush() after emitting last char before waiting for input. From-SVN: r34902
2000-06-05In include,Alex Samuel1-0/+27
* dyn-string.h: Move here from gcc/dyn-string.h. Add new functions. * demangle.h (DMGL_GNU_NEW_ABI): New macro. (DMGL_STYLE_MASK): Or in DMGL_GNU_NEW_ABI. (current_demangling_style): Add gnu_new_abi_demangling. (GNU_NEW_ABI_DEMANGLING_STYLE_STRING): New macro. (GNU_NEW_ABI_DEMANGLING): Likewise. (cplus_demangle_new_abi): New declaration. In libiberty, * Makefile.in (CFILES): Add cp-demangle.c and dyn-string.c. (REQUIRED_OFILES): Add cp-demangle.o and dyn-string.o. (cp-demangle.o): New dependency. (dyn-string.o): Likewise. * dyn-string.c: Move here from gcc/dyn-string.c. Add new functions. * cplus-dem.c (libiberty_demanglers): Add initializer for new-ABI demangler. (cplus_demangle): Call cplus_demangle_new_abi if in new-ABI demangling mode. (gnu_new_abi_symbol_characters): New function. (main): Use gnu_new_abi_symbol_characters. * cp-demangle.c: New file. * cp-demangle.c: New file. From-SVN: r34397
2000-05-04demangle.h (demangler_engine): Constify.Kaveh R. Ghazi1-4/+5
include: * demangle.h (demangler_engine): Constify. libiberty: * cplus-dem.c (cplus_demangle_opname, demangle_function_name): Cast the arguments to `islower' to `unsigned char'. (print_demangler_list): Prototype. From-SVN: r33679
2000-04-28* libiberty/cplus-dem.cKenneth Block1-29/+121
(libiberty_demanglers): new table for demangle styles (cplus_demangle_set_style): New function for setting style (cplus_demangle_name_to_style): New function to translate name * include/demangle.h (libiberty_demanglers): new table for different styles (cplus_demangle_set_style): New function for setting style (cplus_demangle_name_to_style): New function to translate name Co-Authored-By: Jason Merrill <jason@casey.cygnus.com> From-SVN: r33525
2000-04-16* cplus-dem.c (cplus_demangle_opname): Changed to use islower.Dave Pitts1-4/+4
From-SVN: r33189
1999-10-25cplus-dem.c: Move declarations of standard_symbol_characters and ↵Jim Kingdon1-6/+6
hp_symbol_characters inside... * cplus-dem.c: Move declarations of standard_symbol_characters and hp_symbol_characters inside #ifdef MAIN to avoid compiler warnings. From-SVN: r30175
1999-10-19cplus-dem.c (INTBUF_SIZE): New macro.Mark Mitchell1-107/+146
* cplus-dem.c (INTBUF_SIZE): New macro. (string_append_template_idx): New function. (demangle_expression): Likewise. (demangle_integral_value): Use it. (demangle_real_value): New function, split out from ... (demangle_template_value_parm): ... here. Use string_append_template_idx. Use demangle_real_value. (demangle_template): Use string_append_template_idx. (demangle_qualified): Use consume_count_with_underscores. (get_count): Tweak formatting. (do_type): Use string_append_template_idx. From-SVN: r30091
1999-10-11cplus-dem.c (do_type): Handle pointer to member types whose enclosing ↵Mark Mitchell1-1/+14
classes have namespace scope. * cplus-dem.c (do_type): Handle pointer to member types whose enclosing classes have namespace scope. From-SVN: r29901
1999-10-02cplus-dem.c (fancy_abort, [...]): Add prototype.Kaveh R. Ghazi1-8/+30
* cplus-dem.c (fancy_abort, demangle_integral_value, demangle_arm_hp_template, recursively_demangle, standard_symbol_characters, hp_symbol_characters, main): Add prototype. (program_name, program_version, fatal): Constify a char*. (usage, fatal): Mark with ATTRIBUTE_NORETURN. (main): Call return, not exit. From-SVN: r29776
1999-08-25Warning fixes:Kaveh R. Ghazi1-5/+5
* cplus-dem.c (gnu_special): Cast a `size_t' to `long' when comparing against a signed quantity. (arm_special): Likewise. (demangle_fund_type): Likewise. (do_hpacc_template_const_value): Mark parameter `work' with ATTRIBUTE_UNUSED. (main): Constify variable `valid_symbols'. From-SVN: r28859
1999-05-16cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance the *mangled ↵Stu Grossman1-6/+8
pointer beyond the end of the string. * cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance the *mangled pointer beyond the end of the string. Clean up code to match prevailing coding style. From-SVN: r26959
1999-05-12cplus-dem.c (standard_symbol_characters): Renamed from standard_symbol_alphabet.Marc Espie1-26/+15
* cplus-dem.c (standard_symbol_characters): Renamed from standard_symbol_alphabet. No longer modify TABLE. (hp_symbol_characters): Renamed from hp_symbol_alphabet. No longer modify TABLE. (main): Corresponding changes. Use strchr to determine if a character is valid. From-SVN: r26912
1999-05-11cplus-dem.c (main): Use table lookup to distinguish identifier characters ↵Jim Blandy1-5/+80
from non-identifier... * cplus-dem.c (main): Use table lookup to distinguish identifier characters from non-identifier characters. (standard_symbol_alphabet, hp_symbol_alphabet): New functions. From-SVN: r26887
1999-04-20Fix from Dale Hawkins:Jim Blandy1-1/+10
* cplus-dem.c (mop_up): Set typevec_size to zero, so it'll be reallocated properly if we use it again. * cplus-dem.c (demangle_fund_type): Check for buffer overrun. Be stricter about syntax. Always null-terminate string. From-SVN: r26562