aboutsummaryrefslogtreecommitdiff
path: root/libiberty
AgeCommit message (Collapse)AuthorFilesLines
2016-09-19Fix zero-length parameter bug in pex_run.Andrew Stubbs3-0/+23
2016-09-19 Andrew Stubbs <ams@codesourcery.com> libiberty/ * pex-win32.c (argv_to_cmdline): Quote zero-length parameters. libiberty/testsuite/ * test-pexecute.c (main): Insert check for zero-length parameters. From-SVN: r240229
2016-09-10Fix -Wshadow warning in libiberty/cp-demangle.cMark Wielaard2-5/+10
valgrind contains a copy of the libiberty demangler which gets compiled with -Wshadow. That shows the following warning: cp-demangle.c: In function ‘d_substitution’: cp-demangle.c:3772:35: warning: declaration of ‘c’ shadows a previous local struct demangle_component *c; ^ cp-demangle.c:3708:8: note: shadowed declaration is here char c; ^ Fix that by renaming the struct demangle_component variable to dc. libiberty/ChangeLog: * cp-demangle.c (d_substitution): Change struct demangle_component variable name from c to dc. From-SVN: r240068
2016-08-12re PR c/7652 (-Wswitch-break : Warn if a switch case falls through)Marek Polacek2-0/+7
PR c/7652 gcc/ * alias.c (find_base_value): Adjust fall through comment. * cfgexpand.c (expand_debug_expr): Likewise. * combine.c (find_split_point): Likewise. (expand_compound_operation): Likewise. Add FALLTHRU. (make_compound_operation): Adjust fall through comment. (canon_reg_for_combine): Add FALLTHRU. (force_to_mode): Adjust fall through comment. (simplify_shift_const_1): Likewise. (simplify_comparison): Likewise. * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): Add FALLTHRU. * config/aarch64/predicates.md: Likewise. * config/i386/i386.c (function_arg_advance_32): Likewise. (ix86_gimplify_va_arg): Likewise. (print_reg): Likewise. (ix86_print_operand): Likewise. (ix86_build_const_vector): Likewise. (ix86_expand_branch): Likewise. (ix86_sched_init_global): Adjust fall through comment. (ix86_expand_args_builtin): Add FALLTHRU. (ix86_expand_builtin): Likewise. (ix86_expand_vector_init_one_var): Likewise. * config/rs6000/rs6000.c (rs6000_emit_vector_compare_inner): Likewise. (rs6000_adjust_cost): Likewise. (insn_must_be_first_in_group): Likewise. * config/rs6000/rs6000.md: Likewise. Adjust fall through comment. * dbxout.c (dbxout_symbol): Adjust fall through comment. * df-scan.c (df_uses_record): Likewise. * dojump.c (do_jump): Add FALLTHRU. * dwarf2out.c (mem_loc_descriptor): Likewise. Adjust fall through comment. (resolve_args_picking_1): Adjust fall through comment. (loc_list_from_tree_1): Likewise. * expmed.c (make_tree): Likewise. * expr.c (expand_expr_real_2): Add FALLTHRU. (expand_expr_real_1): Likewise. Adjust fall through comment. * fold-const.c (const_binop): Adjust fall through comment. (fold_truth_not_expr): Likewise. (fold_cond_expr_with_comparison): Add FALLTHRU. (fold_binary_loc): Likewise. (contains_label_1): Adjust fall through comment. (multiple_of_p): Likewise. * gcov-tool.c (process_args): Add FALLTHRU. * genattrtab.c (check_attr_test): Likewise. (write_test_expr): Likewise. * genconfig.c (walk_insn_part): Likewise. * genpreds.c (validate_exp): Adjust fall through comment. (needs_variable): Likewise. * gensupport.c (get_alternatives_number): Add FALLTHRU. (subst_dup): Likewise. * gimple-pretty-print.c (dump_gimple_assign): Likewise. * gimplify.c (gimplify_addr_expr): Adjust fall through comment. (gimplify_scan_omp_clauses): Add FALLTHRU. (goa_stabilize_expr): Likewise. * graphite-isl-ast-to-gimple.c (substitute_ssa_name): Adjust fall through comment. * hsa-gen.c (get_address_from_value): Likewise. * ipa-icf.c (sem_function::hash_stmt): Likewise. * ira.c (ira_setup_alts): Add FALLTHRU. * lra-eliminations.c (lra_eliminate_regs_1): Adjust fall through comment. * lto-streamer-out.c (lto_output_tree_ref): Add FALLTHRU. * opts.c (common_handle_option): Likewise. * read-rtl.c (read_rtx_code): Likewise. * real.c (round_for_format): Likewise. * recog.c (asm_operand_ok): Likewise. * reginfo.c (reg_scan_mark_refs): Adjust fall through comment. * reload1.c (set_label_offsets): Likewise. (eliminate_regs_1): Likewise. (reload_reg_reaches_end_p): Likewise. * rtlanal.c (commutative_operand_precedence): Add FALLTHRU. (rtx_cost): Likewise. * sched-rgn.c (is_exception_free): Likewise. * simplify-rtx.c (simplify_rtx): Adjust fall through comment. * stor-layout.c (int_mode_for_mode): Likewise. * toplev.c (print_to_asm_out_file): Likewise. (print_to_stderr): Likewise. * tree-cfg.c (gimple_verify_flow_info): Likewise. * tree-chrec.c (chrec_fold_plus_1): Add FALLTHRU. (chrec_fold_multiply): Likewise. (evolution_function_is_invariant_rec_p): Likewise. (for_each_scev_op): Likewise. * tree-data-ref.c (siv_subscript_p): Likewise. (get_references_in_stmt): Likewise. * tree.c (find_placeholder_in_expr): Adjust fall through comment. (substitute_in_expr): Likewise. (type_cache_hasher::equal): Likewise. (walk_type_fields): Likewise. * var-tracking.c (adjust_mems): Add FALLTHRU. (set_dv_changed): Adjust fall through comment. * varasm.c (default_function_section): Add FALLTHRU. gcc/c-family/ * c-common.c (scalar_to_vector): Adjust fall through comment. * c-opts.c (c_common_handle_option): Likewise. * c-pragma.c (handle_pragma_pack): Add FALLTHRU. * c-pretty-print.c (c_pretty_printer::postfix_expression): Adjust fall through comment. * cilk.c (extract_free_variables): Add FALLTHRU. gcc/c/ * c-parser.c (c_parser_external_declaration): Add FALLTHRU. (c_parser_postfix_expression): Likewise. * c-typeck.c (build_unary_op): Adjust fall through comment. (c_mark_addressable): Likewise. gcc/cp/ * call.c (add_builtin_candidate): Add FALLTHRU. (build_integral_nontype_arg_conv): Adjust fall through comment. (build_new_op_1): Add FALLTHRU. (convert_like_real): Adjust fall through comment. * class.c (fixed_type_or_null): Likewise. * constexpr.c (cxx_eval_constant_expression): Likewise. (potential_constant_expression_1): Likewise. Add FALLTHRU. * cp-gimplify.c (cp_gimplify_expr): Adjust fall through comment. (cp_fold): Add FALLTHRU. * cvt.c (build_expr_type_conversion): Adjust fall through comment. * cxx-pretty-print.c (pp_cxx_unqualified_id): Add FALLTHRU. (pp_cxx_qualified_id): Likewise. (cxx_pretty_printer::constant): Adjust fall through comment. (cxx_pretty_printer::primary_expression): Add FALLTHRU. (pp_cxx_pm_expression): Adjust fall through comment. (cxx_pretty_printer::expression): Add FALLTHRU. (cxx_pretty_printer::declaration_specifiers): Reformat code. (pp_cxx_type_specifier_seq): Adjust fall through comment. (pp_cxx_ptr_operator): Likewise. Add FALLTHRU. * error.c (dump_type): Adjust fall through comment. (dump_decl): Likewise. * mangle.c (write_type): Likewise. * method.c (synthesized_method_walk): Add FALLTHRU. * name-lookup.c (arg_assoc_type): Likewise. * parser.c (cp_lexer_print_token): Adjust fall through comment. (cp_parser_primary_expression): Add FALLTHRU. (cp_parser_operator): Likewise. * pt.c (find_parameter_packs_r): Likewise. (tsubst_aggr_type): Adjust fall through comment. * semantics.c (finish_omp_clauses): Add FALLTHRU. * tree.c (lvalue_kind): Likewise. gcc/fortran/ * decl.c (match_attr_spec): Add FALLTHRU. * primary.c (match_arg_list_function): Likewise. * resolve.c (resolve_operator): Adjust fall through comment. (fixup_charlen): Add FALLTHRU. (resolve_allocate_expr): Adjust fall through comment. * trans-array.c (gfc_conv_ss_startstride): Add FALLTHRU. * trans-intrinsic.c (gfc_conv_intrinsic_len): Adjust fall through comment. gcc/java/ * expr.c (java_truthvalue_conversion): Adjust fall through comment. * jcf-io.c (verify_constant_pool): Likewise. * typeck.c (promote_type): Likewise. gcc/objc/ * objc-encoding.c (encode_type): Add FALLTHRU. libcpp/ * lex.c (search_line_fast): Add FALLTHRU. (_cpp_lex_direct): Likewise. (cpp_token_val_index): Adjust fall through comment. * macro.c (parse_params): Add FALLTHRU. * pch.c (count_defs): Adjust fall through comment. (write_defs): Likewise. libiberty/ * cp-demangle.c (d_print_mod): Add FALLTHRU. From-SVN: r239410
2016-08-04re PR c++/71696 (Libiberty Demangler segfaults (6))Marcel Böhme3-7/+97
2016-08-04 Marcel Böhme <boehme.marcel@gmail.com> PR c++/71696 * cplus-dem.c: Prevent infinite recursion when there is a cycle in the referencing of remembered mangled types. (work_stuff): New stack to keep track of the remembered mangled types that are currently being processed. (push_processed_type): New method to push currently processed remembered type onto the stack. (pop_processed_type): New method to pop currently processed remembered type from the stack. (work_stuff_copy_to_from): Copy values of new variables. (delete_non_B_K_work_stuff): Free stack memory. (demangle_args): Push/Pop currently processed remembered type. (do_type): Do not demangle a cyclic reference and push/pop referenced remembered type. From-SVN: r239143
2016-07-29libiberty.h (MAX_ALLOCA_SIZE): New macro.Aldy Hernandez2-3/+13
include/ * libiberty.h (MAX_ALLOCA_SIZE): New macro. libiberty/ * make-relative-prefix.c (make_relative_prefix_1): Fall back to malloc if alloca argument is greater than MAX_ALLOCA_SIZE. From-SVN: r238880
2016-07-18Demangle C++17 fold-expressions.Jason Merrill3-2/+107
* cp-demangle.c (cplus_demangle_operators): Add f[lrLR]. (d_expression_1): Handle them. (d_maybe_print_fold_expression): New. (d_print_comp_inner): Use it. (d_index_template_argument): Handle negative index. From-SVN: r238437
2016-07-15PR c++/71814 - mangling sizeof... (sP and sZ)Jason Merrill3-5/+70
gcc/cp/ * mangle.c (write_expression): Handle sizeof... an argument pack. libiberty/ * cp-demangle.c (cplus_demangle_operators): Add sP and sZ. (d_print_comp_inner): Handle them. (d_template_args_1): Split out from d_template_args. (d_args_length): New. From-SVN: r238389
2016-07-13re PR c++/70926 (Libiberty Demangler segfaults (5))Marcel Böhme3-4/+28
PR c++/70926 * cplus-dem.c: Handle large values and overflow when demangling length variables. (demangle_template_value_parm): Read only until end of mangled string. (do_hpacc_template_literal): Likewise. (do_type): Handle overflow when demangling array indices. From-SVN: r238313
2016-07-11cp-demangle.c (cplus_demangle_print_callback): Avoid zero-length VLAs.Brooks Moses2-2/+11
2016-06-12 Brooks Moses <bmoses@google.com> * cp-demangle.c (cplus_demangle_print_callback): Avoid zero-length VLAs. From-SVN: r238233
2016-05-31Don't needlessly clear xmemdup allocated memory.Alan Modra2-2/+8
* xmemdup.c (xmemdup): Use xmalloc rather than xcalloc. From-SVN: r236917
2016-05-19Move ChangeLog entry to the right file.Jakub Jelinek1-2/+0
PR other/61321 PR other/61233 * demangle.h (enum demangle_component_type) <DEMANGLE_COMPONENT_CONVERSION>: New value. From-SVN: r236449
2016-05-19Remove libiberty/ path prefixes.Jakub Jelinek1-16/+15
From-SVN: r236448
2016-05-19re PR c++/70498 (Libiberty Demangler segfaults (3))Jakub Jelinek2-1/+6
PR c++/70498 * cp-demangle.c (d_expression_1): Formatting fix. From-SVN: r236445
2016-05-19Fix up 2 ChangeLog entries.Jakub Jelinek1-2/+2
From-SVN: r236443
2016-05-18cplus-dem.c (enum type_kind_t): Add tk_rvalue_reference constant.Artemiy Volkov3-2/+136
* cplus-dem.c (enum type_kind_t): Add tk_rvalue_reference constant. (demangle_template_value_parm): Handle tk_rvalue_reference type kind. (do_type): Support 'O' type id (rvalue references). * testsuite/demangle-expected: Add tests. From-SVN: r236434
2016-05-02Demangler integer overflow fixes from Marcel Böhme.Marcel Böhme3-24/+61
PR c++/70498 * cp-demangle.c: Parse numbers as integer instead of long to avoid overflow after sanity checks. Include <limits.h> if available. (INT_MAX): Define if necessary. (d_make_template_param): Takes integer argument instead of long. (d_make_function_param): Likewise. (d_append_num): Likewise. (d_identifier): Likewise. (d_number): Parse as and return integer. (d_compact_number): Handle overflow. (d_source_name): Change variable type to integer for parsed number. (d_java_resource): Likewise. (d_special_name): Likewise. (d_discriminator): Likewise. (d_unnamed_type): Likewise. * testsuite/demangle-expected: Add regression test cases. From-SVN: r235767
2016-04-30config.guess: Remove SH5 support.Oleg Endo2-2/+5
/ * config.guess: Remove SH5 support. * config.sub: Likewise. * configure: Likewise. * configure.ac: Likewise. config/ * picflag.m4: Remove SH5 support. gcc/ * config/sh/t-sh: Remove SH5 support. * config.gcc: Likewise. * configure: Likewise. contrib/ * compare-all-tests: Remove SH5 support. * config-list.mk: Likewise. libada/ * configure: Remove SH5 support. libgcc/ * config.host: Remove SH5 support. * configure: Likewise. libiberty/ * configure: Remove SH5 support. libjava/ * classpath/config.guess: Remove SH5 support. * classpath/config.sub: Likewise. From-SVN: r235676
2016-04-08Fix PR number in ChangeLogBernd Schmidt1-1/+1
From-SVN: r234830
2016-04-08Fix memory allocation size overflows (PR69687, patch by Marcel Böhme)Marcel Böhme2-0/+22
PR c++/69687 * cplus-dem.c: Include <limits.h> if available. (INT_MAX): Define if necessary. (remember_type, remember_Ktype, register_Btype, string_need): Abort if we detect cases where we the size of the allocation would overflow. From-SVN: r234829
2016-04-08Handle an overflow case (PR70498, patch by Marcel Böhme).Marcel Böhme2-0/+11
PR c++/70498 * cplus-dem.c (gnu_special): Handle case where consume_count returns -1. From-SVN: r234828
2016-03-31Add BZ markers to last commitJeff Law1-0/+2
From-SVN: r234646
2016-03-31cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing btypevec/ktypevec.Mikhail Maltsev3-0/+19
* cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing btypevec/ktypevec. * testsuite/demangle-expected: Add coverage tests. From-SVN: r234645
2016-01-27d-demangle.c (dlang_call_convention): Handle extern Objective-C function ↵Iain Buclaw3-2/+22
calling convention. libiberty/ChangeLog: 2016-01-26 Iain Buclaw <ibuclaw@gdcproject.org> * d-demangle.c (dlang_call_convention): Handle extern Objective-C function calling convention. (dlang_call_convention_p): Likewise. (dlang_type): Likewise. * testsuite/d-demangle-expected: Add coverage tests. From-SVN: r232864
2016-01-27d-demangle.c (dlang_function_args): Append ',' for variadic functions only ↵Iain Buclaw3-1/+14
if parameters were seen before the... libiberty/ChangeLog: 2016-01-26 Iain Buclaw <ibuclaw@gdcproject.org> * d-demangle.c (dlang_function_args): Append ',' for variadic functions only if parameters were seen before the elipsis symbol. * testsuite/d-demangle-expected: Add coverage test for parameter-less variadic functions. From-SVN: r232863
2016-01-27d-demangle.c (dlang_type): Handle function types only in the context of ↵Iain Buclaw3-28/+36
seeing a pointer type symbol. libiberty/ChangeLog: 2016-01-27 Iain Buclaw <ibuclaw@gdcproject.org> * d-demangle.c (dlang_type): Handle function types only in the context of seeing a pointer type symbol. * testsuite/d-demangle-expected: Update function pointer tests. From-SVN: r232862
2016-01-05libiberty: {count,dup,write}argv: constify argv input slightlyMike Frysinger3-9/+15
Would be more useful if we could use "const char * const *", but there's a long standing bug where gcc warns about incompatible pointers when you try to pass in "char **". We can at least constify the array itself as gcc will not warn in that case. From-SVN: r232089
2016-01-05libiberty: dupargv: rewrite to use xstrdupMike Frysinger2-5/+5
This func is basically open coding the xstrdup function, so gut it and use that directly. From-SVN: r232086
2015-12-28Tweak the documentation of libiberty's xcrc32 functionPatrick Palka2-7/+13
libiberty/ChangeLog; * crc32.c: In the documentation, don't refer to GDB's now-nonexistent crc32 implementation. In the table-generation program embedded within the documentation, change the type of the induction variables i and j from int to unsigned int, to avoid undefined behavior. From-SVN: r231983
2015-12-21re PR other/66827 (left shifts of negative value warnings due to C++14 switch)Nick Clifton2-1/+7
PR 66827 * regex.c (EXTRACT_NUMBER): Cast sign byte to unsigned before left shifting. From-SVN: r231873
2015-11-27PR other/61321 - demangler crash on casts in template parametersPedro Alves4-8/+77
The fix for bug 59195: [C++ demangler handles conversion operator incorrectly] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59195 unfortunately makes the demangler crash due to infinite recursion, in case of casts in template parameters. For example, with: template<int> struct A {}; template <typename Y> void function_temp(A<sizeof ((Y)(999))>) {} template void function_temp<int>(A<sizeof (int)>); The 'function_temp<int>' instantiation above mangles to: _Z13function_tempIiEv1AIXszcvT_Li999EEE The demangler parses this as: typed name template name 'function_temp' template argument list builtin type int function type builtin type void argument list template (*) name 'A' template argument list unary operator operator sizeof unary operator cast template parameter 0 (**) literal builtin type int name '999' And after the fix for 59195, due to: static void d_print_cast (struct d_print_info *dpi, int options, const struct demangle_component *dc) { ... /* For a cast operator, we need the template parameters from the enclosing template in scope for processing the type. */ if (dpi->current_template != NULL) { dpt.next = dpi->templates; dpi->templates = &dpt; dpt.template_decl = dpi->current_template; } when printing the template argument list of A (what should be "<sizeof (int)>"), the template parameter 0 (that is, "T_", the '**' above) now refers to the first parameter of the the template argument list of the 'A' template (the '*' above), exactly what we were already trying to print. This leads to infinite recursion, and stack exaustion. The template parameter 0 should actually refer to the first parameter of the 'function_temp' template. Where it reads "for the cast operator" in the comment in d_print_cast (above), it's really talking about a conversion operator, like: struct A { template <typename U> explicit operator U(); }; We don't want to inject the template parameters from the enclosing template in scope when processing a cast _expression_, only when handling a conversion operator. The problem is that DEMANGLE_COMPONENT_CAST is currently ambiguous, and means _both_ 'conversion operator' and 'cast expression'. Fix this by adding a new DEMANGLE_COMPONENT_CONVERSION component type, which does what DEMANGLE_COMPONENT_CAST does today, and making DEMANGLE_COMPONENT_CAST just simply print its component subtree. I think we could instead reuse DEMANGLE_COMPONENT_CAST and in d_print_comp_inner still do: @@ -5001,9 +5013,9 @@ d_print_comp_inner (struct d_print_info *dpi, int options, d_print_comp (dpi, options, dc->u.s_extended_operator.name); return; case DEMANGLE_COMPONENT_CAST: d_append_string (dpi, "operator "); - d_print_cast (dpi, options, dc); + d_print_conversion (dpi, options, dc); return; leaving the unary cast case below calling d_print_cast, but seems to me that spliting the component types makes it easier to reason about the code. g++'s testsuite actually generates three symbols that crash the demangler in the same way. I've added those as tests in the demangler testsuite as well. And then this fixes PR other/61233 too, which happens to be a demangler crash originally reported to GDB, at: https://sourceware.org/bugzilla/show_bug.cgi?id=16957 Bootstrapped and regtested on x86_64 Fedora 20. Also ran this through GDB's testsuite. GDB will require a small update to use DEMANGLE_COMPONENT_CONVERSION in one place it's using DEMANGLE_COMPONENT_CAST in its sources. libiberty/ 2015-11-27 Pedro Alves <palves@redhat.com> PR other/61321 PR other/61233 * demangle.h (enum demangle_component_type) <DEMANGLE_COMPONENT_CONVERSION>: New value. * cp-demangle.c (d_demangle_callback, d_make_comp): Handle DEMANGLE_COMPONENT_CONVERSION. (is_ctor_dtor_or_conversion): Handle DEMANGLE_COMPONENT_CONVERSION instead of DEMANGLE_COMPONENT_CAST. (d_operator_name): Return a DEMANGLE_COMPONENT_CONVERSION component if handling a conversion. (d_count_templates_scopes, d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION. (d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION instead of DEMANGLE_COMPONENT_CAST. (d_print_cast): Rename as ... (d_print_conversion): ... this. Adjust comments. (d_print_cast): Rewrite - simply print the left subcomponent. * cp-demint.c (cplus_demangle_fill_component): Handle DEMANGLE_COMPONENT_CONVERSION. * testsuite/demangle-expected: Add tests. From-SVN: r231020
2015-11-12* Makefile.in (etags tags TAGS): Use && instead of ;.Mike Stump2-1/+5
From-SVN: r230270
2015-11-09Configury changes for obstack optimizationAlan Modra2-0/+4
Missed from last patch * config.in: Regenerate. From-SVN: r229991
2015-11-09Configury changes for obstack optimizationAlan Modra3-0/+64
* configure.ac: Check size of size_t. * configure: Regenerate. From-SVN: r229990
2015-11-09Silence obstack.c -Wc++compat warningAlan Modra2-2/+9
* obstack.c (_obstack_newchunk): Silence -Wc++compat warning. (_obstack_begin_worker): Likewise. Move assignment to h->chunk after alloc failure check. From-SVN: r229989
2015-11-09Modify obstack.[hc] to avoid having to include other gnulib filesAlan Modra3-13/+45
Using the standard gnulib obstack source requires importing quite a lot of other files from gnulib, and requires build changes. include/ * obstack.h (__attribute_pure__): Expand _GL_ATTRIBUTE_PURE. libiberty/ * obstack.c (__alignof__): Expand alignof_type from alignof.h. (obstack_exit_failure): Don't use exitfail.h. (_): Include libintl.h when HAVE_LIBINTL_H and nls enabled. Provide default. Don't include gettext.h. (_Noreturn): Define. * obstacks.texi: Adjust node references to external libc info files. From-SVN: r229988
2015-11-09Copy gnulib obstack filesAlan Modra3-478/+340
This copies obstack.[ch] from gnulib, and updates the docs. The next patch should be applied if someone repeats the import at a later date. include/ * obstack.h: Import current gnulib file. libiberty/ * obstack.c: Import current gnulib file. * obstacks.texi: Updated doc, from glibc's manual/memory.texi. From-SVN: r229987
2015-11-06Do not use libiberty's getpagesize on AndroidJoel Brobecker3-0/+18
libiberty/ChangeLog: * configure.ac: Set AC_CV_FUNC_GETPAGESIZE to "yes" on Android hosts. * configure: Regenerate. From-SVN: r229893
2015-10-28Make-lang.in (c.tags): Also include libcpp TAGS.Jason Merrill2-5/+7
gcc/c/ * Make-lang.in (c.tags): Also include libcpp TAGS. gcc/cp/ * Make-lang.in (c++.tags): Also include libcpp TAGS. From-SVN: r229504
2015-10-18Fix PR63758 by using the _NSGetEnviron() API on DarwinRoland McGrath4-12/+17
include/ Roland McGrath <roland@gnu.org> PR other/63758 * environ.h: New file. libiberty/ Roland McGrath <roland@gnu.org> Iain Sandoe <iain@codesourcery.com> PR other/63758 * pex-unix.c: Obtain the environment interface from settings in environ.h rather than in-line code. Update copyright date. * setenv.c: Likewise. * xmalloc.c: Likewise. Co-Authored-By: Iain Sandoe <iain@codesourcery.com> From-SVN: r228942
2015-10-04Implement N4514, C++ Extensions for Transactional Memory.Jason Merrill3-5/+43
gcc/ * builtins.def (BUILT_IN_ABORT): Add transaction_pure attribute. gcc/c-family/ * c-common.c (c_common_reswords): Add C++ TM TS keywords. (c_common_attribute_table): Add transaction_safe_dynamic. transaction_safe now affects type identity. (handle_tm_attribute): Handle transaction_safe_dynamic. * c-common.h (enum rid): Add RID_ATOMIC_NOEXCEPT, RID_ATOMIC_CANCEL, RID_SYNCHRONIZED. (OBJC_IS_CXX_KEYWORD): Add RID_SYNCHRONIZED. (D_TRANSMEM): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_transactional_memory. * c-pretty-print.c (pp_c_attributes_display): Don't print transaction_safe in C++. gcc/c/ * c-parser.c (c_lex_one_token): Handle @synchronized. * c-decl.c (match_builtin_function_types): A declaration of a built-in can change whether the function is transaction_safe. gcc/cp/ * cp-tree.h (struct cp_declarator): Add tx_qualifier field. (BCS_NORMAL, BCS_TRANSACTION): New enumerators. * lex.c (init_reswords): Limit TM kewords to -fgnu-tm. * parser.c (cp_lexer_get_preprocessor_token): Fix @synchronized. (make_call_declarator): Take tx_qualifier. (cp_parser_tx_qualifier_opt): New. (cp_parser_lambda_declarator_opt): Use it. (cp_parser_direct_declarator): Likewise. (cp_parser_statement): Handle atomic_noexcept, atomic_cancel. (cp_parser_compound_statement): Change in_try parameter to bcs_flags. (cp_parser_std_attribute): Map optimize_for_synchronized to transaction_callable. (cp_parser_transaction): Take the token. Handle atomic_noexcept. * lambda.c (maybe_add_lambda_conv_op): Handle transaction-safety. * call.c (enum conversion_kind): Add ck_tsafe. (standard_conversion): Handle transaction-safety conversion. (convert_like_real, resolve_address_of_overloaded_function): Likewise. (check_methods): Diagnose transaction_safe_dynamic on non-virtual function. (look_for_tm_attr_overrides): Don't inherit transaction_safe_dynamic. * cvt.c (tx_safe_fn_type_p, tx_unsafe_fn_variant) (can_convert_tx_safety): New. * typeck.c (composite_pointer_type): Handle transaction-safety. * name-lookup.h (enum scope_kind): Add sk_transaction. * name-lookup.c (begin_scope): Handle it. * semantics.c (begin_compound_stmt): Pass it. * decl.c (check_previous_goto_1): Check it. (struct named_label_entry): Add in_transaction_scope. (poplevel_named_label_1): Set it. (check_goto): Check it. (duplicate_decls): A specialization can be transaction_safe independently of its template. (grokdeclarator): Handle tx-qualifier. * rtti.c (ptr_initializer): Handle transaction-safe. * search.c (check_final_overrider): Check transaction_safe_dynamic. Don't check transaction_safe. * mangle.c (write_function_type): Mangle transaction_safe here. (write_CV_qualifiers_for_type): Not here. (write_type): Preserve transaction_safe when stripping attributes. * error.c (dump_type_suffix): Print transaction_safe. libiberty/ * cp-demangle.c (d_cv_qualifiers): Dx means transaction_safe. (cplus_demangle_type): Let d_cv_qualifiers handle it. (d_dump, d_make_comp, has_return_type, d_encoding) (d_count_templates_scopes, d_print_comp_inner) (d_print_mod_list, d_print_mod, d_print_function_type) (is_ctor_or_dtor): Handle DEMANGLE_COMPONENT_TRANSACTION_SAFE. From-SVN: r228462
2015-08-15cp-demangle.c (d_abi_tags): Preserve di->last_name across any ABI tags.Ian Lance Taylor3-0/+19
* cp-demangle.c (d_abi_tags): Preserve di->last_name across any ABI tags. From-SVN: r226910
2015-08-11Fix test failure on Solaris 9 where strtod() does not accept hexadecimalsIain Buclaw3-22/+22
2015-08-11 Iain Buclaw <ibuclaw@gdcproject.org> libiberty/ * d-demangle.c (dlang_parse_real): Remove call to strtod. (strtod): Remove declaration. * testsuite/d-demangle-expected: Update float and complex literal tests to check correct hexadecimal demangling. From-SVN: r226774
2015-07-13Fix several crashes of C++ demangler on fuzzed input.Mikhail Maltsev4-8/+94
libiberty/ * cp-demangle.c (d_dump): Fix syntax error. (d_identifier): Adjust type of len to match d_source_name. (d_expression_1): Fix out-of-bounds access. Check code variable for NULL before dereferencing it. (d_find_pack): Do not recurse for FIXED_TYPE, DEFAULT_ARG and NUMBER. (d_print_comp_inner): Add NULL pointer check. * cp-demangle.h (d_peek_next_char): Define as inline function when CHECK_DEMANGLER is defined. (d_advance): Likewise. * testsuite/demangle-expected: Add new testcases. From-SVN: r225727
2015-07-09getruntime.c (RUSAGE_SELF): Define if not already defined.Uros Bizjak2-7/+7
* getruntime.c (RUSAGE_SELF): Define if not already defined. (get_runtime): Use RUSAGE_SELF as argument 1 of getrusage call. From-SVN: r225614
2015-07-08getruntime.c (get_run_time): Use RUSAGE_SELF as argument 1 of getrusage call.Uros Bizjak2-0/+9
* getruntime.c (get_run_time) [__USE_GNU]: Use RUSAGE_SELF as argument 1 of getrusage call. From-SVN: r225534
2015-06-01re PR c++/44282 (fastcall is not mangled at all)Jason Merrill3-0/+11
PR c++/44282 gcc/cp/ * mangle.c (attr_strcmp): New. (write_CV_qualifiers_for_type): Also write out attributes that affect type identity. (write_type): Strip all attributes after writing qualifiers. libiberty/ * cp-demangle.c (cplus_demangle_type): Handle arguments to vendor extended qualifier. From-SVN: r224007
2015-05-22libiberty.h (asprintf): Don't declare if HAVE_DECL_ASPRINTF is not defined.Yunlian Jiang6-401/+626
include/: * libiberty.h (asprintf): Don't declare if HAVE_DECL_ASPRINTF is not defined. libiberty/: * configure.ac: Add AC_GNU_SOURCE. * Makefile.in (COMPILE.c): Add -D_GNU_SOURCE. * configure, config.in: Rebuild. * floatformat.c (_GNU_SOURCE): Don't define if already defined. From-SVN: r223589
2015-05-16d-demangle.c (dlang_symbol_kinds): New enum.Iain Buclaw3-57/+190
libiberty/ChangeLog: 2015-05-16 Iain Buclaw <ibuclaw@gdcproject.org> * d-demangle.c (dlang_symbol_kinds): New enum. (dlang_parse_symbol): Update signature. Handle an ambiguity between pascal functions and template value arguments. Only check for a type if parsing a function, or at the top level. Return failure if the entire symbol was not successfully demangled. (dlang_identifier): Update signature. Handle an ambiguity between two adjacent digits in a mangled symbol string. (dlang_type): Update call to dlang_parse_symbol. (dlang_template_args): Likewise. (dlang_parse_template): Likewise. (dlang_demangle): Likewise. * testsuite/d-demangle-expected: Fix bad tests found, and add problematic examples to the unittests. From-SVN: r223247
2015-05-16d-demangle.c (dlang_template_args): Skip over specialized template ↵Iain Buclaw3-0/+19
parameters in mangled symbol. libiberty/ChangeLog: 2015-05-16 Iain Buclaw <ibuclaw@gdcproject.org> * d-demangle.c (dlang_template_args): Skip over specialized template parameters in mangled symbol. * testsuite/d-demangle-expected: Add coverage and unittest for specialized template parameters. From-SVN: r223246
2015-05-16d-demangle.c (dlang_type): Handle cent and ucent types.Iain Buclaw3-0/+27
libiberty/ChangeLog: 2015-05-16 Iain Buclaw <ibuclaw@gdcproject.org> * d-demangle.c (dlang_type): Handle cent and ucent types. * testsuite/d-demangle-expected: Add coverage tests for cent and ucent. From-SVN: r223245