gcc/gcc/cp/error.c

3796 lines
102 KiB
C
Raw Permalink Normal View History

1994-02-24 02:02:37 +01:00
/* Call-backs for C++ error reporting.
This code is non-reentrant.
Copyright (C) 1993-2017 Free Software Foundation, Inc.
This file is part of GCC.
1994-02-24 02:02:37 +01:00
GCC is free software; you can redistribute it and/or modify
1994-02-24 02:02:37 +01:00
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
1994-02-24 02:02:37 +01:00
any later version.
GCC is distributed in the hope that it will be useful,
1994-02-24 02:02:37 +01:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
1994-02-24 02:02:37 +01:00
#include "config.h"
#include "system.h"
#include "coretypes.h"
1994-02-24 02:02:37 +01:00
#include "cp-tree.h"
decl.c: Reorder #include's and remove duplicates. ada 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * gcc-interface/decl.c: Reorder #include's and remove duplicates. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. c 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * c-array-notation.c: Reorder #include's and remove duplicates. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. c-family 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array-notation-common.c: Reorder #include's and remove duplicates. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.c: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * call.c: Reorder #include's and remove duplicates. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-cilkplus.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. * vtable-class-hierarchy.c: Likewise. fortran 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array.c: Reorder #include's and remove duplicates. * convert.c: Likewise. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * frontend-passes.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * resolve.c: Likewise. * simplify.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * go-backend.c: Reorder #include's and remove duplicates. * go-lang.c: Likewise. java 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Reorder #include's and remove duplicates. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. * verify-impl.c: Likewise. jit 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Reorder #include's and remove duplicates. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * libgccjit.c: Likewise. lto 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Reorder #include's and remove duplicates. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objc-lang.c: Reorder #include's and remove duplicates. * objc-map.c: Likewise. objcp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objcp-decl.c: Reorder #include's and remove duplicates. * objcp-lang.c: Likewise. From-SVN: r229533
2015-10-29 16:27:20 +01:00
#include "stringpool.h"
diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. * diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. (diagnostic_initialize): Initialize x_data not last_function. (diagnostic_report_current_function): Move to tree-diagnostic.c. (default_diagnostic_starter): Call diagnostic_report_current_module not diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize x_data not abstract_origin. (verbatim): Likewise. * diagnostic.h (struct diagnostic_info): Change abstract_origin to x_data. (struct diagnostic_context): Change last_function to x_data. (diagnostic_auxiliary_data): Replace with diagnostic_context_auxiliary_data and diagnostic_info_auxiliary_data. (diagnostic_last_function_changed, diagnostic_set_last_function, diagnostic_report_current_function): Move to tree-diagnostic.h. (print_declaration, dump_generic_node, print_generic_stmt, print_generic_stmt_indented, print_generic_expr, print_generic_decl, debug_c_tree, dump_omp_clauses, print_call_name, debug_generic_expr, debug_generic_stmt, debug_tree_chain, default_tree_printer): Move to tree-pretty-print.h. (debug_gimple_stmt, debug_gimple_seq, print_gimple_seq, print_gimple_stmt, print_gimple_expr, dump_gimple_stmt): Move to gimple-pretty-print.h. * pretty-print.c: Don't include tree.h (pp_base_format): Don't handle %K here. (pp_base_tree_identifier): Move to tree-pretty-print.c. * pretty-print.h (text_info): Change abstract_origin to x_data. (pp_tree_identifier, pp_unsupported_tree, pp_base_tree_identifier): Move to tree-pretty-print.h. * gimple-pretty-print.h, tree-diagnostic.c, tree-diagnostic.h, tree-pretty-print.h: New files. * tree-pretty-print.c: Include tree-pretty-print.h. (percent_K_format): New. Moved from pretty-print.c. (pp_base_tree_identifier): Move from pretty-print.c. * c-objc-common.c: Include tree-pretty-print.h. (c_tree_printer): Handle %K here. * langhooks.c: Include tree-diagnostic.h. (lhd_print_error_function): Use diagnostic_abstract_origin macro. * toplev.c: Include tree-diagnostic.h and tree-pretty-print.h. (default_tree_printer): Handle %K using percent_K_format. (general_init): Use default_tree_diagnostic_starter. * tree.c: Include tree-diagnostic.h and tree-pretty-print.h. (free_lang_data): Use default_tree_diagnostic_starter. * c-pretty-print.c: Include tree-pretty-print.h. * cfgexpand.c: Include tree-pretty-print.h and gimple-pretty-print.h. * cgraphunit.c: Include tree-pretty-print.h and gimple-pretty-print.h. * dwarf2out.c: Include tree-pretty-print.h. * except.c: Include tree-pretty-print.h. * gimple-pretty-print.c: Include tree-pretty-print.h and gimple-pretty-print.h. * gimplify.c: Include tree-pretty-print.h. * graphite-poly.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-cp.c: Include tree-pretty-print.h. * ipa-inline.c: Include gimple-pretty-print.h. * ipa-prop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-pure-const.c: Include gimple-pretty-print.h. * ipa-struct-reorg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-type-escape.c: Include tree-pretty-print.h. * print-rtl.c: Include tree-pretty-print.h. * print-tree.c: Include gimple-pretty-print.h. * sese.c: Include tree-pretty-print.h. * tree-affine.c: Include tree-pretty-print.h. * tree-browser.c: Include tree-pretty-print.h. * tree-call-cdce.c: Include gimple-pretty-print.h. * tree-cfg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-chrec.c: Include tree-pretty-print.h. * tree-data-ref.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-dfa.c: Include tree-pretty-print.h. * tree-if-conv.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-inline.c: Include tree-pretty-print.h. * tree-into-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-nrv.c: Include tree-pretty-print.h. * tree-object-size.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-outof-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-parloops.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-predcom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-scalar-evolution.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-sra.c: Include tree-pretty-print.h. * tree-ssa-address.c: Include tree-pretty-print.h. * tree-ssa-alias.c: Include tree-pretty-print.h. * tree-ssa-ccp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-coalesce.c: Include tree-pretty-print.h. * tree-ssa-copy.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-copyrename.c: Include tree-pretty-print.h. * tree-ssa-dce.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dse.c: Include gimple-pretty-print.h. * tree-ssa-forwprop.c: Include tree-pretty-print.h. * tree-ssa-ifcombine.c: Include tree-pretty-print.h. * tree-ssa-live.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-im.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivcanon.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivopts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-niter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-prefetch.c: Include tree-pretty-print.h. * tree-ssa-math-opts.c: Include gimple-pretty-print.h. * tree-ssa-operands.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-phiprop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-pre.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-propagate.c: Include gimple-pretty-print.h. * tree-ssa-reassoc.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sccvn.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sink.c: Include gimple-pretty-print.h. * tree-ssa-ter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-uninit.c: Include gimple-pretty-print.h. * tree-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-stdarg.c: Include gimple-pretty-print.h. * tree-switch-conversion.c: Include gimple-pretty-print.h. * tree-tailcall.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-data-refs.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop-manip.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-patterns.c: Include gimple-pretty-print.h. * tree-vect-slp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-stmts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vectorizer.c: Include tree-pretty-print.h. * tree-vrp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * value-prof.c: Include tree-pretty-print.h and gimple-pretty-print.h. * var-tracking.c: Include tree-pretty-print.h. * Makefile.in (OBJS-common): Add tree-diagnostic.o. (tree-diagnostic.o): New dependencies. (c-objc-common.o, c-pretty-print.o, langhooks.o, tree.o, tree-inline.o, print-tree.o, stor-layout.o, tree-ssa-uninit.o, tree-ssa.o, tree-into-ssa.o, tree-ssa-ter.o, tree-ssa-coalesce.o, tree-outof-ssa.o, tree-ssa-forwprop.o, tree-ssa-phiprop.o, tree-ssa-ifcombine.o, tree-nrv.o, tree-ssa-copy.o, tree-ssa-propagate.o, tree-ssa-dom.o, tree-ssa-uncprop.o, tree-ssa-live.o, tree-ssa-copyrename.o, tree-ssa-pre.o, tree-ssa-sccvn.o, tree-vrp.o, tree-cfg.o, tree-tailcall.o, tree-ssa-sink.o, tree-if-conv.o, tree-dfa.o, tree-ssa-operands.o, tree-ssa-address.o, tree-ssa-loop-niter.o, tree-ssa-loop-ivcanon.o, tree-ssa-loop-prefetch.o, tree-predcom.o, tree-ssa-loop-ivopts.o, tree-affine.o, tree-ssa-loop-im.o, tree-ssa-math-opts.o, tree-ssa-alias.o, tree-ssa-reassoc.o, gimplify.o, tree-browser.o, tree-chrec.o, tree-scalar-evolution.o, tree-data-ref.o, sese.o, graphite-poly.o, tree-vect-loop.o, tree-vect-loop-manip.o, tree-vect-patterns.o, tree-vect-slp.o, tree-vect-stmts.o, tree-vect-data-refs.o, tree-vectorizer.o, tree-parloops.o, tree-stdarg.o, tree-object-size.o, gimple-pretty-print.o, tree-pretty-print.o, diagnostic.o, toplev.o, print-rtl.o, except.o, dwarf2out.o, cgraphunit.o, ipa-prop.o, ipa-cp.o, ipa-inline.o, ipa-pure-const.o, ipa-type-escape.o, ipa-struct-reorg.o, tree-ssa-dce.o, tree-call-cdce.o, tree-ssa-ccp.o, tree-sra.o, tree-switch-conversion.o, var-tracking.o, value-prof.o, cfgexpand.o, pretty-print.o): Update dependencies. cp: * error.c: Include tree-diagnostic.h and tree-pretty-print.h. (cp_print_error_function): Use diagnostic_abstract_origin macro. (cp_printer): Handle %K here using percent_K_format. * cxx-pretty-print.c: Include tree-pretty-print.h. * Make-lang.in (cp/error.o, cp/cxx-pretty-print.o): Update dependencies. From-SVN: r159685
2010-05-22 00:34:26 +02:00
#include "tree-diagnostic.h"
#include "langhooks-def.h"
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
#include "intl.h"
pretty-print.h (pp_set_line_maximum_length): Make macro. * pretty-print.h (pp_set_line_maximum_length): Make macro. (pp_set_prefix): Likewise. (pp_destroy_prefix): Likewise. (pp_remaining_character_count_for_line): Likewise. (pp_clear_output_area): Likewise. (pp_formatted_text): Likewise. (pp_last_position_in_text): Likewise. (pp_emit_prefix): Likewise. (pp_append_text): Likewise. (pp_flush): Likewise. (pp_format_text): Likewise. (pp_format_verbatim): Likewise. (pp_tree_identifier): Tidy. * pretty-print.c (pp_base_format_text): Rename from pp_format_text. (pp_base_format_verbatim): Rename from pp_format_verbatim. (pp_base_flush): Rename from pp_flush. (pp_base_set_line_maximum_length): Rename from pp_set_line_maximum_length. (pp_base_clear_output_area): Rename from pp_clear_output_area. (pp_base_set_prefix): Rename from pp_set_prefix. (pp_base_destroy_prefix): Rename from pp_destroy_prefix. (pp_base_emit_prefix): Rename from pp_emit_prefix. (pp_base_append_text): Rename from pp_append_text. (pp_base_formatted_text): Rename from pp_formatted_text. (pp_base_last_position_in_text): Rename from pp_last_position_in_text. (pp_base_remaining_character_count_for_line): Rename from pp_remaining_character_count_for_line. * diagnostic.h (diagnostic_format_decoder): Tidy. (diagnostic_flush_buffer): Likewise. * c-pretty-print.h: (pp_c_string_literal): Declare. (pp_c_real_literal): Likewise. (pp_c_integer_literal): Likewise. * c-pretty-print.c (pp_c_char): Use pp_string in lieu of pp_identifier. (pp_c_character_literal): Tidy. (pp_c_string_literal): Make public. (pp_c_bool_literal): Likewise. (pp_c_integer_literal): Likewise. (pp_c_real_literal): Likewise. * Makefile.in (C_PRETTY_PRINT_H): New variable. (c-pretty-print.o): Update dependence. cp/ * cxx-pretty-print.h: New file. * cxx-pretty-print.c: Likewise. * error.c (scratch_pretty_printer): Change type. (init_error): Tidy. (dump_aggr_type): Likewise. (dump_global_iord): Likewise. (dump_expr): Likewise. (dump_char): Remove. * cp-lang.c (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): Define. (cxx_initialize_diagnostics): New function. * Make-lang.in (CXX_OBJS): Add cp/cxx-pretty-print.o (CXX_PRETTY_PRINT_H): New variable. (cp/cxx-pretty-print.o): New rule. (cp/cp-lang.o): Update dependence. (cp/error.o): Likewise. From-SVN: r70182
2003-08-05 21:23:14 +02:00
#include "cxx-pretty-print.h"
diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. * diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. (diagnostic_initialize): Initialize x_data not last_function. (diagnostic_report_current_function): Move to tree-diagnostic.c. (default_diagnostic_starter): Call diagnostic_report_current_module not diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize x_data not abstract_origin. (verbatim): Likewise. * diagnostic.h (struct diagnostic_info): Change abstract_origin to x_data. (struct diagnostic_context): Change last_function to x_data. (diagnostic_auxiliary_data): Replace with diagnostic_context_auxiliary_data and diagnostic_info_auxiliary_data. (diagnostic_last_function_changed, diagnostic_set_last_function, diagnostic_report_current_function): Move to tree-diagnostic.h. (print_declaration, dump_generic_node, print_generic_stmt, print_generic_stmt_indented, print_generic_expr, print_generic_decl, debug_c_tree, dump_omp_clauses, print_call_name, debug_generic_expr, debug_generic_stmt, debug_tree_chain, default_tree_printer): Move to tree-pretty-print.h. (debug_gimple_stmt, debug_gimple_seq, print_gimple_seq, print_gimple_stmt, print_gimple_expr, dump_gimple_stmt): Move to gimple-pretty-print.h. * pretty-print.c: Don't include tree.h (pp_base_format): Don't handle %K here. (pp_base_tree_identifier): Move to tree-pretty-print.c. * pretty-print.h (text_info): Change abstract_origin to x_data. (pp_tree_identifier, pp_unsupported_tree, pp_base_tree_identifier): Move to tree-pretty-print.h. * gimple-pretty-print.h, tree-diagnostic.c, tree-diagnostic.h, tree-pretty-print.h: New files. * tree-pretty-print.c: Include tree-pretty-print.h. (percent_K_format): New. Moved from pretty-print.c. (pp_base_tree_identifier): Move from pretty-print.c. * c-objc-common.c: Include tree-pretty-print.h. (c_tree_printer): Handle %K here. * langhooks.c: Include tree-diagnostic.h. (lhd_print_error_function): Use diagnostic_abstract_origin macro. * toplev.c: Include tree-diagnostic.h and tree-pretty-print.h. (default_tree_printer): Handle %K using percent_K_format. (general_init): Use default_tree_diagnostic_starter. * tree.c: Include tree-diagnostic.h and tree-pretty-print.h. (free_lang_data): Use default_tree_diagnostic_starter. * c-pretty-print.c: Include tree-pretty-print.h. * cfgexpand.c: Include tree-pretty-print.h and gimple-pretty-print.h. * cgraphunit.c: Include tree-pretty-print.h and gimple-pretty-print.h. * dwarf2out.c: Include tree-pretty-print.h. * except.c: Include tree-pretty-print.h. * gimple-pretty-print.c: Include tree-pretty-print.h and gimple-pretty-print.h. * gimplify.c: Include tree-pretty-print.h. * graphite-poly.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-cp.c: Include tree-pretty-print.h. * ipa-inline.c: Include gimple-pretty-print.h. * ipa-prop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-pure-const.c: Include gimple-pretty-print.h. * ipa-struct-reorg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-type-escape.c: Include tree-pretty-print.h. * print-rtl.c: Include tree-pretty-print.h. * print-tree.c: Include gimple-pretty-print.h. * sese.c: Include tree-pretty-print.h. * tree-affine.c: Include tree-pretty-print.h. * tree-browser.c: Include tree-pretty-print.h. * tree-call-cdce.c: Include gimple-pretty-print.h. * tree-cfg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-chrec.c: Include tree-pretty-print.h. * tree-data-ref.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-dfa.c: Include tree-pretty-print.h. * tree-if-conv.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-inline.c: Include tree-pretty-print.h. * tree-into-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-nrv.c: Include tree-pretty-print.h. * tree-object-size.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-outof-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-parloops.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-predcom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-scalar-evolution.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-sra.c: Include tree-pretty-print.h. * tree-ssa-address.c: Include tree-pretty-print.h. * tree-ssa-alias.c: Include tree-pretty-print.h. * tree-ssa-ccp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-coalesce.c: Include tree-pretty-print.h. * tree-ssa-copy.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-copyrename.c: Include tree-pretty-print.h. * tree-ssa-dce.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dse.c: Include gimple-pretty-print.h. * tree-ssa-forwprop.c: Include tree-pretty-print.h. * tree-ssa-ifcombine.c: Include tree-pretty-print.h. * tree-ssa-live.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-im.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivcanon.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivopts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-niter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-prefetch.c: Include tree-pretty-print.h. * tree-ssa-math-opts.c: Include gimple-pretty-print.h. * tree-ssa-operands.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-phiprop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-pre.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-propagate.c: Include gimple-pretty-print.h. * tree-ssa-reassoc.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sccvn.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sink.c: Include gimple-pretty-print.h. * tree-ssa-ter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-uninit.c: Include gimple-pretty-print.h. * tree-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-stdarg.c: Include gimple-pretty-print.h. * tree-switch-conversion.c: Include gimple-pretty-print.h. * tree-tailcall.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-data-refs.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop-manip.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-patterns.c: Include gimple-pretty-print.h. * tree-vect-slp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-stmts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vectorizer.c: Include tree-pretty-print.h. * tree-vrp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * value-prof.c: Include tree-pretty-print.h and gimple-pretty-print.h. * var-tracking.c: Include tree-pretty-print.h. * Makefile.in (OBJS-common): Add tree-diagnostic.o. (tree-diagnostic.o): New dependencies. (c-objc-common.o, c-pretty-print.o, langhooks.o, tree.o, tree-inline.o, print-tree.o, stor-layout.o, tree-ssa-uninit.o, tree-ssa.o, tree-into-ssa.o, tree-ssa-ter.o, tree-ssa-coalesce.o, tree-outof-ssa.o, tree-ssa-forwprop.o, tree-ssa-phiprop.o, tree-ssa-ifcombine.o, tree-nrv.o, tree-ssa-copy.o, tree-ssa-propagate.o, tree-ssa-dom.o, tree-ssa-uncprop.o, tree-ssa-live.o, tree-ssa-copyrename.o, tree-ssa-pre.o, tree-ssa-sccvn.o, tree-vrp.o, tree-cfg.o, tree-tailcall.o, tree-ssa-sink.o, tree-if-conv.o, tree-dfa.o, tree-ssa-operands.o, tree-ssa-address.o, tree-ssa-loop-niter.o, tree-ssa-loop-ivcanon.o, tree-ssa-loop-prefetch.o, tree-predcom.o, tree-ssa-loop-ivopts.o, tree-affine.o, tree-ssa-loop-im.o, tree-ssa-math-opts.o, tree-ssa-alias.o, tree-ssa-reassoc.o, gimplify.o, tree-browser.o, tree-chrec.o, tree-scalar-evolution.o, tree-data-ref.o, sese.o, graphite-poly.o, tree-vect-loop.o, tree-vect-loop-manip.o, tree-vect-patterns.o, tree-vect-slp.o, tree-vect-stmts.o, tree-vect-data-refs.o, tree-vectorizer.o, tree-parloops.o, tree-stdarg.o, tree-object-size.o, gimple-pretty-print.o, tree-pretty-print.o, diagnostic.o, toplev.o, print-rtl.o, except.o, dwarf2out.o, cgraphunit.o, ipa-prop.o, ipa-cp.o, ipa-inline.o, ipa-pure-const.o, ipa-type-escape.o, ipa-struct-reorg.o, tree-ssa-dce.o, tree-call-cdce.o, tree-ssa-ccp.o, tree-sra.o, tree-switch-conversion.o, var-tracking.o, value-prof.o, cfgexpand.o, pretty-print.o): Update dependencies. cp: * error.c: Include tree-diagnostic.h and tree-pretty-print.h. (cp_print_error_function): Use diagnostic_abstract_origin macro. (cp_printer): Handle %K here using percent_K_format. * cxx-pretty-print.c: Include tree-pretty-print.h. * Make-lang.in (cp/error.o, cp/cxx-pretty-print.o): Update dependencies. From-SVN: r159685
2010-05-22 00:34:26 +02:00
#include "tree-pretty-print.h"
In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * c-family/c-common.h: Removed the declarations of all the objc_ callbacks, and moved them into c-objc.h. Removed objc_ivar_visibility_kind and moved it into c-objc.h. * c-family/c-objc.h: New file. * c-family/c-common.c: Include c-objc.h. * c-family/c-format.c: Same change. * c-family/stub-objc.c: Same change. * c-decl.c: Include c-family/c-objc.h. * c-parser.c: Same change. * c-typeck.c: Same change. * c-config-lang.in (gtfiles): Added c-family/c-objc.h. * Makefile.in (c-decl.o): Depend on c-family/c-objc.h. (c-parser.o): same change. (c-typeck.o): Same change. (c-family/c-format.o): Same change. (c-family/stub-objc.o): Same change. (c-family/c-common.o): Same change. (PLUGIN_HEADERS): Added c-family/c-objc.h. In gcc/cp/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * call.c: Include c-family/c-objc.h. * decl.c: Same change. * decl2.c: Same change. * error.c: Same change. * lex.c: Same change. * parser.c: Same change. * pt.c: Same change. * semantics.c: Same change. * typeck.c: Same change. * Make-lang.in (cp/decl.o): Depend on c-family/c-objc.h. (cp/decl2.o): Same change. (cp/call.o): Same change. (cp/error.o): Same change. (cp/lex.o): Same change. (cp/parser.o): Same change. (cp/pt.o): Same change. (cp/semantics.o): Same change. (cp/typeck.o): Same change. * config-lang.in (gtfiles): Added c-family/c-objc.h. In gcc/objc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c: Include c-family/c-objc.h. * objc-lang.c: Same change. * Make-lang.in (objc/objc-act.o): Depend on c-family/c-objc.h. (objc/objc-lang.o): Same change. * config-lang.in (gtfiles): Added c-family/c-objc.h. In gcc/objcp/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * config-lang.in (gtfiles): Added c-family/c-objc.h. * Make-lang.in (objcp/objcp-act.o): Depend on c-family/c-objc.h. (objcp/objcp-lang.o): Same change. (objcp/objcp-decl.o): Same change. * objcp-lang.c: Include c-family/c-objc.h. * objcp-decl.c: Same change. From-SVN: r167481
2010-12-06 01:56:06 +01:00
#include "c-family/c-objc.h"
#include "ubsan.h"
#include "internal-fn.h"
1994-02-24 02:02:37 +01:00
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
#define pp_separate_with_comma(PP) pp_cxx_separate_with (PP, ',')
#define pp_separate_with_semicolon(PP) pp_cxx_separate_with (PP, ';')
In cp/error.c... In cp/error.c, I separate the initialization of the diagnostic context from the initialization of the scratch pretty-printer (cxx_pp). This was suggested by Gabriel in the last review of the patch and now I realize it was a good idea. Now cxx_initialize_diagnostics is the equivalent version of c_initialize_diagnostics. To avoid having to make extern a bunch of functions, I moved it from cp-objcp-common.c to error.c. I moved the setting of diagnostic_format_decoder (global_dc) = c_tree_printer, from c_objc_common_init to c_initialize_diagnostics, and right after c_common_diagnostics_set_defaults. This mimics what is done in cxx_initialize_diagnostics. Moreover, in both c_initialize_diagnostics and cxx_initialize_diagnostics, the FE-specific pretty-printer is initialized first and then other settings are applied. This does not make a difference right now, but if in the future one wishes to touch something in the pretty-printer, it will not get overriden immediately. In fact, the code I removed in c_common_initialize_diagnostics, which sets line_cutoff to 80, is useless because the pretty-printer created here is actually never used, but overriden by the FE-specific pretty-printers. This also means that doc/invoke.texi was wrong. Finally, it is useless to set the maximum line length to 0 in the constructor of cxx_pretty_printer. It is the default anyway. gcc/c/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-objc-common.c (c_objc_common_init): Do not do diagnostics initialization here... (c_initialize_diagnostics): ... but here. Set defaults after building pretty-printer. gcc/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * doc/invoke.texi (fmessage-length): Update text to match reality. gcc/cp/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * cp-objcp-common.c: Do not include new. (cxx_initialize_diagnostics): Move from here to ... * error.c (cxx_initialize_diagnostics): : ... here. Move diagnostics initialization here from init_error. (cxx_pp): Use a real pointer not a macro. (init_error): Just initialize cxx_pp. * cxx-pretty-print.c (cxx_pretty_printer::cxx_pretty_printer): Do not set maximum line length. gcc/c-family/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-opts.c (c_common_diagnostics_set_defaults): Renamed from c_common_initialize_diagnostics. * c-common.h: Likewise. From-SVN: r216720
2014-10-26 22:21:58 +01:00
/* cxx_pp is a C++ front-end-specific pretty printer: this is where we
dump C++ ASTs as strings. It is mostly used only by the various
tree -> string functions that are occasionally called from the
debugger or by the front-end for things like
__PRETTY_FUNCTION__. */
static cxx_pretty_printer actual_pretty_printer;
static cxx_pretty_printer * const cxx_pp = &actual_pretty_printer;
cp-tree.h (lang_decl_flags): Remove returns_first_arg and preserves_first_arg. * cp-tree.h (lang_decl_flags): Remove returns_first_arg and preserves_first_arg. Enlarge dummy accordingly. (DECL_TINFO_FN_P): New macro. (SET_DECL_TINO_FN_P): Likeiwse. (DECL_RETURNS_FIRST_ARG): Remove. (DECL_PRESERVES_THIS): Likewise. (DECL_INIT_PRIORITY): New macro. (finish_struct_1): Change prototype. (cat_namespace_levels): Remove prototype. (vtable_decl_p): New prototype. (vtype_decl_p): Likewise. (sigtable_decl_p): Likewise. (walk_globals_pred): New typedef. (walk_globals_fn): Likewise. (walk_globals): New prototype. (walk_namespaces_fn): New typedef. (walk_namespaces): New prototype. (wrapup_globals_for_namespace): Likewise. (walk_vtables): Remove prototype. (walk_sigtables): Likewise. (instantiate_pending_templates): New prototype. * class.c (finish_struct_1): Don't return a value. * decl.h (pending_statics): Remove declaration. * decl.c (walk_namespaces_r): New function. (walk_globals_r): Likewise. (vtable_decl_p): Likewise. (vtype_decl_p): Likewise. (sigtable_decl_p): Likewise. (walk_namespaces): Likewise. (walk_globals_data): New type. (walk_globals): New function. (wrapup_globals_for_namespace): Likewise. (expand_static_init): Remove assertion. Remove redundancy in conditional. Don't put static data members in static_aggregates Tidy. (finish_function): Remove redundancy in conditional. Don't set DECL_RETURNS_FIRST_ARG. (cat_namespace_levels): Remove. * decl2.c: Include splay-tree.h and varray.h. (priority_info_s): New structure. (finish_vtable_vardecl): Change prototype. Adjust for new calling conventions. (prune_vtable_vardecl): Likewise. (finish_sigtable_vardecl): Likewise. (setup_initp): Remove. (do_dtors): Remove. (do_ctors): Remove. (start_static_storage_duration_function): New function. (generate_inits_for_priority): Likewise. (finish_static_storage_duration_function): Likewise. (get_priority_info): Likewise. (do_static_initialization): Likewise. (do_static_destruction): Likewise. (do_static_initialization_and_destruction): Likewise. (generate_ctor_or_dtor_function): Likewise. (generate_ctor_and_dtor_functions_for_priority): Likewise. (pending_statics): Make it a varray. (pending_statics_used): New variable. (saved_inlines): Make it a varray. (saved_inlines_used): New variable. (finish_static_data_member): Change method of updating pending_statics. (mark_inline_for_output): Remove #if 0'd code. Change method of updating saved_inlines. (walk_vtables): Remove. (walk_sigtables): Likewise. (import_export_decl): Use DECL_TINFO_FN_P. (pending_templates): Remove declaration. (maybe_templates): Likewise. (static_aggregates_initp): Likewise. (setup_initp): Likewise. (finish_objects): Simplify. (INITIALIZE_P_IDENTIFIER): New macro. (PRIORITY_IDENTIFIER): New macro. (SSDF_IDENTIFIER): New macro. (initialize_p_decl): New variable. (priority_decl): Likewise. (ssdf_decl): Likewise. (priority_info_map): Likewise. (finish_file): Recode output of static intializers and other file-scope finalization tasks. * error.c (OB_END_TEMPLATE_ID): New macro. (dump_type_real): Use it. (dump_decl): Likewise. (dump_function_name): Likewise. * lex.c (set_typedecl_interface_info): Adjust for new walk_globals interface. (check_newline): Use walk_globals, not walk_vtables. * pt.c (pending_tempalte_expansions): Remove. (set_vardecl_interface_info): Likewise. (pending_templates): Make static. (maybe_templates): Likewise. (instantiate_class_template): Adjust call to finish_struct_1. (instantiate_pending_templates): New function. * rtti.c (get_tinfo_fn): Use SET_DECL_TINFO_FN_P. * tree.c (static_aggregates_initp): Remove. (cp_valid_lang_attribute): Don't use it; use DECL_INIT_PRIORITY instead. * Makefile.in (decl2.o): Depend on varray.h and splay-tree.h. From-SVN: r26594
1999-04-23 01:13:12 +02:00
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
/* Translate if being used for diagnostics, but not for dump files or
__PRETTY_FUNCTION. */
#define M_(msgid) (pp_translate_identifiers (cxx_pp) ? _(msgid) : (msgid))
# define NEXT_CODE(T) (TREE_CODE (TREE_TYPE (T)))
1994-02-24 02:02:37 +01:00
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
static const char *args_to_string (tree, int);
static const char *assop_to_string (enum tree_code);
static const char *code_to_string (enum tree_code);
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
static const char *cv_to_string (tree, int);
static const char *decl_to_string (tree, int);
static const char *expr_to_string (tree);
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
static const char *fndecl_to_string (tree, int);
static const char *op_to_string (enum tree_code);
static const char *parm_to_string (int);
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
static const char *type_to_string (tree, int);
static void dump_alias_template_specialization (cxx_pretty_printer *, tree, int);
static void dump_type (cxx_pretty_printer *, tree, int);
static void dump_typename (cxx_pretty_printer *, tree, int);
static void dump_simple_decl (cxx_pretty_printer *, tree, tree, int);
static void dump_decl (cxx_pretty_printer *, tree, int);
static void dump_template_decl (cxx_pretty_printer *, tree, int);
static void dump_function_decl (cxx_pretty_printer *, tree, int);
static void dump_expr (cxx_pretty_printer *, tree, int);
static void dump_unary_op (cxx_pretty_printer *, const char *, tree, int);
static void dump_binary_op (cxx_pretty_printer *, const char *, tree, int);
static void dump_aggr_type (cxx_pretty_printer *, tree, int);
static void dump_type_prefix (cxx_pretty_printer *, tree, int);
static void dump_type_suffix (cxx_pretty_printer *, tree, int);
static void dump_function_name (cxx_pretty_printer *, tree, int);
static void dump_call_expr_args (cxx_pretty_printer *, tree, int, bool);
static void dump_aggr_init_expr_args (cxx_pretty_printer *, tree, int, bool);
static void dump_expr_list (cxx_pretty_printer *, tree, int);
static void dump_global_iord (cxx_pretty_printer *, tree);
static void dump_parameters (cxx_pretty_printer *, tree, int);
static void dump_ref_qualifier (cxx_pretty_printer *, tree, int);
static void dump_exception_spec (cxx_pretty_printer *, tree, int);
static void dump_template_argument (cxx_pretty_printer *, tree, int);
static void dump_template_argument_list (cxx_pretty_printer *, tree, int);
static void dump_template_parameter (cxx_pretty_printer *, tree, int);
static void dump_template_bindings (cxx_pretty_printer *, tree, tree,
vec<tree, va_gc> *);
static void dump_scope (cxx_pretty_printer *, tree, int);
static void dump_template_parms (cxx_pretty_printer *, tree, int, int);
static int get_non_default_template_args_count (tree, int);
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
static const char *function_category (tree);
static void maybe_print_constexpr_context (diagnostic_context *);
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
static void maybe_print_instantiation_context (diagnostic_context *);
static void print_instantiation_full_context (diagnostic_context *);
static void print_instantiation_partial_context (diagnostic_context *,
decl.c (cp_tree_node_structure): Kill TINST_LEVEL case. 2007-08-25 Paolo Bonzini <bonzini@gnu.org> * decl.c (cp_tree_node_structure): Kill TINST_LEVEL case. * cp-objcp-common.c (cp_tree_size): Ditto. * tree.c (cp_walk_subtrees): Ditto * cp-tree.def (TINST_LEVEL): Go away. * cp-tree.h (struct tinst_level_s): Rename to struct tinst_level, move together with other non-tree structs. (enum cp_tree_node_structure_enum): Nuke TS_CP_TINST_LEVEL. (union lang_tree_node): Eliminate tinst_level field. (TINST_DECL, TINST_LOCATION, TINST_IN_SYSTEM_HEADER_P): Annihilate. (current_instantiation, outermost_tinst_level): Return a "struct tinst_level *". * error.c (print_instantiation_partial_context): Change second parameter to a "struct tinst_level *". Replace accessor macros with field access. (print_instantiation_full_context): Likewise. * lex.c (in_main_input_context): Likewise. * pt.c (struct pending_templates): New. (pending_templates, last_pending_template): Use it as a type. (current_tinst_level): Change typo to "struct tinst_level *" (reopen_tinst_level): Accept "struct tinst_level *", return decl. (add_pending_template): Construct a "struct pending_template". Replace TINST_LEVEL accessor macros with field access. (push_tinst_level): Likewise, using GGC_NEW instead of make_node. (pop_tinst_level): Likewise. (instantiate_pending_templates): Likewise. Factor common code used when an instantiation has been done. (outermost_tinst_level): Replace tree_last with loop. (current_instantiation): Return a "struct tinst_level *". From-SVN: r127796
2007-08-25 09:36:35 +02:00
struct tinst_level *,
location_t);
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
static void cp_diagnostic_starter (diagnostic_context *, diagnostic_info *);
static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
pretty-print.h (PP_NL_ARGMAX): New. gcc: * pretty-print.h (PP_NL_ARGMAX): New. (text_info): Add locus. (struct chunk_info): New. (output_buffer): Add formatted_obstack, chunk_obstack, and cur_chunk_array. Change obstack to a pointer. (pp_wrapping_mode_t, pp_wrapping_mode, pp_set_verbatim_wrapping): New. (struct pretty_print_info): Replace ideal_maximum_length and prefixing_rule with wrapping. (pp_line_cutoff, pp_prefixing_rule): Update to match. Update prototypes and wrapper macros throughout. * pretty-print.c (pp_formatted_text_data, pp_append_r) (pp_base_clear_output_area, pp_construct, pp_base_formatted_text) (pp_base_last_position_in_text, pp_base_newline, pp_base_character): Update for changes to pp structure. (pp_base_prepare_to_format, pp_base_format_text): Delete. (pp_base_format, pp_base_output_formatted_text): New functions. (pp_base_format_verbatim): Use pp_set_verbatim_wrapping. (pp_verbatim): Clear text.locus. (pp_printf): Likewise. Use pp_format and pp_output_formatted_text. * c-objc-common.c (c_tree_printer): Update function signature. * diagnostic.c (diagnostic_initialize): Update for changes to pp structure. (diagnostic_report_diagnostic): Call pp_format and then pp_output_formatted_text. (verbatim): Clear text.locus. * diagnostic.h (diagnostic_prefixing_rule, diagnostic_line_cutoff): Update for changes to pp structure. * c-lang.c: No need to include c-pretty-print.h. * Makefile.in: Remove bogus line containing only a tab. (c-lang.o): Update dependencies. * toplev.c (announce_function): Don't use verbatim. (default_tree_printer): Update signature. * objc/objc-lang.c: No need to include c-pretty-print.h. * objc/Make-lang.in: Update dependencies. gcc/cp: * cp-lang.c: No need to include cxx-pretty-print.h. * error.c (cp_printer): Update signature. No need to process flags. (print_instantiation_partial_context): Output last newline with pp_base_newline. * Make-lang.in: Update dependencies. gcc/objcp: * objcp-lang.c: No need to include cxx-pretty-print.h. * Make-lang.in: Update dependencies. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r101481
2005-07-01 01:09:06 +02:00
static bool cp_printer (pretty_printer *, text_info *, const char *,
int, bool, bool, bool);
1994-02-24 02:02:37 +01:00
In cp/error.c... In cp/error.c, I separate the initialization of the diagnostic context from the initialization of the scratch pretty-printer (cxx_pp). This was suggested by Gabriel in the last review of the patch and now I realize it was a good idea. Now cxx_initialize_diagnostics is the equivalent version of c_initialize_diagnostics. To avoid having to make extern a bunch of functions, I moved it from cp-objcp-common.c to error.c. I moved the setting of diagnostic_format_decoder (global_dc) = c_tree_printer, from c_objc_common_init to c_initialize_diagnostics, and right after c_common_diagnostics_set_defaults. This mimics what is done in cxx_initialize_diagnostics. Moreover, in both c_initialize_diagnostics and cxx_initialize_diagnostics, the FE-specific pretty-printer is initialized first and then other settings are applied. This does not make a difference right now, but if in the future one wishes to touch something in the pretty-printer, it will not get overriden immediately. In fact, the code I removed in c_common_initialize_diagnostics, which sets line_cutoff to 80, is useless because the pretty-printer created here is actually never used, but overriden by the FE-specific pretty-printers. This also means that doc/invoke.texi was wrong. Finally, it is useless to set the maximum line length to 0 in the constructor of cxx_pretty_printer. It is the default anyway. gcc/c/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-objc-common.c (c_objc_common_init): Do not do diagnostics initialization here... (c_initialize_diagnostics): ... but here. Set defaults after building pretty-printer. gcc/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * doc/invoke.texi (fmessage-length): Update text to match reality. gcc/cp/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * cp-objcp-common.c: Do not include new. (cxx_initialize_diagnostics): Move from here to ... * error.c (cxx_initialize_diagnostics): : ... here. Move diagnostics initialization here from init_error. (cxx_pp): Use a real pointer not a macro. (init_error): Just initialize cxx_pp. * cxx-pretty-print.c (cxx_pretty_printer::cxx_pretty_printer): Do not set maximum line length. gcc/c-family/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-opts.c (c_common_diagnostics_set_defaults): Renamed from c_common_initialize_diagnostics. * c-common.h: Likewise. From-SVN: r216720
2014-10-26 22:21:58 +01:00
/* CONTEXT->printer is a basic pretty printer that was constructed
presumably by diagnostic_initialize(), called early in the
compiler's initialization process (in general_init) Before the FE
is initialized. This (C++) FE-specific diagnostic initializer is
thus replacing the basic pretty printer with one that has C++-aware
capacities. */
1994-02-24 02:02:37 +01:00
void
In cp/error.c... In cp/error.c, I separate the initialization of the diagnostic context from the initialization of the scratch pretty-printer (cxx_pp). This was suggested by Gabriel in the last review of the patch and now I realize it was a good idea. Now cxx_initialize_diagnostics is the equivalent version of c_initialize_diagnostics. To avoid having to make extern a bunch of functions, I moved it from cp-objcp-common.c to error.c. I moved the setting of diagnostic_format_decoder (global_dc) = c_tree_printer, from c_objc_common_init to c_initialize_diagnostics, and right after c_common_diagnostics_set_defaults. This mimics what is done in cxx_initialize_diagnostics. Moreover, in both c_initialize_diagnostics and cxx_initialize_diagnostics, the FE-specific pretty-printer is initialized first and then other settings are applied. This does not make a difference right now, but if in the future one wishes to touch something in the pretty-printer, it will not get overriden immediately. In fact, the code I removed in c_common_initialize_diagnostics, which sets line_cutoff to 80, is useless because the pretty-printer created here is actually never used, but overriden by the FE-specific pretty-printers. This also means that doc/invoke.texi was wrong. Finally, it is useless to set the maximum line length to 0 in the constructor of cxx_pretty_printer. It is the default anyway. gcc/c/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-objc-common.c (c_objc_common_init): Do not do diagnostics initialization here... (c_initialize_diagnostics): ... but here. Set defaults after building pretty-printer. gcc/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * doc/invoke.texi (fmessage-length): Update text to match reality. gcc/cp/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * cp-objcp-common.c: Do not include new. (cxx_initialize_diagnostics): Move from here to ... * error.c (cxx_initialize_diagnostics): : ... here. Move diagnostics initialization here from init_error. (cxx_pp): Use a real pointer not a macro. (init_error): Just initialize cxx_pp. * cxx-pretty-print.c (cxx_pretty_printer::cxx_pretty_printer): Do not set maximum line length. gcc/c-family/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-opts.c (c_common_diagnostics_set_defaults): Renamed from c_common_initialize_diagnostics. * c-common.h: Likewise. From-SVN: r216720
2014-10-26 22:21:58 +01:00
cxx_initialize_diagnostics (diagnostic_context *context)
1994-02-24 02:02:37 +01:00
{
In cp/error.c... In cp/error.c, I separate the initialization of the diagnostic context from the initialization of the scratch pretty-printer (cxx_pp). This was suggested by Gabriel in the last review of the patch and now I realize it was a good idea. Now cxx_initialize_diagnostics is the equivalent version of c_initialize_diagnostics. To avoid having to make extern a bunch of functions, I moved it from cp-objcp-common.c to error.c. I moved the setting of diagnostic_format_decoder (global_dc) = c_tree_printer, from c_objc_common_init to c_initialize_diagnostics, and right after c_common_diagnostics_set_defaults. This mimics what is done in cxx_initialize_diagnostics. Moreover, in both c_initialize_diagnostics and cxx_initialize_diagnostics, the FE-specific pretty-printer is initialized first and then other settings are applied. This does not make a difference right now, but if in the future one wishes to touch something in the pretty-printer, it will not get overriden immediately. In fact, the code I removed in c_common_initialize_diagnostics, which sets line_cutoff to 80, is useless because the pretty-printer created here is actually never used, but overriden by the FE-specific pretty-printers. This also means that doc/invoke.texi was wrong. Finally, it is useless to set the maximum line length to 0 in the constructor of cxx_pretty_printer. It is the default anyway. gcc/c/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-objc-common.c (c_objc_common_init): Do not do diagnostics initialization here... (c_initialize_diagnostics): ... but here. Set defaults after building pretty-printer. gcc/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * doc/invoke.texi (fmessage-length): Update text to match reality. gcc/cp/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * cp-objcp-common.c: Do not include new. (cxx_initialize_diagnostics): Move from here to ... * error.c (cxx_initialize_diagnostics): : ... here. Move diagnostics initialization here from init_error. (cxx_pp): Use a real pointer not a macro. (init_error): Just initialize cxx_pp. * cxx-pretty-print.c (cxx_pretty_printer::cxx_pretty_printer): Do not set maximum line length. gcc/c-family/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-opts.c (c_common_diagnostics_set_defaults): Renamed from c_common_initialize_diagnostics. * c-common.h: Likewise. From-SVN: r216720
2014-10-26 22:21:58 +01:00
pretty_printer *base = context->printer;
cxx_pretty_printer *pp = XNEW (cxx_pretty_printer);
context->printer = new (pp) cxx_pretty_printer ();
/* It is safe to free this object because it was previously XNEW()'d. */
base->~pretty_printer ();
XDELETE (base);
c_common_diagnostics_set_defaults (context);
diagnostic_starter (context) = cp_diagnostic_starter;
/* diagnostic_finalizer is already c_diagnostic_finalizer. */
In cp/error.c... In cp/error.c, I separate the initialization of the diagnostic context from the initialization of the scratch pretty-printer (cxx_pp). This was suggested by Gabriel in the last review of the patch and now I realize it was a good idea. Now cxx_initialize_diagnostics is the equivalent version of c_initialize_diagnostics. To avoid having to make extern a bunch of functions, I moved it from cp-objcp-common.c to error.c. I moved the setting of diagnostic_format_decoder (global_dc) = c_tree_printer, from c_objc_common_init to c_initialize_diagnostics, and right after c_common_diagnostics_set_defaults. This mimics what is done in cxx_initialize_diagnostics. Moreover, in both c_initialize_diagnostics and cxx_initialize_diagnostics, the FE-specific pretty-printer is initialized first and then other settings are applied. This does not make a difference right now, but if in the future one wishes to touch something in the pretty-printer, it will not get overriden immediately. In fact, the code I removed in c_common_initialize_diagnostics, which sets line_cutoff to 80, is useless because the pretty-printer created here is actually never used, but overriden by the FE-specific pretty-printers. This also means that doc/invoke.texi was wrong. Finally, it is useless to set the maximum line length to 0 in the constructor of cxx_pretty_printer. It is the default anyway. gcc/c/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-objc-common.c (c_objc_common_init): Do not do diagnostics initialization here... (c_initialize_diagnostics): ... but here. Set defaults after building pretty-printer. gcc/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * doc/invoke.texi (fmessage-length): Update text to match reality. gcc/cp/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * cp-objcp-common.c: Do not include new. (cxx_initialize_diagnostics): Move from here to ... * error.c (cxx_initialize_diagnostics): : ... here. Move diagnostics initialization here from init_error. (cxx_pp): Use a real pointer not a macro. (init_error): Just initialize cxx_pp. * cxx-pretty-print.c (cxx_pretty_printer::cxx_pretty_printer): Do not set maximum line length. gcc/c-family/ChangeLog: 2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/53061 * c-opts.c (c_common_diagnostics_set_defaults): Renamed from c_common_initialize_diagnostics. * c-common.h: Likewise. From-SVN: r216720
2014-10-26 22:21:58 +01:00
diagnostic_format_decoder (context) = cp_printer;
}
top level: * errors.h (warning, error, fatal, internal_error): Don't mark with ATTRIBUTE_PRINTF_n. * toplev.h (internal_error, fatal_io_error, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, error_for_asm, warning_for_asm): Likewise. cp: * Make-lang.in (CXX_OBJS): Take out cp/errfn.o. (cp/errfn.o): Delete rule. (cp/error.o): Depend on flags.h. * errfn.c: Delete file. * cp-tree.h: Declare warn_deprecated. Remove definitions of TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning, cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and internal_error respectively. Make cp_deprecated into a macro. Don't define cp_printer typedef or declare cp_printers. * error.c: Include flags.h. Delete: struct tree_formatting_info, print_function_argument_list, print_declaration, print_expression, print_function_declaration, print_function_parameter, print_type_id, print_cv_qualifier_seq, print_type_specifier_seq, print_simple_type_specifier, print_elaborated_type_specifier, print_rest_of_abstract_declarator, print_parameter_declaration_clause, print_exception_specification, print_nested_name_specifier, and definition of cp_printers. (locate_error): New function. (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and rewritten in terms of locate_error and diagnostic.c. (cp_tree_printer): Rename cp_printer; wire up to *_to_string instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. po: * POTFILES.in: Remove cp/errfn.c. From-SVN: r45765
2001-09-24 02:27:33 +02:00
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* Dump a scope, if deemed necessary. */
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
static void
dump_scope (cxx_pretty_printer *pp, tree scope, int flags)
{
int f = flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (scope == NULL_TREE)
return;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (TREE_CODE (scope) == NAMESPACE_DECL)
{
if (scope != global_namespace)
{
dump_decl (pp, scope, f);
pp_cxx_colon_colon (pp);
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
else if (AGGREGATE_TYPE_P (scope))
{
dump_type (pp, scope, f);
pp_cxx_colon_colon (pp);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
else if ((flags & TFF_SCOPE) && TREE_CODE (scope) == FUNCTION_DECL)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
{
dump_function_decl (pp, scope, f);
pp_cxx_colon_colon (pp);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
}
/* Dump the template ARGument under control of FLAGS. */
static void
dump_template_argument (cxx_pretty_printer *pp, tree arg, int flags)
{
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
if (ARGUMENT_PACK_P (arg))
dump_template_argument_list (pp, ARGUMENT_PACK_ARGS (arg),
/* No default args in argument packs. */
flags|TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS);
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
else if (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)
dump_type (pp, arg, flags & ~TFF_CLASS_KEY_OR_ENUM);
else
{
if (TREE_CODE (arg) == TREE_LIST)
arg = TREE_VALUE (arg);
/* Strip implicit conversions. */
while (CONVERT_EXPR_P (arg))
arg = TREE_OPERAND (arg, 0);
dump_expr (pp, arg, (flags | TFF_EXPR_IN_PARENS) & ~TFF_CLASS_KEY_OR_ENUM);
}
}
/* Count the number of template arguments ARGS whose value does not
match the (optional) default template parameter in PARAMS */
static int
get_non_default_template_args_count (tree args, int flags)
{
int n = TREE_VEC_LENGTH (INNERMOST_TEMPLATE_ARGS (args));
if (/* We use this flag when generating debug information. We don't
invoke.texi (-fvar-tracking-assignments): New. gcc/ChangeLog: * doc/invoke.texi (-fvar-tracking-assignments): New. (-fvar-tracking-assignments-toggle): New. (-fdump-final-insns=file): Mark filename as optional. (--param min-nondebug-insn-uid): New. (-gdwarf-@{version}): Mention version 4. * opts.c (common_handle_option): Accept it. * tree-vrp.c (find_assert_locations_1): Skip debug stmts. * regrename.c (regrename_optimize): Drop last. Don't count debug insns as uses. Don't reject change because of debug insn. (do_replace): Reject DEBUG_INSN as chain starter. Take base_regno from the chain starter, and check for inexact matches in DEBUG_INSNS. (scan_rtx_reg): Accept inexact matches in DEBUG_INSNs. (build_def_use): Simplify and fix the marking of DEBUG_INSNs. * sched-ebb.c (schedule_ebbs): Skip boundary debug insns. * fwprop.c (forward_propagate_and_simplify): ...into debug insns. * doc/gimple.texi (is_gimple_debug): New. (gimple_debug_bind_p): New. (is_gimple_call, gimple_assign_cast_p): End sentence with period. * doc/install.texi (bootstrap-debug): More details. (bootstrap-debug-big, bootstrap-debug-lean): Document. (bootstrap-debug-lib): More details. (bootstrap-debug-ckovw): Update. (bootstrap-time): New. * tree-into-ssa.c (mark_def_sites): Skip debug stmts. (insert_phi_nodes_for): Insert debug stmts. (rewrite_stmt): Take iterator. Insert debug stmts. (rewrite_enter_block): Adjust. (maybe_replace_use_in_debug_stmt): New. (rewrite_update_stmt): Use it. (mark_use_interesting): Return early for debug stmts. * tree-ssa-loop-im.c (rewrite_bittest): Propagate DEFs into debug stmts before replacing stmt. (move_computations_stmt): Likewise. * ira-conflicts.c (add_copies): Skip debug insns. * regstat.c (regstat_init_n_sets_and_refs): Discount debug insns. (regstat_bb_compute_ri): Skip debug insns. * tree-ssa-threadupdate.c (redirection_block_p): Skip debug stmts. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt, check_loop_closed_ssa_stmt): Skip debug stmts. * tree-tailcall.c (find_tail_calls): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise. * tree.h (MAY_HAVE_DEBUG_STMTS): New. (build_var_debug_value_stat): Declare. (build_var_debug_value): Define. (target_for_debug_bind): Declare. * reload.c (find_equiv_reg): Skip debug insns. * rtlanal.c (reg_used_between_p): Skip debug insns. (side_effects_p): Likewise. (canonicalize_condition): Likewise. * ddg.c (create_ddg_dep_from_intra_loop_link): Check that non-debug insns never depend on debug insns. (create_ddg_dep_no_link): Likewise. (add_cross_iteration_register_deps): Use ANTI_DEP for debug insns. Don't add inter-loop dependencies for debug insns. (build_intra_loop_deps): Likewise. (create_ddg): Count debug insns. * ddg.h (struct ddg::num_debug): New. (num_backargs): Pair up with previous int field. * diagnostic.c (diagnostic_report_diagnostic): Skip notes on -fcompare-debug-second. * final.c (get_attr_length_1): Skip debug insns. (rest_of_clean-state): Don't dump CFA_RESTORE_STATE. * gcc.c (invoke_as): Call compare-debug-dump-opt. (driver_self_specs): Map -fdump-final-insns to -fdump-final-insns=.. (get_local_tick): New. (compare_debug_dump_opt_spec_function): Test for . argument and compute output name. Compute temp output spec without flag name. Compute -frandom-seed. (OPT): Undef after use. * cfgloopanal.c (num_loop_insns): Skip debug insns. (average_num_loop_insns): Likewise. * params.h (MIN_NONDEBUG_INSN_UID): New. * gimple.def (GIMPLE_DEBUG): New. * ipa-reference.c (scan_stmt_for_static_refs): Skip debug stmts. * auto-inc-dec.c (merge_in_block): Skip debug insns. (merge_in_block): Fix whitespace. * toplev.c (flag_var_tracking): Update comment. (flag_var_tracking_assignments): New. (flag_var_tracking_assignments_toggle): New. (process_options): Don't open final insns dump file if we're not going to write to it. Compute defaults for var_tracking. * df-scan.c (df_insn_rescan_debug_internal): New. (df_uses_record): Handle debug insns. * haifa-sched.c (ready): Initialize n_debug. (contributes_to_priority): Skip debug insns. (dep_list_size): New. (priority): Use it. (rank_for_schedule): Likewise. Schedule debug insns as soon as they're ready. Disregard previous debug insns to make decisions. (queue_insn): Never queue debug insns. (ready_add, ready_remove_first, ready_remove): Count debug insns. (schedule_insn): Don't reject debug insns because of issue rate. (get_ebb_head_tail, no_real_insns_p): Skip boundary debug insns. (queue_to_ready): Skip and discount debug insns. (choose_ready): Let debug insns through. (schedule_block): Check boundary debug insns. Discount debug insns, schedule them early. Adjust whitespace. (set_priorities): Check for boundary debug insns. (add_jump_dependencies): Use dep_list_size. (prev_non_location_insn): New. (check_cfg): Use it. * tree-ssa-loop-ivopts.c (find-interesting_users): Skip debug stmts. (remove_unused_ivs): Reset debug stmts. * modulo-sched.c (const_iteration_count): Skip debug insns. (res_MII): Discount debug insns. (loop_single_full_bb_p): Skip debug insns. (sms_schedule): Likewise. (sms_schedule_by_order): Likewise. (ps_has_conflicts): Likewise. * caller-save.c (refmarker_fn): New. (save_call_clobbered_regs): Replace regs with saved mem in debug insns. (mark_referenced_regs): Take pointer, mark and arg. Adjust. Call refmarker_fn mark for hardregnos. (mark_reg_as_referenced): New. (replace_reg_with_saved_mem): New. * ipa-pure-const.c (check_stmt): Skip debug stmts. * cse.c (cse_insn): Canonicalize debug insns. Skip them when searching back. (cse_extended_basic_block): Skip debug insns. (count_reg_usage): Likewise. (is_dead_reg): New, split out of... (set_live_p): ... here. (insn_live_p): Use it for debug insns. * tree-stdarg.c (check_all_va_list_escapes): Skip debug stmts. (execute_optimize_stdarg): Likewise. * tree-ssa-dom.c (propagate_rhs_into_lhs): Likewise. * tree-ssa-propagate.c (substitute_and_fold): Don't regard changes in debug stmts as changes. * sel-sched.c (moving_insn_creates_bookkeeping_block_p): New. (moveup_expr): Don't move across debug insns. Don't move debug insn if it would create a bookkeeping block. (moveup_expr_cached): Don't use cache for debug insns that are heads of blocks. (compute_av_set_inside_bb): Skip debug insns. (sel_rank_for_schedule): Schedule debug insns first. Remove dead code. (block_valid_for_bookkeeping_p); Support lax searches. (create_block_for_bookkeeping): Adjust block numbers when encountering debug-only blocks. (find_place_for_bookkeeping): Deal with debug-only blocks. (generate_bookkeeping_insn): Accept no place to insert. (remove_temp_moveop_nops): New argument full_tidying. (prepare_place_to_insert): Deal with debug insns. (advance_state_on_fence): Debug insns don't start cycles. (update_boundaries): Take fence as argument. Deal with debug insns. (schedule_expr_on_boundary): No full_tidying on debug insns. (fill_insns): Deal with debug insns. (track_scheduled_insns_and_blocks): Don't count debug insns. (need_nop_to_preserve_insn_bb): New, split out of... (remove_insn_from_stream): ... this. (fur_orig_expr_not_found): Skip debug insns. * rtl.def (VALUE): Move up. (DEBUG_INSN): New. * tree-ssa-sink.c (all_immediate_uses_same_place): Skip debug stmts. (nearest_common_dominator_of_uses): Take debug_stmts argument. Set it if debug stmts are found. (statement_sink_location): Skip debug stmts. Propagate moving defs into debug stmts. * ifcvt.c (first_active_insn): Skip debug insns. (last_active_insns): Likewise. (cond_exec_process_insns): Likewise. (noce_process_if_block): Likewise. (check_cond_move_block): Likewise. (cond_move_convert_if_block): Likewise. (block_jumps_and_fallthru_p): Likewise. (dead_or_predicable): Likewise. * dwarf2out.c (debug_str_hash_forced): New. (find_AT_string): Add comment. (gen_label_for_indirect_string): New. (get_debug_string_label): New. (AT_string_form): Use it. (mem_loc_descriptor): Handle non-TLS symbols. Handle MINUS , DIV, MOD, AND, IOR, XOR, NOT, ABS, NEG, and CONST_STRING. Accept but discard COMPARE, IF_THEN_ELSE, ROTATE, ROTATERT, TRUNCATE and several operations that cannot be represented with DWARF opcodes. (loc_descriptor): Ignore SIGN_EXTEND and ZERO_EXTEND. Require dwarf_version 4 for DW_OP_implicit_value and DW_OP_stack_value. (dwarf2out_var_location): Take during-call mark into account. (output_indirect_string): Update comment. Output if there are label and references. (prune_indirect_string): New. (prune_unused_types): Call it if debug_str_hash_forced. More in dwarf2out.c, from Jakub Jelinek <jakub@redhat.com>: (dw_long_long_const): Remove. (struct dw_val_struct): Change val_long_long type to rtx. (print_die, attr_checksum, same_dw_val_p, loc_descriptor): Adjust for val_long_long change to CONST_DOUBLE rtx from a long hi/lo pair. (output_die): Likewise. Use HOST_BITS_PER_WIDE_INT size of each component instead of HOST_BITS_PER_LONG. (output_loc_operands): Likewise. For const8* assert HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64. (output_loc_operands_raw): For const8* assert HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64. (add_AT_long_long): Remove val_hi and val_lo arguments, add val_const_double. (size_of_die): Use HOST_BITS_PER_WIDE_INT size multiplier instead of HOST_BITS_PER_LONG for dw_val_class_long_long. (add_const_value_attribute): Adjust add_AT_long_long caller. Don't handle TLS SYMBOL_REFs. If CONST wraps a constant, tail recurse. (dwarf_stack_op_name): Handle DW_OP_implicit_value and DW_OP_stack_value. (size_of_loc_descr, output_loc_operands, output_loc_operands_raw): Handle DW_OP_implicit_value. (extract_int): Move prototype earlier. (mem_loc_descriptor): For SUBREG punt if inner mode size is wider than DWARF2_ADDR_SIZE. Handle SIGN_EXTEND and ZERO_EXTEND by DW_OP_shl and DW_OP_shr{a,}. Handle EQ, NE, GT, GE, LT, LE, GTU, GEU, LTU, LEU, SMIN, SMAX, UMIN, UMAX, SIGN_EXTRACT, ZERO_EXTRACT. (loc_descriptor): Compare mode size with DWARF2_ADDR_SIZE instead of Pmode size. (loc_descriptor): Add MODE argument. Handle CONST_INT, CONST_DOUBLE, CONST_VECTOR, CONST, LABEL_REF and SYMBOL_REF if mode != VOIDmode, attempt to handle other expressions. Don't handle TLS SYMBOL_REFs. (concat_loc_descriptor, concatn_loc_descriptor, loc_descriptor_from_tree_1): Adjust loc_descriptor callers. (add_location_or_const_value_attribute): Likewise. For single location loc_lists attempt to use add_const_value_attribute for constant decls. Add DW_AT_const_value even if NOTE_VAR_LOCATION is VAR_LOCATION with CONSTANT_P or CONST_STRING in its expression. * cfgbuild.c (inside_basic_block_p): Handle debug insns. (control_flow_insn_p): Likewise. * tree-parloops.c (eliminate_local_variables_stmt): Handle debug stmt. (separate_decls_in_region_debug_bind): New. (separate_decls_in_region): Process debug bind stmts afterwards. * recog.c (verify_changes): Handle debug insns. (extract_insn): Likewise. (peephole2_optimize): Skip debug insns. * dse.c (scan_insn): Skip debug insns. * sel-sched-ir.c (return_nop_to_pool): Take full_tidying argument. Pass it on. (setup_id_for_insn): Handle debug insns. (maybe_tidy_empty_bb): Adjust whitespace. (tidy_control_flow): Skip debug insns. (sel_remove_insn): Adjust for debug insns. (sel_estimate_number_of_insns): Skip debug insns. (create_insn_rtx_from_pattern): Handle debug insns. (create_copy_of_insn_rtx): Likewise. * sel-sched-.h (sel_bb_end): Declare. (sel_bb_empty_or_nop_p): New. (get_all_loop_exits): Use it. (_eligible_successor_edge_p): Likewise. (return_nop_to_pool): Adjust. * tree-eh.c (tre_empty_eh_handler_p): Skip debug stmts. * ira-lives.c (process_bb_node_lives): Skip debug insns. * gimple-pretty-print.c (dump_gimple_debug): New. (dump_gimple_stmt): Use it. (dump_bb_header): Skip gimple debug stmts. * regmove.c (optimize_reg_copy_1): Discount debug insns. (fixup_match_2): Likewise. (regmove_backward_pass): Likewise. Simplify combined replacement. Handle debug insns. * function.c (instantiate_virtual_regs): Handle debug insns. * function.h (struct emit_status): Add x_cur_debug_insn_uid. * print-rtl.h: Include cselib.h. (print_rtx): Print VALUEs. Split out and recurse for VAR_LOCATIONs. * df.h (df_inns_rescan_debug_internal): Declare. * gcse.c (alloc_hash_table): Estimate n_insns. (cprop_insn): Don't regard debug insns as changes. (bypass_conditional_jumps): Skip debug insns. (one_pre_gcse_pass): Adjust. (one_code_hoisting_pass): Likewise. (compute_ld_motion_mems): Skip debug insns. (one_cprop_pass): Adjust. * tree-if-conv.c (tree_if_convert_stmt): Reset debug stmts. (if_convertible_stmt_p): Handle debug stmts. * init-regs.c (initialize_uninitialized_regs): Skip debug insns. * tree-vect-loop.c (vect_is_simple_reduction): Skip debug stmts. * ira-build.c (create_bb_allocnos): Skip debug insns. * tree-flow-inline.h (has_zero_uses): Discount debug stmts. (has_single_use): Likewise. (single_imm_use): Likewise. (num_imm_uses): Likewise. * tree-ssa-phiopt.c (empty_block_p): Skip debug stmts. * tree-ssa-coalesce.c (build_ssa_conflict_graph): Skip debug stmts. (create_outofssa_var_map): Likewise. * lower-subreg.c (adjust_decomposed_uses): New. (resolve_debug): New. (decompose_multiword_subregs): Use it. * tree-dfa.c (find_referenced_vars): Skip debug stmts. * emit-rtl.c: Include params.h. (cur_debug_insn_uid): Define. (set_new_first_and_last_insn): Set cur_debug_insn_uid too. (copy_rtx_if_shared_1): Handle debug insns. (reset_used_flags): Likewise. (set_used_flags): LIkewise. (get_max_insn_count): New. (next_nondebug_insn): New. (prev_nondebug_insn): New. (make_debug_insn_raw): New. (emit_insn_before_noloc): Handle debug insns. (emit_jump_insn_before_noloc): Likewise. (emit_call_insn_before_noloc): Likewise. (emit_debug_insn_before_noloc): New. (emit_insn_after_noloc): Handle debug insns. (emit_jump_insn_after_noloc): Likewise. (emit_call_insn_after_noloc): Likewise. (emit_debug_insn_after_noloc): Likewise. (emit_insn_after): Take loc from earlier non-debug insn. (emit_jump_insn_after): Likewise. (emit_call_insn_after): Likewise. (emit_debug_insn_after_setloc): New. (emit_debug_insn_after): New. (emit_insn_before): Take loc from later non-debug insn. (emit_jump_insn_before): Likewise. (emit_call_insn_before): Likewise. (emit_debug_insn_before_setloc): New. (emit_debug_insn_before): New. (emit_insn): Handle debug insns. (emit_debug_insn): New. (emit_jump_insn): Handle debug insns. (emit_call_insn): Likewise. (emit): Likewise. (init_emit): Take min-nondebug-insn-uid into account. Initialize cur_debug_insn_uid. (emit_copy_of_insn_after): Handle debug insns. * cfgexpand.c (gimple_assign_rhs_to_tree): Do not overwrite location of single rhs in place. (maybe_dump_rtl_for_gimple_stmt): Dump lineno. (floor_sdiv_adjust): New. (cell_sdiv_adjust): New. (cell_udiv_adjust): New. (round_sdiv_adjust): New. (round_udiv_adjust): New. (wrap_constant): Moved from cselib. (unwrap_constant): New. (expand_debug_expr): New. (expand_debug_locations): New. (expand_gimple_basic_block): Drop hiding redeclaration. Expand debug bind stmts. (gimple_expand_cfg): Expand debug locations. * cselib.c: Include tree-pass.h. (struct expand_value_data): New. (cselib_record_sets_hook): New. (PRESERVED_VALUE_P, LONG_TERM_PRESERVED_VALUE_P): New. (cselib_clear_table): Move, and implemnet in terms of... (cselib_reset_table_with_next_value): ... this. (cselib_get_next_unknown_value): New. (discard_useless_locs): Don't discard preserved values. (cselib_preserve_value): New. (cselib_preserved_value_p): New. (cselib_preserve_definitely): New. (cselib_clear_preserve): New. (cselib_preserve_only_values): New. (new_cselib_val): Take rtx argument. Dump it in details. (cselib_lookup_mem): Adjust. (expand_loc): Take regs_active in struct. Adjust. Silence dumps unless details are requested. (cselib_expand_value_rtx_cb): New. (cselib_expand_value_rtx): Rename and reimplment in terms of... (cselib_expand_value_rtx_1): ... this. Adjust. Silence dumps without details. Copy more subregs. Try to resolve values using a callback. Wrap constants. (cselib_subst_to_values): Adjust. (cselib_log_lookup): New. (cselib_lookup): Call it. (cselib_invalidate_regno): Don't count preserved values as useless. (cselib_invalidate_mem): Likewise. (cselib_record_set): Likewise. (struct set): Renamed to cselib_set, moved to cselib.h. (cselib_record_sets): Adjust. Call hook. (cselib_process_insn): Reset table when it would be cleared. (dump_cselib_val): New. (dump_cselib_table): New. * tree-cfgcleanup.c (tree_forwarded_block_p): Skip debug stmts. (remove_forwarder_block): Support moving debug stmts. * cselib.h (cselib_record_sets_hook): Declare. (cselib_expand_callback): New type. (cselib_expand_value_rtx_cb): Declare. (cselib_reset_table_with_next_value): Declare. (cselib_get_next_unknown_value): Declare. (cselib_preserve_value): Declare. (cselib_preserved_value_p): Declare. (cselib_preserve_only_values): Declare. (dump_cselib_table): Declare. * cfgcleanup.c (flow_find_cross_jump): Skip debug insns. (try_crossjump_to_edge): Likewise. (delete_unreachable_blocks): Remove dominant GIMPLE blocks after dominated blocks when debug stmts are present. * simplify-rtx.c (delegitimize_mem_from_attrs): New. * tree-ssa-live.c (remove_unused_locals): Skip debug stmts. (set_var_live_on_entry): Likewise. * loop-invariant.c (find_invariants_bb): Skip debug insns. * cfglayout.c (curr_location, last_location): Make static. (set_curr_insn_source_location): Don't avoid bouncing. (get_curr_insn_source_location): New. (get_curr_insn_block): New. (duplicate_insn_chain): Handle debug insns. * tree-ssa-forwprop.c (forward_propagate_addr_expr): Propagate into debug stmts. * common.opt (fcompare-debug): Move to sort order. (fdump-unnumbered-links): Likewise. (fvar-tracking-assignments): New. (fvar-tracking-assignments-toggle): New. * tree-ssa-dce.c (mark_stmt_necessary): Don't mark blocks because of debug stmts. (mark_stmt_if_obviously_necessary): Mark debug stmts. (eliminate_unnecessary_stmts): Walk dominated blocks before dominators. * tree-ssa-ter.c (find_replaceable_in_bb): Skip debug stmts. * ira.c (memref_used_between_p): Skip debug insns. (update_equiv_regs): Likewise. * sched-deps.c (sd_lists_size): Accept empty list. (sd_init_insn): Mark debug insns. (sd_finish_insn): Unmark them. (sd_add_dep): Reject non-debug deps on debug insns. (fixup_sched_groups): Give debug insns group treatment. Skip debug insns. (sched_analyze_reg): Don't mark debug insns for sched before call. (sched_analyze_2): Handle debug insns. (sched_analyze_insn): Compute next non-debug insn. Handle debug insns. (deps_analyze_insn): Handle debug insns. (deps_start_bb): Skip debug insns. (init_deps): Initialize last_debug_insn. * tree-ssa.c (target_for_debug_bind): New. (find_released_ssa_name): New. (propagate_var_def_into_debug_stmts): New. (propagate_defs_into_debug_stmts): New. (verify_ssa): Skip debug bind stmts without values. (warn_uninialized_vars): Skip debug stmts. * target-def.h (TARGET_DELEGITIMIZE_ADDRESS): Set default. * rtl.c (rtx_equal_p_cb): Handle VALUEs. (rtx_equal_p): Likewise. * ira-costs.c (scan_one_insn): Skip debug insns. (process_bb_node_for_hard_reg_moves): Likewise. * rtl.h (DEBUG_INSN_P): New. (NONDEBUG_INSN_P): New. (MAY_HAVE_DEBUG_INSNS): New. (INSN_P): Accept debug insns. (RTX_FRAME_RELATED_P): Likewise. (INSN_DELETED_P): Likewise (PAT_VAR_LOCATION_DECL): New. (PAT_VAR_LOCATION_LOC): New. (PAT_VAR_OCATION_STATUS): New. (NOTE_VAR_LOCATION_DECL): Reimplement. (NOTE_VAR_LOCATION_LOC): Likewise. (NOTE_VAR_LOCATION_STATUS): Likewise. (INSN_VAR_LOCATION): New. (INSN_VAR_LOCATION_DECL): New. (INSN_VAR_LOCATION_LOC): New. (INSN_VAR_LOCATION_STATUS): New. (gen_rtx_UNKNOWN_VAR_LOC): New. (VAR_LOC_UNKNOWN_P): New. (NOTE_DURING_CALL_P): New. (SCHED_GROUP_P): Accept debug insns. (emit_debug_insn_before): Declare. (emit_debug_insn_before_noloc): Declare. (emit_debug_insn_beore_setloc): Declare. (emit_debug_insn_after): Declare. (emit_debug_insn_after_noloc): Declare. (emit_debug_insn_after_setloc): Declare. (emit_debug_insn): Declare. (make_debug_insn_raw): Declare. (prev_nondebug_insn): Declare. (next_nondebug_insn): Declare. (delegitimize_mem_from_attrs): Declare. (get_max_insn_count): Declare. (wrap_constant): Declare. (unwrap_constant): Declare. (get_curr_insn_source_location): Declare. (get_curr_insn_block): Declare. * tree-inline.c (insert_debug_decl_map): New. (processing_debug_stmt): New. (remap_decl): Don't create new mappings in debug stmts. (remap_gimple_op_r): Don't add references in debug stmts. (copy_tree_body_r): Likewise. (remap_gimple_stmt): Handle debug bind stmts. (copy_bb): Skip debug stmts. (copy_edges_for_bb): Likewise. (copy_debug_stmt): New. (copy_debug_stmts): New. (copy_body): Copy debug stmts at the end. (insert_init_debug_bind): New. (insert_init_stmt): Take id. Skip and emit debug stmts. (setup_one_parameter): Remap variable earlier, register debug mapping. (estimate_num_insns): Skip debug stmts. (expand_call_inline): Preserve debug_map. (optimize_inline_calls): Check for no debug_stmts left-overs. (unsave_expr_now): Preserve debug_map. (copy_gimple_seq_and_replace_locals): Likewise. (tree_function_versioning): Check for no debug_stmts left-overs. Init and destroy debug_map as needed. Split edges unconditionally. (build_duplicate_type): Init and destroy debug_map as needed. * tree-inline.h: Include gimple.h instead of pointer-set.h. (struct copy_body_data): Add debug_stmts and debug_map. * sched-int.h (struct ready_list): Add n_debug. (struct deps): Add last_debug_insn. (DEBUG_INSN_SCHED_P): New. (BOUNDARY_DEBUG_INSN_P): New. (SCHEDULE_DEBUG_INSN_P): New. (sd_iterator_cond): Accept empty list. * combine.c (create_log_links): Skip debug insns. (combine_instructions): Likewise. (cleanup_auto_inc_dec): New. From Jakub Jelinek: Make sure the return value is always unshared. (struct rtx_subst_pair): New. (auto_adjust_pair): New. (propagate_for_debug_subst): New. (propagate_for_debug): New. (try_combine): Skip debug insns. Propagate removed defs into debug insns. (next_nonnote_nondebug_insn): New. (distribute_notes): Use it. Skip debug insns. (distribute_links): Skip debug insns. * tree-outof-ssa.c (set_location_for_edge): Likewise. * resource.c (mark_target_live_regs): Likewise. * var-tracking.c: Include cselib.h and target.h. (enum micro_operation_type): Add MO_VAL_USE, MO_VAL_LOC, and MO_VAL_SET. (micro_operation_type_name): New. (enum emit_note_where): Add EMIT_NOTE_AFTER_CALL_INSN. (struct micro_operation_def): Update comments. (decl_or_value): New type. Use instead of decls. (struct emit_note_data_def): Add vars. (struct attrs_def): Use decl_or_value. (struct variable_tracking_info_def): Add permp, flooded. (struct location_chain_def): Update comment. (struct variable_part_def): Use decl_or_value. (struct variable_def): Make var_part a variable length array. (valvar_pool): New. (scratch_regs): New. (cselib_hook_called): New. (dv_is_decl_p): New. (dv_is_value_p): New. (dv_as_decl): New. (dv_as_value): New. (dv_as_opaque): New. (dv_onepart_p): New. (dv_pool): New. (IS_DECL_CODE): New. (check_value_is_not_decl): New. (dv_from_decl): New. (dv_from_value): New. (dv_htab_hash): New. (variable_htab_hash): Use it. (variable_htab_eq): Support values. (variable_htab_free): Free from the right pool. (attrs_list_member, attrs_list_insert): Use decl_or_value. (attrs_list_union): Adjust. (attrs_list_mpdv_union): New. (tie_break_pointers): New. (canon_value_cmp): New. (unshare_variable): Return possibly-modified slot. (vars_copy_1): Adjust. (var_reg_decl_set): Adjust. Split out of... (var_reg_set): ... this. (get_init_value): Adjust. (var_reg_delete_and_set): Adjust. (var_reg_delete): Adjust. (var_regno_delete): Adjust. (var_mem_decl_set): Split out of... (var_mem_set): ... this. (var_mem_delete_and_set): Adjust. (var_mem_delete): Adjust. (val_store): New. (val_reset): New. (val_resolve): New. (variable_union): Adjust. Speed up merge of 1-part vars. (variable_canonicalize): Use unshared slot. (VALUED_RECURSED_INTO): New. (find_loc_in_1pdv): New. (struct dfset_merge): New. (insert_into_intersection): New. (intersect_loc_chains): New. (loc_cmp): New. (canonicalize_loc_order_check): New. (canonicalize_values_mark): New. (canonicalize_values_star): New. (variable_merge_over_cur): New. (variable_merge_over_src): New. (dataflow_set_merge): New. (dataflow_set_equiv_regs): New. (remove_duplicate_values): New. (struct dfset_post_merge): New. (variable_post_merge_new_vals): New. (variable_post_merge_perm_vals): New. (dataflow_post_merge_adjust): New. (find_mem_expr_in_1pdv): New. (dataflow_set_preserve_mem_locs): New. (dataflow_set_remove_mem_locs): New. (dataflow_set_clear_at_call): New. (onepart_variable_different_p): New. (variable_different_p): Use it. (dataflow_set_different_1): Adjust. Make detailed dump more verbose. (track_expr_p): Add need_rtl parameter. Don't generate rtl if not needed. (track_loc_p): Pass it true. (struct count_use_info): New. (find_use_val): New. (replace_expr_with_values): New. (log_op_type): New. (use_type): New, partially split out of... (count_uses): ... this. Count new micro-ops. (count_uses_1): Adjust. (count_stores): Adjust. (count_with_sets): New. (VAL_NEEDS_RESOLUTION): New. (VAL_HOLDS_TRACK_EXPR): New. (VAL_EXPR_IS_COPIED): New. (VAL_EXPR_IS_CLOBBERED): New. (add_uses): Adjust. Generate new micro-ops. (add_uses_1): Adjust. (add_stores): Generate new micro-ops. (add_with_sets): New. (find_src_status): Adjust. (find_src_set_src): Adjust. (compute_bb_dataflow): Use dataflow_set_clear_at_call. Handle new micro-ops. Canonicalize value equivalances. (vt_find_locations): Compute total size of hash tables for dumping. Perform merge for var-tracking-assignments. Don't disregard single-block loops. (dump_attrs_list): Handle decl_or_value. (dump_variable): Take variable. Deal with decl_or_value. (dump_variable_slot): New. (dump_vars): Use it. (dump_dataflow_sets): Adjust. (set_slot_part): New, extended to support one-part variables after splitting out of... (set_variable_part): ... this. (clobber_slot_part): New, split out of... (clobber_variable_part): ... this. (delete_slot_part): New, split out of... (delete_variable_part): .... this. (check_wrap_constant): New. (vt_expand_loc_callback): New. (vt_expand_loc): New. (emit_note_insn_var_location): Adjust. Handle values. Handle EMIT_NOTE_AFTER_CALL_INSN. (emit_notes_for_differences_1): Adjust. Handle values. (emit_notes_for_differences_2): Likewise. (emit_notes_for_differences): Adjust. (emit_notes_in_bb): Take pointer to set. Emit AFTER_CALL_INSN notes. Adjust. Handle new micro-ops. (vt_add_function_parameters): Adjust. Create and bind values. (vt_initialize): Adjust. Initialize scratch_regs and valvar_pool, flooded and perm.. Initialize and use cselib. Log operations. Move some code to count_with_sets and add_with_sets. (delete_debug_insns): New. (vt_debug_insns_local): New. (vt_finalize): Release permp, valvar_pool, scratch_regs. Finish cselib. (var_tracking_main): If var-tracking-assignments is enabled but var-tracking isn't, delete debug insns and leave. Likewise if we exceed limits or fail the stack adjustments tests, and after all var-tracking processing. More in var-tracking, from Jakub Jelinek <jakub@redhat.com>: (dataflow_set): Add traversed_vars. (value_chain, const_value_chain): New typedefs. (value_chain_pool, value_chains): New variables. (value_chain_htab_hash, value_chain_htab_eq, add_value_chain, add_value_chains, add_cselib_value_chains, remove_value_chain, remove_value_chains, remove_cselib_value_chains): New functions. (shared_hash_find_slot_unshare_1, shared_hash_find_slot_1, shared_hash_find_slot_noinsert_1, shared_hash_find_1): New static inlines. (shared_hash_find_slot_unshare, shared_hash_find_slot, shared_hash_find_slot_noinsert, shared_hash_find): Update. (dst_can_be_shared): New variable. (unshare_variable): Unshare set->vars if shared, use shared_hash_*. Clear dst_can_be_shared. If set->traversed_vars is non-NULL and different from set->vars, look up slot again instead of using the passed in slot. (dataflow_set_init): Initialize traversed_vars. (variable_union): Use shared_hash_*. Use initially NO_INSERT lookup if set->vars is shared. Don't keep slot cleared before calling unshare_variable. Unshare set->vars if needed. Adjust unshare_variable callers. Clear dst_can_be_shared if needed. Even ->refcount == 1 vars must be unshared if set->vars is shared and var needs to be modified. (dataflow_set_union): Set traversed_vars during canonicalization. (VALUE_CHANGED, DECL_CHANGED): Define. (set_dv_changed, dv_changed_p): New static inlines. (track_expr_p): Clear DECL_CHANGED. (dump_dataflow_sets): Set it. (variable_was_changed): Call set_dv_changed. (emit_note_insn_var_location): Likewise. (changed_variables_stack): New variable. (check_changed_vars_1, check_changed_vars_2): New functions. (emit_notes_for_changes): Do nothing if changed_variables is empty. Traverse changed_variables with check_changed_vars_1, call check_changed_vars_2 on each changed_variables_stack entry. (emit_notes_in_bb): Add SET argument. Just clear it at the beginning, use it instead of local &set, don't destroy it at the end. (vt_emit_notes): Call dataflow_set_clear early on all VTI(bb)->out sets, never use them, instead use emit_notes_in_bb computed set, dataflow_set_clear also VTI(bb)->in when we are done with the basic block. Initialize changed_variables_stack, free it afterwards. If ENABLE_CHECKING verify that after noting differences to an empty set value_chains hash table is empty. (vt_initialize): Initialize value_chains and value_chain_pool. (vt_finalize): Delete value_chains htab, free value_chain_pool. (variable_tracking_main): Call dump_dataflow_sets before calling vt_emit_notes, not after it. * tree-flow.h (propagate_defs_into_debug_stmts): Declare. (propagate_var_def_into_debug_stmts): Declare. * df-problems.c (df_lr_bb_local_compute): Skip debug insns. (df_set_note): Reject debug insns. (df_whole_mw_reg_dead_p): Take added_notes_p argument. Don't add notes to debug insns. (df_note_bb_compute): Adjust. Likewise. (df_simulate_uses): Skip debug insns. (df_simulate_initialize_backwards): Likewise. * reg-stack.c (subst_stack_regs_in_debug_insn): New. (subst_stack_regs_pat): Reject debug insns. (convert_regs_1): Handle debug insns. * Makefile.in (TREE_INLINE_H): Take pointer-set.h from GIMPLE_H. (print-rtl.o): Depend on cselib.h. (cselib.o): Depend on TREE_PASS_H. (var-tracking.o): Depend on cselib.h and TARGET_H. * sched-rgn.c (rgn_estimate_number_of_insns): Discount debug insns. (init_ready_list): Skip boundary debug insns. (add_branch_dependences): Skip debug insns. (free_block_dependencies): Check for blocks with only debug insns. (compute_priorities): Likewise. * gimple.c (gss_for_code): Handle GIMPLE_DEBUG. (gimple_build_with_ops_stat): Take subcode as unsigned. Adjust all callers. (gimple_build_debug_bind_stat): New. (empty_body_p): Skip debug stmts. (gimple_has_side_effects): Likewise. (gimple_rhs_has_side_effects): Likewise. * gimple.h (enum gimple_debug_subcode, GIMPLE_DEBUG_BIND): New. (gimple_build_debug_bind_stat): Declare. (gimple_build_debug_bind): Define. (is_gimple_debug): New. (gimple_debug_bind_p): New. (gimple_debug_bind_get_var): New. (gimple_debug_bind_get_value): New. (gimple_debug_bind_get_value_ptr): New. (gimple_debug_bind_set_var): New. (gimple_debug_bind_set_value): New. (GIMPLE_DEBUG_BIND_NOVALUE): New internal temporary macro. (gimple_debug_bind_reset_value): New. (gimple_debug_bind_has_value_p): New. (gsi_next_nondebug): New. (gsi_prev_nondebug): New. (gsi_start_nondebug_bb): New. (gsi_last_nondebug_bb): New. * sched-vis.c (print_pattern): Handle VAR_LOCATION. (print_insn): Handle DEBUG_INSN. * tree-cfg.c (remove_bb): Walk stmts backwards. Let loc of first insn prevail. (first_stmt): Skip debug stmts. (first_non_label_stmt): Likewise. (last_stmt): Likewise. (has_zero_uses_1): New. (single_imm_use_1): New. (verify_gimple_debug): New. (verify_types_in_gimple_stmt): Handle debug stmts. (verify_stmt): Likewise. (debug_loop_num): Skip debug stmts. (remove_edge_and_dominated_blocks): Remove dominators last. * tree-ssa-reasssoc.c (rewrite_expr_tree): Propagate into debug stmts. (linearize_expr): Likewise. * config/i386/i386.c (ix86_delegitimize_address): Call default implementation. * config/ia64/ia64.c (ia64_safe_itanium_class): Handle debug insns. (group_barrier_needed): Skip debug insns. (emit_insn_group_barriers): Likewise. (emit_all_insn_group_barriers): Likewise. (ia64_variable_issue): Handle debug insns. (ia64_dfa_new_cycle): Likewise. (final_emit_insn_group_barriers): Skip debug insns. (ia64_dwarf2out_def_steady_cfa): Take frame argument. Don't def cfa without frame. (process_set): Likewise. (process_for_unwind_directive): Pass frame on. * config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Define. (rs6000_delegitimize_address): New. (rs6000_debug_adjust_cost): Handle debug insns. (is_microcoded_insn): Likewise. (is_cracked_insn): Likewise. (is_nonpipeline_insn): Likewise. (insn_must_be_first_in_group): Likewise. (insn_must_be_last_in_group): Likewise. (force_new_group): Likewise. * cfgrtl.c (rtl_split_block): Emit INSN_DELETED note if block contains only debug insns. (rtl_merge_blocks): Skip debug insns. (purge_dead_edges): Likewise. (rtl_block_ends_with_call_p): Skip debug insns. * dce.c (deletable_insn_p): Handle VAR_LOCATION. (mark_reg_dependencies): Skip debug insns. * params.def (PARAM_MIN_NONDEBUG_INSN_UID): New. * tree-ssanames.c (release_ssa_name): Propagate def into debug stmts. * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts): Skip debug stmts. * regcprop.c (replace_oldest_value_addr): Skip debug insns. (replace_oldest_value_mem): Use ALL_REGS for debug insns. (copyprop_hardreg_forward_1): Handle debug insns. * reload1.c (reload): Skip debug insns. Replace unassigned pseudos in debug insns with their equivalences. (eliminate_regs_in_insn): Skip debug insns. (emit_input_reload_insns): Skip debug insns at first, adjust them later. * tree-ssa-operands.c (add_virtual_operand): Reject debug stmts. (get_indirect_ref_operands): Pass opf_no_vops on. (get_expr_operands): Likewise. Skip debug stmts. (parse_ssa_operands): Scan debug insns with opf_no_vops. gcc/testsuite/ChangeLog: * gcc.dg/guality/guality.c: New. * gcc.dg/guality/guality.h: New. * gcc.dg/guality/guality.exp: New. * gcc.dg/guality/example.c: New. * lib/gcc-dg.exp (cleanup-dump): Remove .gk files. (cleanup-saved-temps): Likewise, .gkd files too. gcc/cp/ChangeLog: * cp-tree.h (TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS): New. * cp-lang.c (cxx_dwarf_name): Pass it. * error.c (count_non_default_template_args): Take flags as argument. Adjust all callers. Skip counting of default arguments if the new flag is given. ChangeLog: * Makefile.tpl (BUILD_CONFIG): Default to bootstrap-debug. * Makefile.in: Rebuilt. contrib/ChangeLog: * compare-debug: Look for .gkd files and compare them. config/ChangeLog: * bootstrap-debug.mk: Add comments. * bootstrap-debug-big.mk: New. * bootstrap-debug-lean.mk: New. * bootstrap-debug-ckovw.mk: Add comments. * bootstrap-debug-lib.mk: Drop CFLAGS for stages. Use -g0 for TFLAGS in stage1. Drop -fvar-tracking-assignments-toggle. From-SVN: r151312
2009-09-02 04:42:21 +02:00
want to expand templates at this point, for this may generate
new decls, which gets decl counts out of sync, which may in
turn cause codegen differences between compilations with and
without -g. */
(flags & TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS) != 0
invoke.texi (-fvar-tracking-assignments): New. gcc/ChangeLog: * doc/invoke.texi (-fvar-tracking-assignments): New. (-fvar-tracking-assignments-toggle): New. (-fdump-final-insns=file): Mark filename as optional. (--param min-nondebug-insn-uid): New. (-gdwarf-@{version}): Mention version 4. * opts.c (common_handle_option): Accept it. * tree-vrp.c (find_assert_locations_1): Skip debug stmts. * regrename.c (regrename_optimize): Drop last. Don't count debug insns as uses. Don't reject change because of debug insn. (do_replace): Reject DEBUG_INSN as chain starter. Take base_regno from the chain starter, and check for inexact matches in DEBUG_INSNS. (scan_rtx_reg): Accept inexact matches in DEBUG_INSNs. (build_def_use): Simplify and fix the marking of DEBUG_INSNs. * sched-ebb.c (schedule_ebbs): Skip boundary debug insns. * fwprop.c (forward_propagate_and_simplify): ...into debug insns. * doc/gimple.texi (is_gimple_debug): New. (gimple_debug_bind_p): New. (is_gimple_call, gimple_assign_cast_p): End sentence with period. * doc/install.texi (bootstrap-debug): More details. (bootstrap-debug-big, bootstrap-debug-lean): Document. (bootstrap-debug-lib): More details. (bootstrap-debug-ckovw): Update. (bootstrap-time): New. * tree-into-ssa.c (mark_def_sites): Skip debug stmts. (insert_phi_nodes_for): Insert debug stmts. (rewrite_stmt): Take iterator. Insert debug stmts. (rewrite_enter_block): Adjust. (maybe_replace_use_in_debug_stmt): New. (rewrite_update_stmt): Use it. (mark_use_interesting): Return early for debug stmts. * tree-ssa-loop-im.c (rewrite_bittest): Propagate DEFs into debug stmts before replacing stmt. (move_computations_stmt): Likewise. * ira-conflicts.c (add_copies): Skip debug insns. * regstat.c (regstat_init_n_sets_and_refs): Discount debug insns. (regstat_bb_compute_ri): Skip debug insns. * tree-ssa-threadupdate.c (redirection_block_p): Skip debug stmts. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt, check_loop_closed_ssa_stmt): Skip debug stmts. * tree-tailcall.c (find_tail_calls): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise. * tree.h (MAY_HAVE_DEBUG_STMTS): New. (build_var_debug_value_stat): Declare. (build_var_debug_value): Define. (target_for_debug_bind): Declare. * reload.c (find_equiv_reg): Skip debug insns. * rtlanal.c (reg_used_between_p): Skip debug insns. (side_effects_p): Likewise. (canonicalize_condition): Likewise. * ddg.c (create_ddg_dep_from_intra_loop_link): Check that non-debug insns never depend on debug insns. (create_ddg_dep_no_link): Likewise. (add_cross_iteration_register_deps): Use ANTI_DEP for debug insns. Don't add inter-loop dependencies for debug insns. (build_intra_loop_deps): Likewise. (create_ddg): Count debug insns. * ddg.h (struct ddg::num_debug): New. (num_backargs): Pair up with previous int field. * diagnostic.c (diagnostic_report_diagnostic): Skip notes on -fcompare-debug-second. * final.c (get_attr_length_1): Skip debug insns. (rest_of_clean-state): Don't dump CFA_RESTORE_STATE. * gcc.c (invoke_as): Call compare-debug-dump-opt. (driver_self_specs): Map -fdump-final-insns to -fdump-final-insns=.. (get_local_tick): New. (compare_debug_dump_opt_spec_function): Test for . argument and compute output name. Compute temp output spec without flag name. Compute -frandom-seed. (OPT): Undef after use. * cfgloopanal.c (num_loop_insns): Skip debug insns. (average_num_loop_insns): Likewise. * params.h (MIN_NONDEBUG_INSN_UID): New. * gimple.def (GIMPLE_DEBUG): New. * ipa-reference.c (scan_stmt_for_static_refs): Skip debug stmts. * auto-inc-dec.c (merge_in_block): Skip debug insns. (merge_in_block): Fix whitespace. * toplev.c (flag_var_tracking): Update comment. (flag_var_tracking_assignments): New. (flag_var_tracking_assignments_toggle): New. (process_options): Don't open final insns dump file if we're not going to write to it. Compute defaults for var_tracking. * df-scan.c (df_insn_rescan_debug_internal): New. (df_uses_record): Handle debug insns. * haifa-sched.c (ready): Initialize n_debug. (contributes_to_priority): Skip debug insns. (dep_list_size): New. (priority): Use it. (rank_for_schedule): Likewise. Schedule debug insns as soon as they're ready. Disregard previous debug insns to make decisions. (queue_insn): Never queue debug insns. (ready_add, ready_remove_first, ready_remove): Count debug insns. (schedule_insn): Don't reject debug insns because of issue rate. (get_ebb_head_tail, no_real_insns_p): Skip boundary debug insns. (queue_to_ready): Skip and discount debug insns. (choose_ready): Let debug insns through. (schedule_block): Check boundary debug insns. Discount debug insns, schedule them early. Adjust whitespace. (set_priorities): Check for boundary debug insns. (add_jump_dependencies): Use dep_list_size. (prev_non_location_insn): New. (check_cfg): Use it. * tree-ssa-loop-ivopts.c (find-interesting_users): Skip debug stmts. (remove_unused_ivs): Reset debug stmts. * modulo-sched.c (const_iteration_count): Skip debug insns. (res_MII): Discount debug insns. (loop_single_full_bb_p): Skip debug insns. (sms_schedule): Likewise. (sms_schedule_by_order): Likewise. (ps_has_conflicts): Likewise. * caller-save.c (refmarker_fn): New. (save_call_clobbered_regs): Replace regs with saved mem in debug insns. (mark_referenced_regs): Take pointer, mark and arg. Adjust. Call refmarker_fn mark for hardregnos. (mark_reg_as_referenced): New. (replace_reg_with_saved_mem): New. * ipa-pure-const.c (check_stmt): Skip debug stmts. * cse.c (cse_insn): Canonicalize debug insns. Skip them when searching back. (cse_extended_basic_block): Skip debug insns. (count_reg_usage): Likewise. (is_dead_reg): New, split out of... (set_live_p): ... here. (insn_live_p): Use it for debug insns. * tree-stdarg.c (check_all_va_list_escapes): Skip debug stmts. (execute_optimize_stdarg): Likewise. * tree-ssa-dom.c (propagate_rhs_into_lhs): Likewise. * tree-ssa-propagate.c (substitute_and_fold): Don't regard changes in debug stmts as changes. * sel-sched.c (moving_insn_creates_bookkeeping_block_p): New. (moveup_expr): Don't move across debug insns. Don't move debug insn if it would create a bookkeeping block. (moveup_expr_cached): Don't use cache for debug insns that are heads of blocks. (compute_av_set_inside_bb): Skip debug insns. (sel_rank_for_schedule): Schedule debug insns first. Remove dead code. (block_valid_for_bookkeeping_p); Support lax searches. (create_block_for_bookkeeping): Adjust block numbers when encountering debug-only blocks. (find_place_for_bookkeeping): Deal with debug-only blocks. (generate_bookkeeping_insn): Accept no place to insert. (remove_temp_moveop_nops): New argument full_tidying. (prepare_place_to_insert): Deal with debug insns. (advance_state_on_fence): Debug insns don't start cycles. (update_boundaries): Take fence as argument. Deal with debug insns. (schedule_expr_on_boundary): No full_tidying on debug insns. (fill_insns): Deal with debug insns. (track_scheduled_insns_and_blocks): Don't count debug insns. (need_nop_to_preserve_insn_bb): New, split out of... (remove_insn_from_stream): ... this. (fur_orig_expr_not_found): Skip debug insns. * rtl.def (VALUE): Move up. (DEBUG_INSN): New. * tree-ssa-sink.c (all_immediate_uses_same_place): Skip debug stmts. (nearest_common_dominator_of_uses): Take debug_stmts argument. Set it if debug stmts are found. (statement_sink_location): Skip debug stmts. Propagate moving defs into debug stmts. * ifcvt.c (first_active_insn): Skip debug insns. (last_active_insns): Likewise. (cond_exec_process_insns): Likewise. (noce_process_if_block): Likewise. (check_cond_move_block): Likewise. (cond_move_convert_if_block): Likewise. (block_jumps_and_fallthru_p): Likewise. (dead_or_predicable): Likewise. * dwarf2out.c (debug_str_hash_forced): New. (find_AT_string): Add comment. (gen_label_for_indirect_string): New. (get_debug_string_label): New. (AT_string_form): Use it. (mem_loc_descriptor): Handle non-TLS symbols. Handle MINUS , DIV, MOD, AND, IOR, XOR, NOT, ABS, NEG, and CONST_STRING. Accept but discard COMPARE, IF_THEN_ELSE, ROTATE, ROTATERT, TRUNCATE and several operations that cannot be represented with DWARF opcodes. (loc_descriptor): Ignore SIGN_EXTEND and ZERO_EXTEND. Require dwarf_version 4 for DW_OP_implicit_value and DW_OP_stack_value. (dwarf2out_var_location): Take during-call mark into account. (output_indirect_string): Update comment. Output if there are label and references. (prune_indirect_string): New. (prune_unused_types): Call it if debug_str_hash_forced. More in dwarf2out.c, from Jakub Jelinek <jakub@redhat.com>: (dw_long_long_const): Remove. (struct dw_val_struct): Change val_long_long type to rtx. (print_die, attr_checksum, same_dw_val_p, loc_descriptor): Adjust for val_long_long change to CONST_DOUBLE rtx from a long hi/lo pair. (output_die): Likewise. Use HOST_BITS_PER_WIDE_INT size of each component instead of HOST_BITS_PER_LONG. (output_loc_operands): Likewise. For const8* assert HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64. (output_loc_operands_raw): For const8* assert HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64. (add_AT_long_long): Remove val_hi and val_lo arguments, add val_const_double. (size_of_die): Use HOST_BITS_PER_WIDE_INT size multiplier instead of HOST_BITS_PER_LONG for dw_val_class_long_long. (add_const_value_attribute): Adjust add_AT_long_long caller. Don't handle TLS SYMBOL_REFs. If CONST wraps a constant, tail recurse. (dwarf_stack_op_name): Handle DW_OP_implicit_value and DW_OP_stack_value. (size_of_loc_descr, output_loc_operands, output_loc_operands_raw): Handle DW_OP_implicit_value. (extract_int): Move prototype earlier. (mem_loc_descriptor): For SUBREG punt if inner mode size is wider than DWARF2_ADDR_SIZE. Handle SIGN_EXTEND and ZERO_EXTEND by DW_OP_shl and DW_OP_shr{a,}. Handle EQ, NE, GT, GE, LT, LE, GTU, GEU, LTU, LEU, SMIN, SMAX, UMIN, UMAX, SIGN_EXTRACT, ZERO_EXTRACT. (loc_descriptor): Compare mode size with DWARF2_ADDR_SIZE instead of Pmode size. (loc_descriptor): Add MODE argument. Handle CONST_INT, CONST_DOUBLE, CONST_VECTOR, CONST, LABEL_REF and SYMBOL_REF if mode != VOIDmode, attempt to handle other expressions. Don't handle TLS SYMBOL_REFs. (concat_loc_descriptor, concatn_loc_descriptor, loc_descriptor_from_tree_1): Adjust loc_descriptor callers. (add_location_or_const_value_attribute): Likewise. For single location loc_lists attempt to use add_const_value_attribute for constant decls. Add DW_AT_const_value even if NOTE_VAR_LOCATION is VAR_LOCATION with CONSTANT_P or CONST_STRING in its expression. * cfgbuild.c (inside_basic_block_p): Handle debug insns. (control_flow_insn_p): Likewise. * tree-parloops.c (eliminate_local_variables_stmt): Handle debug stmt. (separate_decls_in_region_debug_bind): New. (separate_decls_in_region): Process debug bind stmts afterwards. * recog.c (verify_changes): Handle debug insns. (extract_insn): Likewise. (peephole2_optimize): Skip debug insns. * dse.c (scan_insn): Skip debug insns. * sel-sched-ir.c (return_nop_to_pool): Take full_tidying argument. Pass it on. (setup_id_for_insn): Handle debug insns. (maybe_tidy_empty_bb): Adjust whitespace. (tidy_control_flow): Skip debug insns. (sel_remove_insn): Adjust for debug insns. (sel_estimate_number_of_insns): Skip debug insns. (create_insn_rtx_from_pattern): Handle debug insns. (create_copy_of_insn_rtx): Likewise. * sel-sched-.h (sel_bb_end): Declare. (sel_bb_empty_or_nop_p): New. (get_all_loop_exits): Use it. (_eligible_successor_edge_p): Likewise. (return_nop_to_pool): Adjust. * tree-eh.c (tre_empty_eh_handler_p): Skip debug stmts. * ira-lives.c (process_bb_node_lives): Skip debug insns. * gimple-pretty-print.c (dump_gimple_debug): New. (dump_gimple_stmt): Use it. (dump_bb_header): Skip gimple debug stmts. * regmove.c (optimize_reg_copy_1): Discount debug insns. (fixup_match_2): Likewise. (regmove_backward_pass): Likewise. Simplify combined replacement. Handle debug insns. * function.c (instantiate_virtual_regs): Handle debug insns. * function.h (struct emit_status): Add x_cur_debug_insn_uid. * print-rtl.h: Include cselib.h. (print_rtx): Print VALUEs. Split out and recurse for VAR_LOCATIONs. * df.h (df_inns_rescan_debug_internal): Declare. * gcse.c (alloc_hash_table): Estimate n_insns. (cprop_insn): Don't regard debug insns as changes. (bypass_conditional_jumps): Skip debug insns. (one_pre_gcse_pass): Adjust. (one_code_hoisting_pass): Likewise. (compute_ld_motion_mems): Skip debug insns. (one_cprop_pass): Adjust. * tree-if-conv.c (tree_if_convert_stmt): Reset debug stmts. (if_convertible_stmt_p): Handle debug stmts. * init-regs.c (initialize_uninitialized_regs): Skip debug insns. * tree-vect-loop.c (vect_is_simple_reduction): Skip debug stmts. * ira-build.c (create_bb_allocnos): Skip debug insns. * tree-flow-inline.h (has_zero_uses): Discount debug stmts. (has_single_use): Likewise. (single_imm_use): Likewise. (num_imm_uses): Likewise. * tree-ssa-phiopt.c (empty_block_p): Skip debug stmts. * tree-ssa-coalesce.c (build_ssa_conflict_graph): Skip debug stmts. (create_outofssa_var_map): Likewise. * lower-subreg.c (adjust_decomposed_uses): New. (resolve_debug): New. (decompose_multiword_subregs): Use it. * tree-dfa.c (find_referenced_vars): Skip debug stmts. * emit-rtl.c: Include params.h. (cur_debug_insn_uid): Define. (set_new_first_and_last_insn): Set cur_debug_insn_uid too. (copy_rtx_if_shared_1): Handle debug insns. (reset_used_flags): Likewise. (set_used_flags): LIkewise. (get_max_insn_count): New. (next_nondebug_insn): New. (prev_nondebug_insn): New. (make_debug_insn_raw): New. (emit_insn_before_noloc): Handle debug insns. (emit_jump_insn_before_noloc): Likewise. (emit_call_insn_before_noloc): Likewise. (emit_debug_insn_before_noloc): New. (emit_insn_after_noloc): Handle debug insns. (emit_jump_insn_after_noloc): Likewise. (emit_call_insn_after_noloc): Likewise. (emit_debug_insn_after_noloc): Likewise. (emit_insn_after): Take loc from earlier non-debug insn. (emit_jump_insn_after): Likewise. (emit_call_insn_after): Likewise. (emit_debug_insn_after_setloc): New. (emit_debug_insn_after): New. (emit_insn_before): Take loc from later non-debug insn. (emit_jump_insn_before): Likewise. (emit_call_insn_before): Likewise. (emit_debug_insn_before_setloc): New. (emit_debug_insn_before): New. (emit_insn): Handle debug insns. (emit_debug_insn): New. (emit_jump_insn): Handle debug insns. (emit_call_insn): Likewise. (emit): Likewise. (init_emit): Take min-nondebug-insn-uid into account. Initialize cur_debug_insn_uid. (emit_copy_of_insn_after): Handle debug insns. * cfgexpand.c (gimple_assign_rhs_to_tree): Do not overwrite location of single rhs in place. (maybe_dump_rtl_for_gimple_stmt): Dump lineno. (floor_sdiv_adjust): New. (cell_sdiv_adjust): New. (cell_udiv_adjust): New. (round_sdiv_adjust): New. (round_udiv_adjust): New. (wrap_constant): Moved from cselib. (unwrap_constant): New. (expand_debug_expr): New. (expand_debug_locations): New. (expand_gimple_basic_block): Drop hiding redeclaration. Expand debug bind stmts. (gimple_expand_cfg): Expand debug locations. * cselib.c: Include tree-pass.h. (struct expand_value_data): New. (cselib_record_sets_hook): New. (PRESERVED_VALUE_P, LONG_TERM_PRESERVED_VALUE_P): New. (cselib_clear_table): Move, and implemnet in terms of... (cselib_reset_table_with_next_value): ... this. (cselib_get_next_unknown_value): New. (discard_useless_locs): Don't discard preserved values. (cselib_preserve_value): New. (cselib_preserved_value_p): New. (cselib_preserve_definitely): New. (cselib_clear_preserve): New. (cselib_preserve_only_values): New. (new_cselib_val): Take rtx argument. Dump it in details. (cselib_lookup_mem): Adjust. (expand_loc): Take regs_active in struct. Adjust. Silence dumps unless details are requested. (cselib_expand_value_rtx_cb): New. (cselib_expand_value_rtx): Rename and reimplment in terms of... (cselib_expand_value_rtx_1): ... this. Adjust. Silence dumps without details. Copy more subregs. Try to resolve values using a callback. Wrap constants. (cselib_subst_to_values): Adjust. (cselib_log_lookup): New. (cselib_lookup): Call it. (cselib_invalidate_regno): Don't count preserved values as useless. (cselib_invalidate_mem): Likewise. (cselib_record_set): Likewise. (struct set): Renamed to cselib_set, moved to cselib.h. (cselib_record_sets): Adjust. Call hook. (cselib_process_insn): Reset table when it would be cleared. (dump_cselib_val): New. (dump_cselib_table): New. * tree-cfgcleanup.c (tree_forwarded_block_p): Skip debug stmts. (remove_forwarder_block): Support moving debug stmts. * cselib.h (cselib_record_sets_hook): Declare. (cselib_expand_callback): New type. (cselib_expand_value_rtx_cb): Declare. (cselib_reset_table_with_next_value): Declare. (cselib_get_next_unknown_value): Declare. (cselib_preserve_value): Declare. (cselib_preserved_value_p): Declare. (cselib_preserve_only_values): Declare. (dump_cselib_table): Declare. * cfgcleanup.c (flow_find_cross_jump): Skip debug insns. (try_crossjump_to_edge): Likewise. (delete_unreachable_blocks): Remove dominant GIMPLE blocks after dominated blocks when debug stmts are present. * simplify-rtx.c (delegitimize_mem_from_attrs): New. * tree-ssa-live.c (remove_unused_locals): Skip debug stmts. (set_var_live_on_entry): Likewise. * loop-invariant.c (find_invariants_bb): Skip debug insns. * cfglayout.c (curr_location, last_location): Make static. (set_curr_insn_source_location): Don't avoid bouncing. (get_curr_insn_source_location): New. (get_curr_insn_block): New. (duplicate_insn_chain): Handle debug insns. * tree-ssa-forwprop.c (forward_propagate_addr_expr): Propagate into debug stmts. * common.opt (fcompare-debug): Move to sort order. (fdump-unnumbered-links): Likewise. (fvar-tracking-assignments): New. (fvar-tracking-assignments-toggle): New. * tree-ssa-dce.c (mark_stmt_necessary): Don't mark blocks because of debug stmts. (mark_stmt_if_obviously_necessary): Mark debug stmts. (eliminate_unnecessary_stmts): Walk dominated blocks before dominators. * tree-ssa-ter.c (find_replaceable_in_bb): Skip debug stmts. * ira.c (memref_used_between_p): Skip debug insns. (update_equiv_regs): Likewise. * sched-deps.c (sd_lists_size): Accept empty list. (sd_init_insn): Mark debug insns. (sd_finish_insn): Unmark them. (sd_add_dep): Reject non-debug deps on debug insns. (fixup_sched_groups): Give debug insns group treatment. Skip debug insns. (sched_analyze_reg): Don't mark debug insns for sched before call. (sched_analyze_2): Handle debug insns. (sched_analyze_insn): Compute next non-debug insn. Handle debug insns. (deps_analyze_insn): Handle debug insns. (deps_start_bb): Skip debug insns. (init_deps): Initialize last_debug_insn. * tree-ssa.c (target_for_debug_bind): New. (find_released_ssa_name): New. (propagate_var_def_into_debug_stmts): New. (propagate_defs_into_debug_stmts): New. (verify_ssa): Skip debug bind stmts without values. (warn_uninialized_vars): Skip debug stmts. * target-def.h (TARGET_DELEGITIMIZE_ADDRESS): Set default. * rtl.c (rtx_equal_p_cb): Handle VALUEs. (rtx_equal_p): Likewise. * ira-costs.c (scan_one_insn): Skip debug insns. (process_bb_node_for_hard_reg_moves): Likewise. * rtl.h (DEBUG_INSN_P): New. (NONDEBUG_INSN_P): New. (MAY_HAVE_DEBUG_INSNS): New. (INSN_P): Accept debug insns. (RTX_FRAME_RELATED_P): Likewise. (INSN_DELETED_P): Likewise (PAT_VAR_LOCATION_DECL): New. (PAT_VAR_LOCATION_LOC): New. (PAT_VAR_OCATION_STATUS): New. (NOTE_VAR_LOCATION_DECL): Reimplement. (NOTE_VAR_LOCATION_LOC): Likewise. (NOTE_VAR_LOCATION_STATUS): Likewise. (INSN_VAR_LOCATION): New. (INSN_VAR_LOCATION_DECL): New. (INSN_VAR_LOCATION_LOC): New. (INSN_VAR_LOCATION_STATUS): New. (gen_rtx_UNKNOWN_VAR_LOC): New. (VAR_LOC_UNKNOWN_P): New. (NOTE_DURING_CALL_P): New. (SCHED_GROUP_P): Accept debug insns. (emit_debug_insn_before): Declare. (emit_debug_insn_before_noloc): Declare. (emit_debug_insn_beore_setloc): Declare. (emit_debug_insn_after): Declare. (emit_debug_insn_after_noloc): Declare. (emit_debug_insn_after_setloc): Declare. (emit_debug_insn): Declare. (make_debug_insn_raw): Declare. (prev_nondebug_insn): Declare. (next_nondebug_insn): Declare. (delegitimize_mem_from_attrs): Declare. (get_max_insn_count): Declare. (wrap_constant): Declare. (unwrap_constant): Declare. (get_curr_insn_source_location): Declare. (get_curr_insn_block): Declare. * tree-inline.c (insert_debug_decl_map): New. (processing_debug_stmt): New. (remap_decl): Don't create new mappings in debug stmts. (remap_gimple_op_r): Don't add references in debug stmts. (copy_tree_body_r): Likewise. (remap_gimple_stmt): Handle debug bind stmts. (copy_bb): Skip debug stmts. (copy_edges_for_bb): Likewise. (copy_debug_stmt): New. (copy_debug_stmts): New. (copy_body): Copy debug stmts at the end. (insert_init_debug_bind): New. (insert_init_stmt): Take id. Skip and emit debug stmts. (setup_one_parameter): Remap variable earlier, register debug mapping. (estimate_num_insns): Skip debug stmts. (expand_call_inline): Preserve debug_map. (optimize_inline_calls): Check for no debug_stmts left-overs. (unsave_expr_now): Preserve debug_map. (copy_gimple_seq_and_replace_locals): Likewise. (tree_function_versioning): Check for no debug_stmts left-overs. Init and destroy debug_map as needed. Split edges unconditionally. (build_duplicate_type): Init and destroy debug_map as needed. * tree-inline.h: Include gimple.h instead of pointer-set.h. (struct copy_body_data): Add debug_stmts and debug_map. * sched-int.h (struct ready_list): Add n_debug. (struct deps): Add last_debug_insn. (DEBUG_INSN_SCHED_P): New. (BOUNDARY_DEBUG_INSN_P): New. (SCHEDULE_DEBUG_INSN_P): New. (sd_iterator_cond): Accept empty list. * combine.c (create_log_links): Skip debug insns. (combine_instructions): Likewise. (cleanup_auto_inc_dec): New. From Jakub Jelinek: Make sure the return value is always unshared. (struct rtx_subst_pair): New. (auto_adjust_pair): New. (propagate_for_debug_subst): New. (propagate_for_debug): New. (try_combine): Skip debug insns. Propagate removed defs into debug insns. (next_nonnote_nondebug_insn): New. (distribute_notes): Use it. Skip debug insns. (distribute_links): Skip debug insns. * tree-outof-ssa.c (set_location_for_edge): Likewise. * resource.c (mark_target_live_regs): Likewise. * var-tracking.c: Include cselib.h and target.h. (enum micro_operation_type): Add MO_VAL_USE, MO_VAL_LOC, and MO_VAL_SET. (micro_operation_type_name): New. (enum emit_note_where): Add EMIT_NOTE_AFTER_CALL_INSN. (struct micro_operation_def): Update comments. (decl_or_value): New type. Use instead of decls. (struct emit_note_data_def): Add vars. (struct attrs_def): Use decl_or_value. (struct variable_tracking_info_def): Add permp, flooded. (struct location_chain_def): Update comment. (struct variable_part_def): Use decl_or_value. (struct variable_def): Make var_part a variable length array. (valvar_pool): New. (scratch_regs): New. (cselib_hook_called): New. (dv_is_decl_p): New. (dv_is_value_p): New. (dv_as_decl): New. (dv_as_value): New. (dv_as_opaque): New. (dv_onepart_p): New. (dv_pool): New. (IS_DECL_CODE): New. (check_value_is_not_decl): New. (dv_from_decl): New. (dv_from_value): New. (dv_htab_hash): New. (variable_htab_hash): Use it. (variable_htab_eq): Support values. (variable_htab_free): Free from the right pool. (attrs_list_member, attrs_list_insert): Use decl_or_value. (attrs_list_union): Adjust. (attrs_list_mpdv_union): New. (tie_break_pointers): New. (canon_value_cmp): New. (unshare_variable): Return possibly-modified slot. (vars_copy_1): Adjust. (var_reg_decl_set): Adjust. Split out of... (var_reg_set): ... this. (get_init_value): Adjust. (var_reg_delete_and_set): Adjust. (var_reg_delete): Adjust. (var_regno_delete): Adjust. (var_mem_decl_set): Split out of... (var_mem_set): ... this. (var_mem_delete_and_set): Adjust. (var_mem_delete): Adjust. (val_store): New. (val_reset): New. (val_resolve): New. (variable_union): Adjust. Speed up merge of 1-part vars. (variable_canonicalize): Use unshared slot. (VALUED_RECURSED_INTO): New. (find_loc_in_1pdv): New. (struct dfset_merge): New. (insert_into_intersection): New. (intersect_loc_chains): New. (loc_cmp): New. (canonicalize_loc_order_check): New. (canonicalize_values_mark): New. (canonicalize_values_star): New. (variable_merge_over_cur): New. (variable_merge_over_src): New. (dataflow_set_merge): New. (dataflow_set_equiv_regs): New. (remove_duplicate_values): New. (struct dfset_post_merge): New. (variable_post_merge_new_vals): New. (variable_post_merge_perm_vals): New. (dataflow_post_merge_adjust): New. (find_mem_expr_in_1pdv): New. (dataflow_set_preserve_mem_locs): New. (dataflow_set_remove_mem_locs): New. (dataflow_set_clear_at_call): New. (onepart_variable_different_p): New. (variable_different_p): Use it. (dataflow_set_different_1): Adjust. Make detailed dump more verbose. (track_expr_p): Add need_rtl parameter. Don't generate rtl if not needed. (track_loc_p): Pass it true. (struct count_use_info): New. (find_use_val): New. (replace_expr_with_values): New. (log_op_type): New. (use_type): New, partially split out of... (count_uses): ... this. Count new micro-ops. (count_uses_1): Adjust. (count_stores): Adjust. (count_with_sets): New. (VAL_NEEDS_RESOLUTION): New. (VAL_HOLDS_TRACK_EXPR): New. (VAL_EXPR_IS_COPIED): New. (VAL_EXPR_IS_CLOBBERED): New. (add_uses): Adjust. Generate new micro-ops. (add_uses_1): Adjust. (add_stores): Generate new micro-ops. (add_with_sets): New. (find_src_status): Adjust. (find_src_set_src): Adjust. (compute_bb_dataflow): Use dataflow_set_clear_at_call. Handle new micro-ops. Canonicalize value equivalances. (vt_find_locations): Compute total size of hash tables for dumping. Perform merge for var-tracking-assignments. Don't disregard single-block loops. (dump_attrs_list): Handle decl_or_value. (dump_variable): Take variable. Deal with decl_or_value. (dump_variable_slot): New. (dump_vars): Use it. (dump_dataflow_sets): Adjust. (set_slot_part): New, extended to support one-part variables after splitting out of... (set_variable_part): ... this. (clobber_slot_part): New, split out of... (clobber_variable_part): ... this. (delete_slot_part): New, split out of... (delete_variable_part): .... this. (check_wrap_constant): New. (vt_expand_loc_callback): New. (vt_expand_loc): New. (emit_note_insn_var_location): Adjust. Handle values. Handle EMIT_NOTE_AFTER_CALL_INSN. (emit_notes_for_differences_1): Adjust. Handle values. (emit_notes_for_differences_2): Likewise. (emit_notes_for_differences): Adjust. (emit_notes_in_bb): Take pointer to set. Emit AFTER_CALL_INSN notes. Adjust. Handle new micro-ops. (vt_add_function_parameters): Adjust. Create and bind values. (vt_initialize): Adjust. Initialize scratch_regs and valvar_pool, flooded and perm.. Initialize and use cselib. Log operations. Move some code to count_with_sets and add_with_sets. (delete_debug_insns): New. (vt_debug_insns_local): New. (vt_finalize): Release permp, valvar_pool, scratch_regs. Finish cselib. (var_tracking_main): If var-tracking-assignments is enabled but var-tracking isn't, delete debug insns and leave. Likewise if we exceed limits or fail the stack adjustments tests, and after all var-tracking processing. More in var-tracking, from Jakub Jelinek <jakub@redhat.com>: (dataflow_set): Add traversed_vars. (value_chain, const_value_chain): New typedefs. (value_chain_pool, value_chains): New variables. (value_chain_htab_hash, value_chain_htab_eq, add_value_chain, add_value_chains, add_cselib_value_chains, remove_value_chain, remove_value_chains, remove_cselib_value_chains): New functions. (shared_hash_find_slot_unshare_1, shared_hash_find_slot_1, shared_hash_find_slot_noinsert_1, shared_hash_find_1): New static inlines. (shared_hash_find_slot_unshare, shared_hash_find_slot, shared_hash_find_slot_noinsert, shared_hash_find): Update. (dst_can_be_shared): New variable. (unshare_variable): Unshare set->vars if shared, use shared_hash_*. Clear dst_can_be_shared. If set->traversed_vars is non-NULL and different from set->vars, look up slot again instead of using the passed in slot. (dataflow_set_init): Initialize traversed_vars. (variable_union): Use shared_hash_*. Use initially NO_INSERT lookup if set->vars is shared. Don't keep slot cleared before calling unshare_variable. Unshare set->vars if needed. Adjust unshare_variable callers. Clear dst_can_be_shared if needed. Even ->refcount == 1 vars must be unshared if set->vars is shared and var needs to be modified. (dataflow_set_union): Set traversed_vars during canonicalization. (VALUE_CHANGED, DECL_CHANGED): Define. (set_dv_changed, dv_changed_p): New static inlines. (track_expr_p): Clear DECL_CHANGED. (dump_dataflow_sets): Set it. (variable_was_changed): Call set_dv_changed. (emit_note_insn_var_location): Likewise. (changed_variables_stack): New variable. (check_changed_vars_1, check_changed_vars_2): New functions. (emit_notes_for_changes): Do nothing if changed_variables is empty. Traverse changed_variables with check_changed_vars_1, call check_changed_vars_2 on each changed_variables_stack entry. (emit_notes_in_bb): Add SET argument. Just clear it at the beginning, use it instead of local &set, don't destroy it at the end. (vt_emit_notes): Call dataflow_set_clear early on all VTI(bb)->out sets, never use them, instead use emit_notes_in_bb computed set, dataflow_set_clear also VTI(bb)->in when we are done with the basic block. Initialize changed_variables_stack, free it afterwards. If ENABLE_CHECKING verify that after noting differences to an empty set value_chains hash table is empty. (vt_initialize): Initialize value_chains and value_chain_pool. (vt_finalize): Delete value_chains htab, free value_chain_pool. (variable_tracking_main): Call dump_dataflow_sets before calling vt_emit_notes, not after it. * tree-flow.h (propagate_defs_into_debug_stmts): Declare. (propagate_var_def_into_debug_stmts): Declare. * df-problems.c (df_lr_bb_local_compute): Skip debug insns. (df_set_note): Reject debug insns. (df_whole_mw_reg_dead_p): Take added_notes_p argument. Don't add notes to debug insns. (df_note_bb_compute): Adjust. Likewise. (df_simulate_uses): Skip debug insns. (df_simulate_initialize_backwards): Likewise. * reg-stack.c (subst_stack_regs_in_debug_insn): New. (subst_stack_regs_pat): Reject debug insns. (convert_regs_1): Handle debug insns. * Makefile.in (TREE_INLINE_H): Take pointer-set.h from GIMPLE_H. (print-rtl.o): Depend on cselib.h. (cselib.o): Depend on TREE_PASS_H. (var-tracking.o): Depend on cselib.h and TARGET_H. * sched-rgn.c (rgn_estimate_number_of_insns): Discount debug insns. (init_ready_list): Skip boundary debug insns. (add_branch_dependences): Skip debug insns. (free_block_dependencies): Check for blocks with only debug insns. (compute_priorities): Likewise. * gimple.c (gss_for_code): Handle GIMPLE_DEBUG. (gimple_build_with_ops_stat): Take subcode as unsigned. Adjust all callers. (gimple_build_debug_bind_stat): New. (empty_body_p): Skip debug stmts. (gimple_has_side_effects): Likewise. (gimple_rhs_has_side_effects): Likewise. * gimple.h (enum gimple_debug_subcode, GIMPLE_DEBUG_BIND): New. (gimple_build_debug_bind_stat): Declare. (gimple_build_debug_bind): Define. (is_gimple_debug): New. (gimple_debug_bind_p): New. (gimple_debug_bind_get_var): New. (gimple_debug_bind_get_value): New. (gimple_debug_bind_get_value_ptr): New. (gimple_debug_bind_set_var): New. (gimple_debug_bind_set_value): New. (GIMPLE_DEBUG_BIND_NOVALUE): New internal temporary macro. (gimple_debug_bind_reset_value): New. (gimple_debug_bind_has_value_p): New. (gsi_next_nondebug): New. (gsi_prev_nondebug): New. (gsi_start_nondebug_bb): New. (gsi_last_nondebug_bb): New. * sched-vis.c (print_pattern): Handle VAR_LOCATION. (print_insn): Handle DEBUG_INSN. * tree-cfg.c (remove_bb): Walk stmts backwards. Let loc of first insn prevail. (first_stmt): Skip debug stmts. (first_non_label_stmt): Likewise. (last_stmt): Likewise. (has_zero_uses_1): New. (single_imm_use_1): New. (verify_gimple_debug): New. (verify_types_in_gimple_stmt): Handle debug stmts. (verify_stmt): Likewise. (debug_loop_num): Skip debug stmts. (remove_edge_and_dominated_blocks): Remove dominators last. * tree-ssa-reasssoc.c (rewrite_expr_tree): Propagate into debug stmts. (linearize_expr): Likewise. * config/i386/i386.c (ix86_delegitimize_address): Call default implementation. * config/ia64/ia64.c (ia64_safe_itanium_class): Handle debug insns. (group_barrier_needed): Skip debug insns. (emit_insn_group_barriers): Likewise. (emit_all_insn_group_barriers): Likewise. (ia64_variable_issue): Handle debug insns. (ia64_dfa_new_cycle): Likewise. (final_emit_insn_group_barriers): Skip debug insns. (ia64_dwarf2out_def_steady_cfa): Take frame argument. Don't def cfa without frame. (process_set): Likewise. (process_for_unwind_directive): Pass frame on. * config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Define. (rs6000_delegitimize_address): New. (rs6000_debug_adjust_cost): Handle debug insns. (is_microcoded_insn): Likewise. (is_cracked_insn): Likewise. (is_nonpipeline_insn): Likewise. (insn_must_be_first_in_group): Likewise. (insn_must_be_last_in_group): Likewise. (force_new_group): Likewise. * cfgrtl.c (rtl_split_block): Emit INSN_DELETED note if block contains only debug insns. (rtl_merge_blocks): Skip debug insns. (purge_dead_edges): Likewise. (rtl_block_ends_with_call_p): Skip debug insns. * dce.c (deletable_insn_p): Handle VAR_LOCATION. (mark_reg_dependencies): Skip debug insns. * params.def (PARAM_MIN_NONDEBUG_INSN_UID): New. * tree-ssanames.c (release_ssa_name): Propagate def into debug stmts. * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts): Skip debug stmts. * regcprop.c (replace_oldest_value_addr): Skip debug insns. (replace_oldest_value_mem): Use ALL_REGS for debug insns. (copyprop_hardreg_forward_1): Handle debug insns. * reload1.c (reload): Skip debug insns. Replace unassigned pseudos in debug insns with their equivalences. (eliminate_regs_in_insn): Skip debug insns. (emit_input_reload_insns): Skip debug insns at first, adjust them later. * tree-ssa-operands.c (add_virtual_operand): Reject debug stmts. (get_indirect_ref_operands): Pass opf_no_vops on. (get_expr_operands): Likewise. Skip debug stmts. (parse_ssa_operands): Scan debug insns with opf_no_vops. gcc/testsuite/ChangeLog: * gcc.dg/guality/guality.c: New. * gcc.dg/guality/guality.h: New. * gcc.dg/guality/guality.exp: New. * gcc.dg/guality/example.c: New. * lib/gcc-dg.exp (cleanup-dump): Remove .gk files. (cleanup-saved-temps): Likewise, .gkd files too. gcc/cp/ChangeLog: * cp-tree.h (TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS): New. * cp-lang.c (cxx_dwarf_name): Pass it. * error.c (count_non_default_template_args): Take flags as argument. Adjust all callers. Skip counting of default arguments if the new flag is given. ChangeLog: * Makefile.tpl (BUILD_CONFIG): Default to bootstrap-debug. * Makefile.in: Rebuilt. contrib/ChangeLog: * compare-debug: Look for .gkd files and compare them. config/ChangeLog: * bootstrap-debug.mk: Add comments. * bootstrap-debug-big.mk: New. * bootstrap-debug-lean.mk: New. * bootstrap-debug-ckovw.mk: Add comments. * bootstrap-debug-lib.mk: Drop CFLAGS for stages. Use -g0 for TFLAGS in stage1. Drop -fvar-tracking-assignments-toggle. From-SVN: r151312
2009-09-02 04:42:21 +02:00
|| !flag_pretty_templates)
return n;
return GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (INNERMOST_TEMPLATE_ARGS (args));
}
/* Dump a template-argument-list ARGS (always a TREE_VEC) under control
of FLAGS. */
static void
dump_template_argument_list (cxx_pretty_printer *pp, tree args, int flags)
{
int n = get_non_default_template_args_count (args, flags);
int need_comma = 0;
int i;
for (i = 0; i < n; ++i)
{
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
tree arg = TREE_VEC_ELT (args, i);
/* Only print a comma if we know there is an argument coming. In
the case of an empty template argument pack, no actual
argument will be printed. */
if (need_comma
&& (!ARGUMENT_PACK_P (arg)
|| TREE_VEC_LENGTH (ARGUMENT_PACK_ARGS (arg)) > 0))
pp_separate_with_comma (pp);
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
dump_template_argument (pp, arg, flags);
need_comma = 1;
}
}
/* Dump a template parameter PARM (a TREE_LIST) under control of FLAGS. */
static void
dump_template_parameter (cxx_pretty_printer *pp, tree parm, int flags)
{
tree p;
tree a;
if (parm == error_mark_node)
return;
p = TREE_VALUE (parm);
a = TREE_PURPOSE (parm);
if (TREE_CODE (p) == TYPE_DECL)
{
if (flags & TFF_DECL_SPECIFIERS)
{
pp_cxx_ws_string (pp, "class");
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (p)))
pp_cxx_ws_string (pp, "...");
if (DECL_NAME (p))
pp_cxx_tree_identifier (pp, DECL_NAME (p));
}
else if (DECL_NAME (p))
pp_cxx_tree_identifier (pp, DECL_NAME (p));
else
pp_cxx_canonical_template_parameter (pp, TREE_TYPE (p));
}
else
dump_decl (pp, p, flags | TFF_DECL_SPECIFIERS);
if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && a != NULL_TREE)
{
pp_cxx_whitespace (pp);
pp_equal (pp);
pp_cxx_whitespace (pp);
if (TREE_CODE (p) == TYPE_DECL || TREE_CODE (p) == TEMPLATE_DECL)
dump_type (pp, a, flags & ~TFF_CHASE_TYPEDEF);
else
dump_expr (pp, a, flags | TFF_EXPR_IN_PARENS);
}
}
/* Dump, under control of FLAGS, a template-parameter-list binding.
PARMS is a TREE_LIST of TREE_VEC of TREE_LIST and ARGS is a
TREE_VEC. */
static void
dump_template_bindings (cxx_pretty_printer *pp, tree parms, tree args,
vec<tree, va_gc> *typenames)
{
bool need_semicolon = false;
int i;
tree t;
while (parms)
{
tree p = TREE_VALUE (parms);
int lvl = TMPL_PARMS_DEPTH (parms);
int arg_idx = 0;
int i;
tree lvl_args = NULL_TREE;
/* Don't crash if we had an invalid argument list. */
if (TMPL_ARGS_DEPTH (args) >= lvl)
lvl_args = TMPL_ARGS_LEVEL (args, lvl);
for (i = 0; i < TREE_VEC_LENGTH (p); ++i)
{
tree arg = NULL_TREE;
/* Don't crash if we had an invalid argument list. */
if (lvl_args && NUM_TMPL_ARGS (lvl_args) > arg_idx)
arg = TREE_VEC_ELT (lvl_args, arg_idx);
if (need_semicolon)
pp_separate_with_semicolon (pp);
dump_template_parameter (pp, TREE_VEC_ELT (p, i),
TFF_PLAIN_IDENTIFIER);
pp_cxx_whitespace (pp);
pp_equal (pp);
pp_cxx_whitespace (pp);
if (arg)
{
if (ARGUMENT_PACK_P (arg))
pp_cxx_left_brace (pp);
dump_template_argument (pp, arg, TFF_PLAIN_IDENTIFIER);
if (ARGUMENT_PACK_P (arg))
pp_cxx_right_brace (pp);
}
else
pp_string (pp, M_("<missing>"));
++arg_idx;
need_semicolon = true;
}
parms = TREE_CHAIN (parms);
}
/* Don't bother with typenames for a partial instantiation. */
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
if (vec_safe_is_empty (typenames) || uses_template_parms (args))
return;
/* Don't try to print typenames when we're processing a clone. */
if (current_function_decl
&& !DECL_LANG_SPECIFIC (current_function_decl))
return;
/* Don't try to do this once cgraph starts throwing away front-end
information. */
if (at_eof >= 2)
return;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
FOR_EACH_VEC_SAFE_ELT (typenames, i, t)
{
if (need_semicolon)
pp_separate_with_semicolon (pp);
dump_type (pp, t, TFF_PLAIN_IDENTIFIER);
pp_cxx_whitespace (pp);
pp_equal (pp);
pp_cxx_whitespace (pp);
push_deferring_access_checks (dk_no_check);
t = tsubst (t, args, tf_none, NULL_TREE);
pop_deferring_access_checks ();
/* Strip typedefs. We can't just use TFF_CHASE_TYPEDEF because
pp_simple_type_specifier doesn't know about it. */
t = strip_typedefs (t);
dump_type (pp, t, TFF_PLAIN_IDENTIFIER);
}
}
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
/* Dump a human-readable equivalent of the alias template
specialization of T. */
static void
dump_alias_template_specialization (cxx_pretty_printer *pp, tree t, int flags)
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
{
gcc_assert (alias_template_specialization_p (t));
tree decl = TYPE_NAME (t);
if (!(flags & TFF_UNQUALIFIED_NAME))
dump_scope (pp, CP_DECL_CONTEXT (decl), flags);
pp_cxx_tree_identifier (pp, DECL_NAME (decl));
dump_template_parms (pp, DECL_TEMPLATE_INFO (decl),
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
/*primary=*/false,
flags & ~TFF_TEMPLATE_HEADER);
}
/* Dump a human-readable equivalent of TYPE. FLAGS controls the
format. */
1996-07-11 03:13:25 +02:00
1994-02-24 02:02:37 +01:00
static void
dump_type (cxx_pretty_printer *pp, tree t, int flags)
1994-02-24 02:02:37 +01:00
{
if (t == NULL_TREE)
return;
/* Don't print e.g. "struct mytypedef". */
if (TYPE_P (t) && typedef_variant_p (t))
{
tree decl = TYPE_NAME (t);
if ((flags & TFF_CHASE_TYPEDEF)
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
|| DECL_SELF_REFERENCE_P (decl)
|| (!flag_pretty_templates
&& DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)))
t = strip_typedefs (t);
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
else if (alias_template_specialization_p (t))
{
dump_alias_template_specialization (pp, t, flags);
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
return;
}
else if (same_type_p (t, TREE_TYPE (decl)))
t = decl;
else
{
pp_cxx_cv_qualifier_seq (pp, t);
pp_cxx_tree_identifier (pp, TYPE_IDENTIFIER (t));
return;
}
}
1994-02-24 02:02:37 +01:00
if (TYPE_PTRMEMFUNC_P (t))
goto offset_type;
switch (TREE_CODE (t))
{
case LANG_TYPE:
Implement WG21 N2672, Initializer List proposed wording gcc/cp/ChangeLog: 2008-07-02 Jason Merrill <jason@redhat.com> Implement WG21 N2672, Initializer List proposed wording * cp-tree.h (enum cp_tree_index): Add CPTI_INIT_LIST_TYPE. (struct lang_type_class): Add has_list_ctor bitfield. (TYPE_HAS_LIST_CTOR): New macro. (BRACE_ENCLOSED_INITIALIZER_P): Expect init_list_type_node. (CONSTRUCTOR_IS_DIRECT_INIT): New macro. (LOOKUP_NO_NARROWING): New macro. (LOOKUP_NO_COPY_CTOR_CONVERSION): New macro. * parser.c (cp_parse_braced_list): Split out from... (cp_parser_initializer_clause): ...here. (cp_parser_postfix_expression): Build up CONSTRUCTOR for compound literal here. (cp_lexer_next_token_is_not_keyword): New fn. (cp_parser_parenthesized_expression_list): Handle { }. (cp_parser_new_expression, cp_parser_new_initializer): Likewise. (cp_parser_assignment_expression, cp_parser_condition): Likewise. (cp_parser_jump_statement, cp_parser_simple_declaration): Likewise. (cp_parser_mem_initializer, cp_parser_init_declarator): Likewise. (cp_parser_initializer, cp_parser_functional_cast): Likewise. (cp_parser_omp_for_loop, cp_parser_cache_group): Likewise. (cp_parser_save_member_function_body): Likewise. * call.c (conversion_kind): Add ck_list, ck_aggr. (struct conversion): Add check_narrowing bitfield, conversion list. (build_list_conv): New fn. (build_aggr_conv): New fn. (implicit_conversion): Call them. (standard_conversion): Set check_narrowing if appropriate. (add_function_candidate): Handle LOOKUP_NO_COPY_CTOR_CONVERSION. (build_user_type_conversion_1): When converting from an init list, we allow additional conversions except when calling a copy ctor. (convert_like_real): Calling an explicit ctor for an init list is ill-formed. Handle ck_list and ck_addr. Check narrowing. (build_new_method_call): If CONSTRUCTOR_IS_DIRECT_INIT is set and class doesn't have a list ctor, break the {} into a TREE_LIST. (compare_ics): ck_list is better than other UDCs. (set_up_extended_ref_temp): Split out from initialize_reference. (is_std_init_list): New fn. (is_list_ctor): New fn. * decl.c (cxx_init_decl_processing): Create init_list_type_node. (reshape_init_array_1): Pass it to build_constructor. (reshape_init_class): Ditto. (initialize_artificial_var): Pass the appropriate type. (build_aggr_init_full_exprs): Split out from... (check_initializer): ...here. Handle new semantics. (build_init_list_var_init): New subroutine of check_initializer. (grokdeclarator): Converting constructors can have more than one parm. (grok_special_member_properties): Set TYPE_HAS_LIST_CTOR. * init.c (expand_default_init): Only do digest_init for aggregates. * rtti.c (tinfo_base_init): Pass init_list_type_node to build_constructor_from_list. (generic_initializer, ptr_initializer): Ditto. (ptm_initializer, class_initializer): Ditto. (get_pseudo_ti_init): Ditto. * error.c (dump_type): Handle init_list_type_node. (maybe_warn_cpp0x): New fn. (maybe_varn_variadic_templates): Call it. * cvt.c (ocp_convert): Handle conversion from { }. * tree.c (build_array_of_n_type): New fn. * typeck2.c (store_init_value): Use init_list_type_node. (digest_init): Likewise. (check_narrowing): New fn. * semantics.c: (finish_compound_literal): Take CONSTRUCTOR instead of vector of constructor elts. Handle non-aggregate types. Make constant literals static. * pt.c: (tsubst_copy_and_build): Adjust. (unify): Handle { }. * name-lookup.c (arg_assoc_type): Handle init_list_type_node. gcc/ChangeLog: 2008-07-02 Jason Merrill <jason@redhat.com> * tree.c (ctor_to_list): New fn. * tree.h: Declare it. (CONSTRUCTOR_ELT): New macro. (CONSTRUCTOR_NELTS): New macro. libstdc++-v3/ChangeLog: 2008-07-02 Jason Merrill <jason@redhat.com> * libsupc++/initializer_list: New file. * include/bits/stl_map.h (insert(initializer_list)): New method. From-SVN: r137361
2008-07-02 17:38:50 +02:00
if (t == init_list_type_node)
pp_string (pp, M_("<brace-enclosed initializer list>"));
else if (t == unknown_type_node)
pp_string (pp, M_("<unresolved overloaded function type>"));
else
{
pp_cxx_cv_qualifier_seq (pp, t);
pp_cxx_tree_identifier (pp, TYPE_IDENTIFIER (t));
}
1994-02-24 02:02:37 +01:00
break;
case TREE_LIST:
/* A list of function parms. */
dump_parameters (pp, t, flags);
break;
1994-02-24 02:02:37 +01:00
case IDENTIFIER_NODE:
pp_cxx_tree_identifier (pp, t);
1994-02-24 02:02:37 +01:00
break;
case TREE_BINFO:
dump_type (pp, BINFO_TYPE (t), flags);
1994-02-24 02:02:37 +01:00
break;
case RECORD_TYPE:
case UNION_TYPE:
case ENUMERAL_TYPE:
dump_aggr_type (pp, t, flags);
1994-02-24 02:02:37 +01:00
break;
case TYPE_DECL:
if (flags & TFF_CHASE_TYPEDEF)
{
dump_type (pp, DECL_ORIGINAL_TYPE (t)
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), flags);
break;
}
re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) 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-12 12:30:47 +02:00
/* Fall through. */
case TEMPLATE_DECL:
case NAMESPACE_DECL:
dump_decl (pp, t, flags & ~TFF_DECL_SPECIFIERS);
1994-02-24 02:02:37 +01:00
break;
1994-02-24 02:02:37 +01:00
case INTEGER_TYPE:
case REAL_TYPE:
case VOID_TYPE:
case BOOLEAN_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
case FIXED_POINT_TYPE:
pp_type_specifier_seq (pp, t);
1994-02-24 02:02:37 +01:00
break;
pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Wed Jan 21 10:29:57 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> * pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Substitute default arguments in template template arguments. Correctly convert TEMPLATE_DECL to TEMPLATE_TEMPLATE_PARM. (comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM are no longer treated specially here. * parse.y (template_template_parm): Fix copy error. * decl.c (grokdeclarator): Warn about missing `typename' for nested type created from template template parameters. * parse.y (bad_parm): Likewise * class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM. (push_nested_class): Likewise. * cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code. * cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro. (copy_template_template_parm): Declare. * decl.c (arg_looking_for_template): New variable. (lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM. Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM node if arg_looking_for_template is nonzero. (pushdecl): Handle TEMPLATE_TEMPLATE_PARM. (grok_op_properties, xref_tag, xref_basetypes): Likewise. (grokdeclarator): Handle TEMPLATE_DECL. * decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM. * error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (dump_type_prefix, dump_type_suffix) Handle TEMPLATE_TEMPLATE_PARM. (dump_decl): Handle unnamed template type parameters. Handle template template parameters. (dump_function_name): Handle template template parameters. * init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef): Handle TEMPLATE_TEMPLATE_PARM. * method.c (build_template_template_parm_names): New function. (build_template_parm_names): Handle TEMPLATE_DECL. (build_overload_nested_name, build_overload_name): Handle TEMPLATE_TEMPLATE_PARM. * parse.y (maybe_identifier): New nonterminal. (template_type_parm): Use it. (template_template_parm, template_arg1): New nonterminal. (template_parm): Add template_template_parm rules. (template_arg): Set processing_template_arg. (template_arg1): Rules moved from template_arg. (primary, nonnested_type): Set arg_looking_for_template if we are processing template arguments. * pt.c (begin_member_template_processing): Handle TEMPLATE_DECL. (process_template_parm): Handle template template parameters. (coerce_template_parms, comp_template_args): Likewise. (mangle_class_name_for_template, lookup_template_class): Likewise. (uses_template_parms): Handle TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (current_template_args): Handle TEMPLATE_DECL. (tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM. * search.c (dfs_walk, dfs_record_inheritance): Handle TEMPLATE_TEMPLATE_PARM. * tree.c (copy_template_template_parm): New function. (mapcar): Handle TEMPLATE_TEMPLATE_PARM. * typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM. From-SVN: r17441
1998-01-22 12:03:56 +01:00
case TEMPLATE_TEMPLATE_PARM:
/* For parameters inside template signature. */
cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code. * cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code. (TEMPLATE_TEMPLATE_PARM): Adjust comment. * cp-tree.h (TYPE_BINFO): Adjust comment. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (IS_AGGR_TYPE): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. (TYPE_TEMPLATE_INFO): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Likewise. * class.c (push_nested_class): Likewise. * decl.c (lookup_name_real): Likewise. (grokdeclarator): Likewise. (grok_op_properties): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. * decl2.c (constructor_name_full): Likewise. (arg_assoc_template_arg): Add TEMPLATE_TEMPLATE_PARM case. (arg_assoc_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. * error.c (dump_type): Split TEMPLATE_TEMPLATE_PARM case. (dump_type_prefix): Add BOUND_TEMPLATE_TEMPLATE_PARM. (dump_type_suffix): Likewise. * init.c (is_aggr_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. (get_aggr_from_typedef): Likewise. * mangle.c (write_type): Split TEMPLATE_TEMPLATE_PARM case. (write_expression): Add BOUND_TEMPLATE_TEMPLATE_PARM. (write_template_parm): Likewise. (write_template_template_parm): Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * method.c (build_overload_nested_name): Add BOUND_TEMPLATE_TEMPLATE_PARM. (process_overload_item): Split TEMPLATE_TEMPLATE_PARM case. * parse.y (bad_parm): Add BOUND_TEMPLATE_TEMPLATE_PARM. * pt.c (convert_template_argument): Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (for_each_template_parm_r): Split TEMPLATE_TEMPLATE_PARM case. (for_each_template_parm): Adjust comment. (tsubst): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize. (tsubst_copy): Add BOUND_TEMPLATE_TEMPLATE_PARM. (unify): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize. Use template_args_equal to compare template template parameter cases. * ptree.c (print_lang_type): Add BOUND_TEMPLATE_TEMPLATE_PARM. * search.c (lookup_field_1): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. * tree.c (copy_template_template_parm): Decide whether to create a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM node. (walk_tree): Add BOUND_TEMPLATE_TEMPLATE_PARM. (copy_tree_r): Likewise. * typeck.c (comptypes): Likewise. Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. From-SVN: r36149
2000-09-05 03:01:39 +02:00
if (TYPE_IDENTIFIER (t))
pp_cxx_tree_identifier (pp, TYPE_IDENTIFIER (t));
pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Wed Jan 21 10:29:57 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> * pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Substitute default arguments in template template arguments. Correctly convert TEMPLATE_DECL to TEMPLATE_TEMPLATE_PARM. (comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM are no longer treated specially here. * parse.y (template_template_parm): Fix copy error. * decl.c (grokdeclarator): Warn about missing `typename' for nested type created from template template parameters. * parse.y (bad_parm): Likewise * class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM. (push_nested_class): Likewise. * cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code. * cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro. (copy_template_template_parm): Declare. * decl.c (arg_looking_for_template): New variable. (lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM. Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM node if arg_looking_for_template is nonzero. (pushdecl): Handle TEMPLATE_TEMPLATE_PARM. (grok_op_properties, xref_tag, xref_basetypes): Likewise. (grokdeclarator): Handle TEMPLATE_DECL. * decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM. * error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (dump_type_prefix, dump_type_suffix) Handle TEMPLATE_TEMPLATE_PARM. (dump_decl): Handle unnamed template type parameters. Handle template template parameters. (dump_function_name): Handle template template parameters. * init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef): Handle TEMPLATE_TEMPLATE_PARM. * method.c (build_template_template_parm_names): New function. (build_template_parm_names): Handle TEMPLATE_DECL. (build_overload_nested_name, build_overload_name): Handle TEMPLATE_TEMPLATE_PARM. * parse.y (maybe_identifier): New nonterminal. (template_type_parm): Use it. (template_template_parm, template_arg1): New nonterminal. (template_parm): Add template_template_parm rules. (template_arg): Set processing_template_arg. (template_arg1): Rules moved from template_arg. (primary, nonnested_type): Set arg_looking_for_template if we are processing template arguments. * pt.c (begin_member_template_processing): Handle TEMPLATE_DECL. (process_template_parm): Handle template template parameters. (coerce_template_parms, comp_template_args): Likewise. (mangle_class_name_for_template, lookup_template_class): Likewise. (uses_template_parms): Handle TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (current_template_args): Handle TEMPLATE_DECL. (tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM. * search.c (dfs_walk, dfs_record_inheritance): Handle TEMPLATE_TEMPLATE_PARM. * tree.c (copy_template_template_parm): New function. (mapcar): Handle TEMPLATE_TEMPLATE_PARM. * typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM. From-SVN: r17441
1998-01-22 12:03:56 +01:00
else
pp_cxx_canonical_template_parameter (pp, t);
cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code. * cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code. (TEMPLATE_TEMPLATE_PARM): Adjust comment. * cp-tree.h (TYPE_BINFO): Adjust comment. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (IS_AGGR_TYPE): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. (TYPE_TEMPLATE_INFO): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Likewise. * class.c (push_nested_class): Likewise. * decl.c (lookup_name_real): Likewise. (grokdeclarator): Likewise. (grok_op_properties): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. * decl2.c (constructor_name_full): Likewise. (arg_assoc_template_arg): Add TEMPLATE_TEMPLATE_PARM case. (arg_assoc_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. * error.c (dump_type): Split TEMPLATE_TEMPLATE_PARM case. (dump_type_prefix): Add BOUND_TEMPLATE_TEMPLATE_PARM. (dump_type_suffix): Likewise. * init.c (is_aggr_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. (get_aggr_from_typedef): Likewise. * mangle.c (write_type): Split TEMPLATE_TEMPLATE_PARM case. (write_expression): Add BOUND_TEMPLATE_TEMPLATE_PARM. (write_template_parm): Likewise. (write_template_template_parm): Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * method.c (build_overload_nested_name): Add BOUND_TEMPLATE_TEMPLATE_PARM. (process_overload_item): Split TEMPLATE_TEMPLATE_PARM case. * parse.y (bad_parm): Add BOUND_TEMPLATE_TEMPLATE_PARM. * pt.c (convert_template_argument): Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (for_each_template_parm_r): Split TEMPLATE_TEMPLATE_PARM case. (for_each_template_parm): Adjust comment. (tsubst): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize. (tsubst_copy): Add BOUND_TEMPLATE_TEMPLATE_PARM. (unify): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize. Use template_args_equal to compare template template parameter cases. * ptree.c (print_lang_type): Add BOUND_TEMPLATE_TEMPLATE_PARM. * search.c (lookup_field_1): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. * tree.c (copy_template_template_parm): Decide whether to create a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM node. (walk_tree): Add BOUND_TEMPLATE_TEMPLATE_PARM. (copy_tree_r): Likewise. * typeck.c (comptypes): Likewise. Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. From-SVN: r36149
2000-09-05 03:01:39 +02:00
break;
case BOUND_TEMPLATE_TEMPLATE_PARM:
{
tree args = TYPE_TI_ARGS (t);
pp_cxx_cv_qualifier_seq (pp, t);
pp_cxx_tree_identifier (pp, TYPE_IDENTIFIER (t));
pp_cxx_begin_template_argument_list (pp);
dump_template_argument_list (pp, args, flags);
pp_cxx_end_template_argument_list (pp);
cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code. * cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code. (TEMPLATE_TEMPLATE_PARM): Adjust comment. * cp-tree.h (TYPE_BINFO): Adjust comment. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (IS_AGGR_TYPE): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. (TYPE_TEMPLATE_INFO): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Likewise. * class.c (push_nested_class): Likewise. * decl.c (lookup_name_real): Likewise. (grokdeclarator): Likewise. (grok_op_properties): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. * decl2.c (constructor_name_full): Likewise. (arg_assoc_template_arg): Add TEMPLATE_TEMPLATE_PARM case. (arg_assoc_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. * error.c (dump_type): Split TEMPLATE_TEMPLATE_PARM case. (dump_type_prefix): Add BOUND_TEMPLATE_TEMPLATE_PARM. (dump_type_suffix): Likewise. * init.c (is_aggr_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. (get_aggr_from_typedef): Likewise. * mangle.c (write_type): Split TEMPLATE_TEMPLATE_PARM case. (write_expression): Add BOUND_TEMPLATE_TEMPLATE_PARM. (write_template_parm): Likewise. (write_template_template_parm): Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * method.c (build_overload_nested_name): Add BOUND_TEMPLATE_TEMPLATE_PARM. (process_overload_item): Split TEMPLATE_TEMPLATE_PARM case. * parse.y (bad_parm): Add BOUND_TEMPLATE_TEMPLATE_PARM. * pt.c (convert_template_argument): Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (for_each_template_parm_r): Split TEMPLATE_TEMPLATE_PARM case. (for_each_template_parm): Adjust comment. (tsubst): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize. (tsubst_copy): Add BOUND_TEMPLATE_TEMPLATE_PARM. (unify): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize. Use template_args_equal to compare template template parameter cases. * ptree.c (print_lang_type): Add BOUND_TEMPLATE_TEMPLATE_PARM. * search.c (lookup_field_1): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. * tree.c (copy_template_template_parm): Decide whether to create a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM node. (walk_tree): Add BOUND_TEMPLATE_TEMPLATE_PARM. (copy_tree_r): Likewise. * typeck.c (comptypes): Likewise. Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. From-SVN: r36149
2000-09-05 03:01:39 +02:00
}
pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Wed Jan 21 10:29:57 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> * pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Substitute default arguments in template template arguments. Correctly convert TEMPLATE_DECL to TEMPLATE_TEMPLATE_PARM. (comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM are no longer treated specially here. * parse.y (template_template_parm): Fix copy error. * decl.c (grokdeclarator): Warn about missing `typename' for nested type created from template template parameters. * parse.y (bad_parm): Likewise * class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM. (push_nested_class): Likewise. * cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code. * cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro. (copy_template_template_parm): Declare. * decl.c (arg_looking_for_template): New variable. (lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM. Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM node if arg_looking_for_template is nonzero. (pushdecl): Handle TEMPLATE_TEMPLATE_PARM. (grok_op_properties, xref_tag, xref_basetypes): Likewise. (grokdeclarator): Handle TEMPLATE_DECL. * decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM. * error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (dump_type_prefix, dump_type_suffix) Handle TEMPLATE_TEMPLATE_PARM. (dump_decl): Handle unnamed template type parameters. Handle template template parameters. (dump_function_name): Handle template template parameters. * init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef): Handle TEMPLATE_TEMPLATE_PARM. * method.c (build_template_template_parm_names): New function. (build_template_parm_names): Handle TEMPLATE_DECL. (build_overload_nested_name, build_overload_name): Handle TEMPLATE_TEMPLATE_PARM. * parse.y (maybe_identifier): New nonterminal. (template_type_parm): Use it. (template_template_parm, template_arg1): New nonterminal. (template_parm): Add template_template_parm rules. (template_arg): Set processing_template_arg. (template_arg1): Rules moved from template_arg. (primary, nonnested_type): Set arg_looking_for_template if we are processing template arguments. * pt.c (begin_member_template_processing): Handle TEMPLATE_DECL. (process_template_parm): Handle template template parameters. (coerce_template_parms, comp_template_args): Likewise. (mangle_class_name_for_template, lookup_template_class): Likewise. (uses_template_parms): Handle TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (current_template_args): Handle TEMPLATE_DECL. (tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM. * search.c (dfs_walk, dfs_record_inheritance): Handle TEMPLATE_TEMPLATE_PARM. * tree.c (copy_template_template_parm): New function. (mapcar): Handle TEMPLATE_TEMPLATE_PARM. * typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM. From-SVN: r17441
1998-01-22 12:03:56 +01:00
break;
1994-02-24 02:02:37 +01:00
case TEMPLATE_TYPE_PARM:
pp_cxx_cv_qualifier_seq (pp, t);
if (tree c = PLACEHOLDER_TYPE_CONSTRAINTS (t))
pp_cxx_constrained_type_spec (pp, c);
else if (TYPE_IDENTIFIER (t))
pp_cxx_tree_identifier (pp, TYPE_IDENTIFIER (t));
else
pp_cxx_canonical_template_parameter
(pp, TEMPLATE_TYPE_PARM_INDEX (t));
1994-02-24 02:02:37 +01:00
break;
/* This is not always necessary for pointers and such, but doing this
reduces code size. */
case ARRAY_TYPE:
case POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
offset_type:
case FUNCTION_TYPE:
case METHOD_TYPE:
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
{
dump_type_prefix (pp, t, flags);
dump_type_suffix (pp, t, flags);
1994-02-24 02:02:37 +01:00
break;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
case TYPENAME_TYPE:
if (! (flags & TFF_CHASE_TYPEDEF)
&& DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
{
dump_decl (pp, TYPE_NAME (t), TFF_PLAIN_IDENTIFIER);
break;
}
pp_cxx_cv_qualifier_seq (pp, t);
pp_cxx_ws_string (pp,
TYPENAME_IS_ENUM_P (t) ? "enum"
re PR c++/18368 (C++ error message regression) PR c++/18368 * parser.c (cp_parser_check_for_definition_in_return_type): Take the defined type as a parameter, and inform the user about the possibility of a missing semicolon. (cp_parser_explicit_instantiation): Adjust call to cp_parser_check_for_definition_in_return_type. (cp_parser_init_declarator): Likewise. (cp_parser_member_declaration): Likewise. PR c++/18674 * cp-tree.def (TYPENAME_TYPE): Remove discussion of implicit typename from comments. * cp-tree.h (TYPENAME_IS_ENUM_P): New macro. (TYPENAME_IS_CLASS_P): Likewise. (make_typename_type): Change prototype. * decl.c (struct_typename_info): New type. (typename_compare): Expect the second argument to be a typename_info, not a tree. (build_typename_type): Add tag_type parameter. Do not create a new type until necessary. (make_typename_type): Add tag_type parameter. * error.c (TYPENAME_TYPE): Print tags other than "typename" if appropriate. * friend.c (make_friend_class): Adjust call to make_typename_type. * parser.c (cp_parser_make_typename_type): Likewise. (cp_parser_primary_expression): Adjust call to cp_parser_lookup_name. (cp_parser_unqualified_id): Adjust calls to cp_parser_class_name. (cp_parser_class_or_namespace_name): Likewise. (cp_parser_postfix_expression): Adjust calls to make_typename_type. (cp_parser_mem_initializer_id): Adjust calls to cp_parser_class_name. (cp_parser_type_parameter): Adjust calls to cp_parser_lookup_name. (cp_parser_template_name): Likewise. (cp_parser_template_argument): Likewise. (cp_parser_type_name): Adjust call to cp_parser_class_name. (cp_parser_elaborated_type_specifier): Adjust calls to make_typename_type and cp_parser_lookup_name. (cp_parser_namespace_name): Likewise. (cp_parser_class_name): Replace type_p parameter with tag_type. Adjust calls to make_typename_type and cp_parser_lookup_name. (cp_parser_class_head): Adjust calls to cp_parser_class_name. (cp_parser_base_specifier): Likewise. (cp_parser_lookup_name): Replace is_type parameter with tag_type. Adjust calls to make_typename_type and lookup_qualified_name. (cp_parser_lookup_name_simple): Adjust call to cp_parser_lookup_name. (cp_parser_constructor_declarator_p): Adjust call to cp_parser_class_name. * pt.c (convert_template_argument): Adjust all to make_typename_type. (tsubst_decl): Do not pre-substitute the type of the declaration. (tsubst): Hand off declarations more quickly. Adjust call to make_typename_type. PR c++/18512 * parser.c (cp_parser_postfix_dot_deref_expression): Robustify. PR c++/18674 * g++.old-deja/g++.brendan/crash16.C: Adjust error messages. * g++.old-deja/g++.law/ctors5.C: Likewise. * g++.old-deja/g++.other/crash25.C: Likewise. PR c++/18674 * g++.dg/template/error16.C: New test. PR c++/18512 * g++.dg/template/crash29.C: New test. From-SVN: r91483
2004-11-29 21:10:18 +01:00
: TYPENAME_IS_CLASS_P (t) ? "class"
: "typename");
dump_typename (pp, t, flags);
break;
case UNBOUND_CLASS_TEMPLATE:
if (! (flags & TFF_UNQUALIFIED_NAME))
{
dump_type (pp, TYPE_CONTEXT (t), flags);
pp_cxx_colon_colon (pp);
}
pp_cxx_ws_string (pp, "template");
dump_type (pp, TYPE_IDENTIFIER (t), flags);
break;
case TYPEOF_TYPE:
pp_cxx_ws_string (pp, "__typeof__");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
dump_expr (pp, TYPEOF_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (pp);
break;
c-common.c (struct c_common_resword): Add __underlying_type. /gcc 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * c-family/c-common.c (struct c_common_resword): Add __underlying_type. * c-family/c-common.h (enum rid): Add RID_UNDERLYING_TYPE. /cp 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * cp-tree.def: Add a new UNDERLYING_TYPE tree code. * cp-tree.h (enum cp_trait_kind): Add CPTK_UNDERLYING_TYPE, tidy. (UNDERLYING_TYPE_TYPE): Add. * cp-objcp-common.c (cp_common_init_ts): Mark UNDERLYING_TYPE as TS_COMMON. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword, cp_parser_simple_type_specifier): Handle UNDERLYING_TYPE. (cp_parser_trait_expr): Deal with RID_UNDERLYING_TYPE; tidy. * semantics.c (finish_underlying_type): New. * typeck.c (structural_comptypes): Handle UNDERLYING_TYPE. * error.c (dump_type, dump_type_prefix, dump_type_suffix): Likewise. * cxx-pretty-print.c (p_cxx_type_id): Likewise. * tree.c (cp_walk_subtrees): Likewise. * pt.c (for_each_template_parm_r, tsubst, unify, dependent_type_p_r): Likewise. * mangle.c (write_type): Sorry for __underlying_type. * doc/extend.texi: Document __underlying_type. /testsuite 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/ext/underlying_type1.C: New. * g++.dg/ext/underlying_type2.C: Likewise. * g++.dg/ext/underlying_type3.C: Likewise. * g++.dg/ext/underlying_type4.C: Likewise. * g++.dg/ext/underlying_type5.C: Likewise. * g++.dg/ext/underlying_type6.C: Likewise. * g++.dg/ext/underlying_type7.C: Likewise. * g++.dg/ext/underlying_type8.C: Likewise. * g++.dg/ext/underlying_type9.C: Likewise. * g++.dg/ext/underlying_type10.C: Likewise. From-SVN: r172943
2011-04-26 00:27:19 +02:00
case UNDERLYING_TYPE:
pp_cxx_ws_string (pp, "__underlying_type");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
dump_expr (pp, UNDERLYING_TYPE_TYPE (t), flags & ~TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (pp);
c-common.c (struct c_common_resword): Add __underlying_type. /gcc 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * c-family/c-common.c (struct c_common_resword): Add __underlying_type. * c-family/c-common.h (enum rid): Add RID_UNDERLYING_TYPE. /cp 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * cp-tree.def: Add a new UNDERLYING_TYPE tree code. * cp-tree.h (enum cp_trait_kind): Add CPTK_UNDERLYING_TYPE, tidy. (UNDERLYING_TYPE_TYPE): Add. * cp-objcp-common.c (cp_common_init_ts): Mark UNDERLYING_TYPE as TS_COMMON. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword, cp_parser_simple_type_specifier): Handle UNDERLYING_TYPE. (cp_parser_trait_expr): Deal with RID_UNDERLYING_TYPE; tidy. * semantics.c (finish_underlying_type): New. * typeck.c (structural_comptypes): Handle UNDERLYING_TYPE. * error.c (dump_type, dump_type_prefix, dump_type_suffix): Likewise. * cxx-pretty-print.c (p_cxx_type_id): Likewise. * tree.c (cp_walk_subtrees): Likewise. * pt.c (for_each_template_parm_r, tsubst, unify, dependent_type_p_r): Likewise. * mangle.c (write_type): Sorry for __underlying_type. * doc/extend.texi: Document __underlying_type. /testsuite 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/ext/underlying_type1.C: New. * g++.dg/ext/underlying_type2.C: Likewise. * g++.dg/ext/underlying_type3.C: Likewise. * g++.dg/ext/underlying_type4.C: Likewise. * g++.dg/ext/underlying_type5.C: Likewise. * g++.dg/ext/underlying_type6.C: Likewise. * g++.dg/ext/underlying_type7.C: Likewise. * g++.dg/ext/underlying_type8.C: Likewise. * g++.dg/ext/underlying_type9.C: Likewise. * g++.dg/ext/underlying_type10.C: Likewise. From-SVN: r172943
2011-04-26 00:27:19 +02:00
break;
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
case TYPE_PACK_EXPANSION:
dump_type (pp, PACK_EXPANSION_PATTERN (t), flags);
pp_cxx_ws_string (pp, "...");
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
break;
re PR c++/31431 (ICE with invalid parameter pack) 2007-05-25 Douglas Gregor <doug.gregor@gmail.com> PR c++/31431 PR c++/31432 PR c++/31434 PR c++/31435 PR c++/31437 PR c++/31438 PR c++/31442 PR c++/31443 PR c++/31444 PR c++/31445 * error.c (dump_type): Dump TYPE_ARGUMENT_PACK nodes. * cp-tree.h (check_for_bare_parameter_packs): Returns bool. * pt.c (check_for_bare_parameter_packs): Return bool indicated whether everything was okay. Fix indentation. (push_template_decl_real): Check for bare parameter packs in function parameters; where errors occur, mark the parameter types with ERROR_MARK_NODEs to avert ICEs. (coerce_template_parameter_pack): New. (coerce_template_parms): Moved parameter pack coercion into coerce_template_parameter_pack, and permit it anywhere in the template parameter list (not just at the end). Parameter and argument indices can vary (somewhat) separately now, so add PARM_IDX and ARG_IDX. (fn_type_unification): Don't set an argument pack as incomplete if no argument pack was deduced. (type_unification_real): If a type parameter is a parameter pack and has not otherwise been deduced, it will be deduced to an empty parameter pack. (more_specialized_fn): Use the actual lengths of the argument lists when comparing against expansions. * semantics.c (finish_member_declaration): If a field's type has bare parameter packs, error and set its type to ERROR_MARK_NODE. 2007-05-25 Douglas Gregor <doug.gregor@gmail.com> PR c++/31431 PR c++/31432 PR c++/31434 PR c++/31435 PR c++/31437 PR c++/31438 PR c++/31442 PR c++/31443 PR c++/31444 PR c++/31445 * g++.dg/cpp0x/pr31431.C: New. * g++.dg/cpp0x/pr31437.C: New. * g++.dg/cpp0x/pr31442.C: New. * g++.dg/cpp0x/pr31444.C: New. * g++.dg/cpp0x/pr31431-2.C: New. * g++.dg/cpp0x/pr31432.C: New. * g++.dg/cpp0x/pr31434.C: New. * g++.dg/cpp0x/pr31438.C: New. * g++.dg/cpp0x/pr31443.C: New. * g++.dg/cpp0x/pr31445.C: New. * g++.dg/cpp0x/variadic-crash1.C: New. From-SVN: r125062
2007-05-25 15:15:04 +02:00
case TYPE_ARGUMENT_PACK:
dump_template_argument (pp, t, flags);
re PR c++/31431 (ICE with invalid parameter pack) 2007-05-25 Douglas Gregor <doug.gregor@gmail.com> PR c++/31431 PR c++/31432 PR c++/31434 PR c++/31435 PR c++/31437 PR c++/31438 PR c++/31442 PR c++/31443 PR c++/31444 PR c++/31445 * error.c (dump_type): Dump TYPE_ARGUMENT_PACK nodes. * cp-tree.h (check_for_bare_parameter_packs): Returns bool. * pt.c (check_for_bare_parameter_packs): Return bool indicated whether everything was okay. Fix indentation. (push_template_decl_real): Check for bare parameter packs in function parameters; where errors occur, mark the parameter types with ERROR_MARK_NODEs to avert ICEs. (coerce_template_parameter_pack): New. (coerce_template_parms): Moved parameter pack coercion into coerce_template_parameter_pack, and permit it anywhere in the template parameter list (not just at the end). Parameter and argument indices can vary (somewhat) separately now, so add PARM_IDX and ARG_IDX. (fn_type_unification): Don't set an argument pack as incomplete if no argument pack was deduced. (type_unification_real): If a type parameter is a parameter pack and has not otherwise been deduced, it will be deduced to an empty parameter pack. (more_specialized_fn): Use the actual lengths of the argument lists when comparing against expansions. * semantics.c (finish_member_declaration): If a field's type has bare parameter packs, error and set its type to ERROR_MARK_NODE. 2007-05-25 Douglas Gregor <doug.gregor@gmail.com> PR c++/31431 PR c++/31432 PR c++/31434 PR c++/31435 PR c++/31437 PR c++/31438 PR c++/31442 PR c++/31443 PR c++/31444 PR c++/31445 * g++.dg/cpp0x/pr31431.C: New. * g++.dg/cpp0x/pr31437.C: New. * g++.dg/cpp0x/pr31442.C: New. * g++.dg/cpp0x/pr31444.C: New. * g++.dg/cpp0x/pr31431-2.C: New. * g++.dg/cpp0x/pr31432.C: New. * g++.dg/cpp0x/pr31434.C: New. * g++.dg/cpp0x/pr31438.C: New. * g++.dg/cpp0x/pr31443.C: New. * g++.dg/cpp0x/pr31445.C: New. * g++.dg/cpp0x/variadic-crash1.C: New. From-SVN: r125062
2007-05-25 15:15:04 +02:00
break;
typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes. * cp-tree.def (DECLTYPE_TYPE): New. * error.c (dump_type): Dump DECLTYPE_TYPE nodes. (dump_type_prefix): Ditto. (dump_type_suffix): Ditto. * tree.c (DECLTYPE_TYPE): Walk DECLTYPE_TYPE nodes. * mangle.c (write_type): Handle DECLTYPE_TYPE. * cp-tree.h (IS_AGGR_TYPE): DECLTYPE_TYPE nodes can be aggregate types. (DECLTYPE_TYPE_EXPR): New. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): New. (finish_declared_type): Declare. * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Print DECLTYPE_TYPE nodes. (pp_cxx_type_id): Ditto. * pt.c (for_each_template_parm_r): Walk DECLTYPE_TYPE children. (tsubst): Substitute into a DECLTYPE_TYPE node. (tsubst_copy): Ditto. (unify): Cannot deduce anything from TYPEOF_TYPE or DECLTYPE_TYPE nodes. (dependent_type_p_r): DECLTYPE_TYPE types are always dependent. * semantics.c (finish_typeof): TYPEOF_TYPE types need to use structural equality (because we can't hash the expressions). (finish_declared_type): New. * lex.c (reswords): Add "decltype" keyword. * parser.c cp_lexer_next_token_is_decl_specifier_keyword (cp_parser_postfix_expression): Add member_access_only_p to restrict postfix expression to member access expressions. (cp_parser_unary_expression): Update call to cp_parser_postfix_expression to reflect new parameter. (cp_parser_declared_type): New. (cp_parser_simple_type_specifier): Parse decltype types. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * c-common.h (enum rid): Add RID_DECLTYPE, update RID_LAST_CXX0X. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/decltype1.C: New. * g++.dg/cpp0x/decltype2.C: New. * g++.dg/cpp0x/decltype3.C: New. * g++.dg/cpp0x/decltype4.C: New. * g++.dg/cpp0x/decltype5.C: New. * g++.dg/cpp0x/decltype6.C: New. From-SVN: r126991
2007-07-27 19:43:05 +02:00
case DECLTYPE_TYPE:
pp_cxx_ws_string (pp, "decltype");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
dump_expr (pp, DECLTYPE_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (pp);
typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes. * cp-tree.def (DECLTYPE_TYPE): New. * error.c (dump_type): Dump DECLTYPE_TYPE nodes. (dump_type_prefix): Ditto. (dump_type_suffix): Ditto. * tree.c (DECLTYPE_TYPE): Walk DECLTYPE_TYPE nodes. * mangle.c (write_type): Handle DECLTYPE_TYPE. * cp-tree.h (IS_AGGR_TYPE): DECLTYPE_TYPE nodes can be aggregate types. (DECLTYPE_TYPE_EXPR): New. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): New. (finish_declared_type): Declare. * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Print DECLTYPE_TYPE nodes. (pp_cxx_type_id): Ditto. * pt.c (for_each_template_parm_r): Walk DECLTYPE_TYPE children. (tsubst): Substitute into a DECLTYPE_TYPE node. (tsubst_copy): Ditto. (unify): Cannot deduce anything from TYPEOF_TYPE or DECLTYPE_TYPE nodes. (dependent_type_p_r): DECLTYPE_TYPE types are always dependent. * semantics.c (finish_typeof): TYPEOF_TYPE types need to use structural equality (because we can't hash the expressions). (finish_declared_type): New. * lex.c (reswords): Add "decltype" keyword. * parser.c cp_lexer_next_token_is_decl_specifier_keyword (cp_parser_postfix_expression): Add member_access_only_p to restrict postfix expression to member access expressions. (cp_parser_unary_expression): Update call to cp_parser_postfix_expression to reflect new parameter. (cp_parser_declared_type): New. (cp_parser_simple_type_specifier): Parse decltype types. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * c-common.h (enum rid): Add RID_DECLTYPE, update RID_LAST_CXX0X. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/decltype1.C: New. * g++.dg/cpp0x/decltype2.C: New. * g++.dg/cpp0x/decltype3.C: New. * g++.dg/cpp0x/decltype4.C: New. * g++.dg/cpp0x/decltype5.C: New. * g++.dg/cpp0x/decltype6.C: New. From-SVN: r126991
2007-07-27 19:43:05 +02:00
break;
case NULLPTR_TYPE:
pp_string (pp, "std::nullptr_t");
break;
1994-02-24 02:02:37 +01:00
default:
pp_unsupported_tree (pp, t);
/* Fall through. */
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
case ERROR_MARK:
pp_string (pp, M_("<type error>"));
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
break;
1994-02-24 02:02:37 +01:00
}
}
/* Dump a TYPENAME_TYPE. We need to notice when the context is itself
a TYPENAME_TYPE. */
static void
dump_typename (cxx_pretty_printer *pp, tree t, int flags)
{
tree ctx = TYPE_CONTEXT (t);
if (TREE_CODE (ctx) == TYPENAME_TYPE)
dump_typename (pp, ctx, flags);
else
dump_type (pp, ctx, flags & ~TFF_CLASS_KEY_OR_ENUM);
pp_cxx_colon_colon (pp);
dump_decl (pp, TYPENAME_TYPE_FULLNAME (t), flags);
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* Return the name of the supplied aggregate, or enumeral type. */
const char *
class_key_or_enum_as_string (tree t)
1994-02-24 02:02:37 +01:00
{
c-common.c (do_switch_warnings): Look through the CONST_DECLs in the enumerators of an ENUMERAL_TYPE. 2008-08-26 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (do_switch_warnings): Look through the CONST_DECLs in the enumerators of an ENUMERAL_TYPE. * dbxout.c (dbxout_type): Ditto. 2008-08-26 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (type_after_usual_arithmetic_conversions): Don't do the usual arithmetic conversions on scoped enumeration types. (common_type): Ditto. (default_conversion): Don't perform integral promotions on scoped enumeration types. (build_array_ref): Scoped enumeration types can't be used as subscripts. * decl.c (start_enum): If building a C++0x scoped enumeration, enter its scope. If provided with an underlying type, check that underlying type and set up the enumeration type accordingly. (finish_enum): Only compute an underlying type if the underlying type isn't already fixed, and only convert the enumerator values now if we've just computed the underlying type. Finish the scope of C++0x scoped enumerations. (build_enumerator): For enumerations with a fixed underlying type, check the enumerator values when the enumerator is defined. (lookup_enumerator): New. * call.c (standard_conversion): Don't allow assignment from integers to scoped enumeration types, even with -fpermissive. Don't convert from scoped enumerations to bool or any arithmetic types. (build_conditional_expr): Don't per the usual arithmetic conversions for scoped enumeration types. (convert_like_real): Check complain to see if we should produce warnings. * error.c (class_key_or_enum_as_string): Print scoped enums. * cp-tree.h (MAYBE_CLASS_TYPE_P): Check CLASS_TYPE_P, not TYPE_LANG_FLAG_5. (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P): New. (SCOPED_ENUM_P): New. (UNSCOPED_ENUM_P): New. (SET_SCOPED_ENUM_P): New. (ENUM_UNDERLYING_TYPE): New. * pt.c (lookup_template_class): Update the instantiation of enum types to deal with C++0x scoped enumerations and underlying types. * name-lookup.c (begin_scope): Deal with scoped enumeration scopes. (lookup_qualified_name): Deal with lookup into enumeration types. * name-lookup.h (enum scope_kind): Add sk_scoped_enum. * parser.c (cp_parser_class_or_namespace_name): Rename to... (cp_parser_qualifying_entity): ... this. Also, in C++0x mode, parse a type-name that can be an enumeration type. (cp_parser_nested_name_specifier_opt): Update with C++0x grammar. (cp_parser_elaborated_type_specifier): Parse the optional `struct' or `class' following enum (in C++0x). (cp_parser_enum_specifier): Parse C++0x scoped enumerations and enum-base clauses. 2008-08-26 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/scoped_enum_examples.C: New. * g++.dg/cpp0x/scoped_enum.C: New. * g++.dg/cpp0x/scoped_enum_98.C: New. * g++.dg/cpp0x/enum_base_warn.C: New. * g++.dg/cpp0x/enum_base.C: New. From-SVN: r139611
2008-08-27 00:33:10 +02:00
if (TREE_CODE (t) == ENUMERAL_TYPE)
{
if (SCOPED_ENUM_P (t))
return "enum class";
else
return "enum";
}
1994-02-24 02:02:37 +01:00
else if (TREE_CODE (t) == UNION_TYPE)
return "union";
1994-02-24 02:02:37 +01:00
else if (TYPE_LANG_SPECIFIC (t) && CLASSTYPE_DECLARED_CLASS (t))
return "class";
1994-02-24 02:02:37 +01:00
else
return "struct";
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* Print out a class declaration T under the control of FLAGS,
in the form `class foo'. */
1996-07-11 03:13:25 +02:00
static void
dump_aggr_type (cxx_pretty_printer *pp, tree t, int flags)
{
tree name;
const char *variety = class_key_or_enum_as_string (t);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
int typdef = 0;
int tmplate = 0;
1994-02-24 02:02:37 +01:00
pp_cxx_cv_qualifier_seq (pp, t);
1994-02-24 02:02:37 +01:00
if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_cxx_ws_string (pp, variety);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
name = TYPE_NAME (t);
if (name)
1994-02-24 02:02:37 +01:00
{
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
typdef = (!DECL_ARTIFICIAL (name)
/* An alias specialization is not considered to be a
typedef. */
&& !alias_template_specialization_p (t));
if ((typdef
&& ((flags & TFF_CHASE_TYPEDEF)
|| (!flag_pretty_templates && DECL_LANG_SPECIFIC (name)
&& DECL_TEMPLATE_INFO (name))))
|| DECL_SELF_REFERENCE_P (name))
{
t = TYPE_MAIN_VARIANT (t);
name = TYPE_NAME (t);
typdef = 0;
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
tmplate = !typdef && TREE_CODE (t) != ENUMERAL_TYPE
&& TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t)
&& (TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL
|| PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)));
if (! (flags & TFF_UNQUALIFIED_NAME))
dump_scope (pp, CP_DECL_CONTEXT (name), flags | TFF_SCOPE);
flags &= ~TFF_UNQUALIFIED_NAME;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (tmplate)
{
/* Because the template names are mangled, we have to locate
the most general template, and use that name. */
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
tree tpl = TYPE_TI_TEMPLATE (t);
while (DECL_TEMPLATE_INFO (tpl))
tpl = DECL_TI_TEMPLATE (tpl);
name = tpl;
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
name = DECL_NAME (name);
1994-02-24 02:02:37 +01:00
}
if (name == 0 || anon_aggrname_p (name))
1994-02-24 02:02:37 +01:00
{
if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_string (pp, M_("<unnamed>"));
else
pp_printf (pp, M_("<unnamed %s>"), variety);
1994-02-24 02:02:37 +01:00
}
else if (LAMBDA_TYPE_P (t))
{
/* A lambda's "type" is essentially its signature. */
pp_string (pp, M_("<lambda"));
if (lambda_function (t))
dump_parameters (pp,
FUNCTION_FIRST_USER_PARMTYPE (lambda_function (t)),
flags);
pp_greater (pp);
}
1994-02-24 02:02:37 +01:00
else
pp_cxx_tree_identifier (pp, name);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (tmplate)
dump_template_parms (pp, TYPE_TEMPLATE_INFO (t),
!CLASSTYPE_USE_TEMPLATE (t),
flags & ~TFF_TEMPLATE_HEADER);
1994-02-24 02:02:37 +01:00
}
/* Dump into the obstack the initial part of the output for a given type.
This is necessary when dealing with things like functions returning
functions. Examples:
return type of `int (* fee ())()': pointer -> function -> int. Both
pointer (and reference and offset) and function (and member) types must
deal with prefix and suffix.
Arrays must also do this for DECL nodes, like int a[], and for things like
int *[]&. */
1994-02-24 02:02:37 +01:00
static void
dump_type_prefix (cxx_pretty_printer *pp, tree t, int flags)
1994-02-24 02:02:37 +01:00
{
if (TYPE_PTRMEMFUNC_P (t))
{
t = TYPE_PTRMEMFUNC_FN_TYPE (t);
goto offset_type;
}
1994-02-24 02:02:37 +01:00
switch (TREE_CODE (t))
{
case POINTER_TYPE:
cplus-dem.c (work_stuff): Replace const_type and volatile_type with type_quals. * cplus-dem.c (work_stuff): Replace const_type and volatile_type with type_quals. (TYPE_UNQUALIFIED): New macro. (TYPE_QUAL_CONST): Likewise. (TYPE_QUAL_VOLATILE): Likewise. (TYPE_QUAL_RESTRICT): Likewise. (code_for_qualifier): New function. (qualifier_string): Likewise. (demangle_qualifier): Likewise. (internal_cplus_demangle): Use them. (demangle_signature): Likewise. (demangle_template_value_parm): Likewise. (do_type): Likewise. (demangle_fund_type)): Likewise. * Makefile.in (hash.h): Run gperf when necessary. * cp-tree.h (CP_TYPE_READONLY): Remove. (CP_TYPE_VOLATILE): Likewise. (CP_TYPE_QUALS): New macro. (CP_TYPE_CONST_P): Likewise. (CP_TYPE_VOLATILE_P): Likewise. (CP_TYPE_RESTRICT_P): Likewise. (CP_TYPE_CONST_NON_VOLATILE_P): Likewise. (cp_build_type_variant): Rename to ... (cp_build_qualified_type): New function. (c_apply_type_quals_to_decl): Declare. (SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'. (SIGNATURE_REFERENCE_NAME_FORMAT): Likewise. (cp_type_qual_from_rid): New function. (compparms): Remove unused parameter. All callers changed. (cp_type_quals): New function. (at_least_as_qualified_p): Likewise. (more_qualified_p): Likewise. * call.c (standard_conversion): Replace calls to cp_build_type_variant with cp_build_qualified_type. Use CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to compare them. Use CP_TYPE_* macros to check qualifiers. (reference_binding): Likewise. (implicit_conversion): Likewise. (add_builtin_candidates): Likewise. (build_over_call): Likewise. * class.c (overrides): Compare all qualifiers, not just `const', on method declarations. * cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc. (convert_pointer_to_real): Likewise. (type_promotes_to): Likewise. * decl.c (check_for_uninitialized_const_var): New function. (init_decl_processing): More CP_TYPE_QUALS conversion, etc. (cp_finish_decl): Use check_for_uninitialized_const_var. (grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to handle `restrict'. (grok_ctor_properties): Likewise. (grok_op_properties): Likewise. (start_function): Likewise. (rever_static_member_fn): Likewise. * decl2.c (grok_method_quals): Likewise. (grokfield): Likewise. * error.c (dump_readonly_or_volatile): Rename to ... (dump_qualifiers): New function. Handle `restrict'. (dump_type_real): Use it. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_function_decl): Likewise. (cv_as_string): Likewise. * gxx.gperf: Add __restrict and __restrict__. * gxxint.texi: Document `u' as used for `__restrict', and a few other previously undocumented codes. * hash.h: Regenerated. * init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc. (build_member_call): Likewise. (build_new_1): Likewise. * lex.c (init_parse): Add entry for RID_RESTRICT. (cons_up_default_function): More CP_TYPE_QUALS conversion, etc. (cp_type_qual_from_rid): Define. * lex.h (enum rid): Add RID_RESTRICT. * method.c (process_modifiers): Deal with `restrict'. * parse.y (primary): More CP_TYPE_QUALS conversion, etc. * parse.c: Regenerated. * pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc. (tsubst_aggr_type): Likewise. (tsubst): Likewise. (check_cv_quals_for_unify): Likewise. (unify): Likewise. * rtti.c (init_rtti_processing): Likewise. (build_headof): Likewise. (get_tinfo_var): Likewise. (buidl_dynamic_cast_1): Likewise. Fix `volatile' handling. (expand_class_desc): Likewise. (expand_attr_desc): Likewise. (synthesize_tinfo_fn): Likewise. * search.c (covariant_return_p): Likewise. Fix `volatile' handling. (get_matching_virtual): Likewise. (expand_upcast_fixups): Likewise. * sig.c (build_signature_pointer_or_reference_name): Take type_quals, not constp and volatilep. (build_signature_pointer_or_reference_type): Likewise. (match_method_types): More CP_TYPE_QUALS conversion, etc. (build_signature_pointer_constructor): Likewise. (build_signature_method_call): Likewise. * tree.c (build_cplus_array_type): Likewise. (cp_build_type_variant): Rename to ... (cp_build_qualified_type): New function. Deal with `__restrict'. (canonical_type_variant): More CP_TYPE_QUALS conversion, etc. (build_exception_variant): Likewise. (mapcar): Likewise. * typeck.c (qualif_type): Likewise. (common_type): Likewise. (comptypes): Likewise. (comp_cv_target_types): Likewise. (at_least_as_qualified_p): Define. (more_qualified_p): Likewise. (comp_cv_qualification): More CP_TYPE_QUALS conversion, etc. (compparms): Likewise. (inline_conversion): Likewise. (string_conv_p): Likewise. (build_component_ref): Likewise. (build_indirect_ref): Likewise. (build_array_ref): Likewise. (build_unary_op): Likewise. (build_conditional_expr): Likewise. (build_static_cast): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_For_assignment): Likewise. (comp_ptr_ttypes_real): Likewise. (cp_type_quals): New function. From-SVN: r23258
1998-10-23 16:53:28 +02:00
case REFERENCE_TYPE:
1994-02-24 02:02:37 +01:00
{
tree sub = TREE_TYPE (t);
dump_type_prefix (pp, sub, flags);
if (TREE_CODE (sub) == ARRAY_TYPE
|| TREE_CODE (sub) == FUNCTION_TYPE)
1994-02-24 02:02:37 +01:00
{
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
pp_c_attributes_display (pp, TYPE_ATTRIBUTES (sub));
1994-02-24 02:02:37 +01:00
}
call.c (add_builtin_candidate): Use TYPE_PTR_P and VOID_TYPE_P. 2013-03-29 Paolo Carlini <paolo.carlini@oracle.com> * call.c (add_builtin_candidate): Use TYPE_PTR_P and VOID_TYPE_P. (build_op_call_1): Likewise. (build_over_call): Likewise. (compare_ics): Likewise. * class.c (build_base_path): Likewise. (resolve_address_of_overloaded_function): Likewise. * cp-tree.h: Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_reference): Likewise. (ocp_convert): Likewise. (convert_force): Likewise, tidy. * cxx-pretty-print.c (pp_cxx_postfix_expression): Likewise. (pp_cxx_ptr_operator): Likewise. * decl.c (duplicate_decls): Likewise. (start_decl): Likewise. (grok_op_properties): Likewise. (start_preparsed_function): Likewise. (store_parm_decls): Likewise. (finish_function): Likewise. * decl2.c (delete_sanity): Likewise. (acceptable_java_type): Likewise. (grokbitfield): Likewise. (cp_reconstruct_complex_type): Likewise. * error.c (dump_type_prefix): Likewise. (dump_expr): Likewise. * except.c (push_eh_cleanup): Likewise. (complete_ptr_ref_or_void_ptr_p): Likewise. (can_convert_eh): Likewise. * init.c (build_new_1): Likewise. (build_delete): Likewise. (build_vec_delete): Likewise. * mangle.c (write_type): Likewise. * parser.c (lookup_literal_operator): Likewise. * pt.c (convert_nontype_argument_function): Likewise. (convert_nontype_argument): Likewise. (tsubst): Likewise. (unify): Likewise. (dependent_type_p_r): Likewise. * rtti.c (build_headof): Likewise. (build_typeid): Likewise. (build_dynamic_cast_1): Likewise. (target_incomplete_p): Likewise. (typeinfo_in_lib_p): Likewise. * semantics.c (finish_omp_for): Likewise. (cxx_eval_call_expression): Likewise. (maybe_resolve_dummy): Likewise. * tree.c (build_target_expr): Likewise. (cp_build_qualified_type_real): Likewise. * typeck.c (composite_pointer_type_r): Likewise. (composite_pointer_type): Likewise. (comp_except_types): Likewise. (cxx_sizeof_nowarn): Likewise. (string_conv_p): Likewise. (cp_build_array_ref): Likewise. (cp_build_function_call_vec): Likewise, also use TYPE_PTRFN_P. (pointer_diff): Likewise. (cp_build_addr_expr_1): Likewise. (cp_build_unary_op): Likewise. (build_static_cast_1): Likewise. (cp_build_c_cast): Likewise. (comp_ptr_ttypes_real): Likewise. (ptr_reasonably_similar): Likewise. (comp_ptr_ttypes_const): Likewise. (casts_away_constness): Likewise. (check_literal_operator_args): Likewise. * typeck2.c (build_x_arrow): Likewise. (add_exception_specifier): Likewise. From-SVN: r197249
2013-03-29 21:29:26 +01:00
if (TYPE_PTR_P (t))
pp_star (pp);
re PR c++/7412 ([DR 106] References to references) 2007-05-30 Russell Yanofsky <russ@yanofsky.org> Douglas Gregor <doug.gregor@gmail.com> Pedro Lamarao <pedro.lamarao@mndfck.org> Howard Hinnant <howard.hinnant@gmail.com> PR c++/7412 PR c++/29939 * g++.dg/cpp0x/rv8p.C: New. * g++.dg/cpp0x/temp-constructor-bug.C: New. * g++.dg/cpp0x/cast-bug.C: New. * g++.dg/cpp0x/elision_weak.C: New. * g++.dg/cpp0x/collapse-bug.C: New. * g++.dg/cpp0x/rv3p.C: New. * g++.dg/cpp0x/rv7n.C: New. * g++.dg/cpp0x/overload-conv-1.C: New. * g++.dg/cpp0x/rv2n.C: New. * g++.dg/cpp0x/deduce.C: New. * g++.dg/cpp0x/temp-va-arg-bug.C: New. * g++.dg/cpp0x/rv6p.C: New. * g++.dg/cpp0x/template_deduction.C: New. * g++.dg/cpp0x/implicit-copy.C: New. * g++.dg/cpp0x/rv1p.C: New. * g++.dg/cpp0x/cast.C: New. * g++.dg/cpp0x/rv5n.C: New. * g++.dg/cpp0x/collapse.C: New. * g++.dg/cpp0x/overload-conv-2.C: New. * g++.dg/cpp0x/rv4p.C: New. * g++.dg/cpp0x/rvo.C: New. * g++.dg/cpp0x/iop.C: New. * g++.dg/cpp0x/rv3n.C: New. * g++.dg/cpp0x/rv7p.C: New. * g++.dg/cpp0x/reference_collapsing.C: New. * g++.dg/cpp0x/overload.C: New. * g++.dg/cpp0x/named.C: New. * g++.dg/cpp0x/rv2p.C: New. * g++.dg/cpp0x/rv6n.C: New. * g++.dg/cpp0x/not_special.C: New. * g++.dg/cpp0x/bind.C: New. * g++.dg/cpp0x/rv1n.C: New. * g++.dg/cpp0x/rv5p.C: New. * g++.dg/cpp0x/elision.C: New. * g++.dg/cpp0x/named_refs.C: New. * g++.dg/cpp0x/unnamed_refs.C: New. * g++.dg/cpp0x/rv4n.C: New. * g++.dg/cpp0x/elision_neg.C: New. * g++.dg/init/copy7.C: Run in C++98 mode. * g++.dg/overload/arg1.C: Ditto. * g++.dg/overload/arg4.C: Ditto. 2007-05-30 Russell Yanofsky <russ@yanofsky.org> Douglas Gregor <doug.gregor@gmail.com> Pedro Lamarao <pedro.lamarao@mndfck.org> Howard Hinnant <howard.hinnant@gmail.com> PR c++/7412 PR c++/29939 * typeck.c (comptypes): Don't consider rvalue and lvalue reference types to be equivalent. (check_return_expr): Move from certain lvalues when returning them. * decl.c (grokdeclarator): Implement reference collapsing. (copy_fn_p): Don't consider constructors taking rvalue references to be copy constructors. (move_fn_p): New. * call.c (conversion): New "rvaluedness_matches_p" member. (convert_class_to_reference): Require reference type as first parameter instead of base type. (reference_binding): Add logic to handle rvalue references. (implicit_conversion): Update inaccurate comment. (convert_like_real): Disable creation of temporaries that are impossible to initialize for types with move constructors. (build_over_call): Elide move constructors when possible. (maybe_handle_implicit_object): Set "rvaluedness_matches_p". (maybe_handle_ref_bind): Return conversion instead of type node. (compare_ics): Add logic to use "rvaluedness_matches_p" values to determine preferred conversion sequences. * cp-tree.h (TYPE_REF_IS_RVALUE): New. (LOOKUP_PREFER_RVALUE): New. (DECL_MOVE_CONSTRUCTOR_P): New. (struct cp_declarator): Add "reference" member for reference types, with new "rvalue_ref" flag. (cp_build_reference_type): Declare. (move_fn_p): Declare. * error.c (dump_type_prefix): Format rvalue reference types correctly in error messages. * except.c (build_throw): Move from certain lvalues when throwing. * mangle.c (write_type): Mangle rvalue references differently than regular references. * parser.c (make_reference_declarator): Add boolean parameter for rvalue references. (cp_parser_make_indirect_declarator): New. (cp_parser_new_declarator_opt): Call cp_parser_make_indirect_declarator. (cp_parser_conversion_declarator_opt): Ditto. (cp_parser_declarator): Ditto. (cp_parser_ptr_operator): Parse "&&" tokens into rvalue reference declarators. * pt.c (tsubst): Implement reference collapsing. (maybe_adjust_types_for_deduction): Implement special template parameter deduction rule for rvalue references. (type_unification_real): Update calls to maybe_adjust_types_for_deduction. (try_one_overload): Ditto. (unify_pack_expansion): Ditto. * tree.c (lvalue_p_1): Handle rvalue reference types. (cp_build_reference_type): New. From-SVN: r125211
2007-05-31 03:18:22 +02:00
else if (TREE_CODE (t) == REFERENCE_TYPE)
{
if (TYPE_REF_IS_RVALUE (t))
pp_ampersand_ampersand (pp);
re PR c++/7412 ([DR 106] References to references) 2007-05-30 Russell Yanofsky <russ@yanofsky.org> Douglas Gregor <doug.gregor@gmail.com> Pedro Lamarao <pedro.lamarao@mndfck.org> Howard Hinnant <howard.hinnant@gmail.com> PR c++/7412 PR c++/29939 * g++.dg/cpp0x/rv8p.C: New. * g++.dg/cpp0x/temp-constructor-bug.C: New. * g++.dg/cpp0x/cast-bug.C: New. * g++.dg/cpp0x/elision_weak.C: New. * g++.dg/cpp0x/collapse-bug.C: New. * g++.dg/cpp0x/rv3p.C: New. * g++.dg/cpp0x/rv7n.C: New. * g++.dg/cpp0x/overload-conv-1.C: New. * g++.dg/cpp0x/rv2n.C: New. * g++.dg/cpp0x/deduce.C: New. * g++.dg/cpp0x/temp-va-arg-bug.C: New. * g++.dg/cpp0x/rv6p.C: New. * g++.dg/cpp0x/template_deduction.C: New. * g++.dg/cpp0x/implicit-copy.C: New. * g++.dg/cpp0x/rv1p.C: New. * g++.dg/cpp0x/cast.C: New. * g++.dg/cpp0x/rv5n.C: New. * g++.dg/cpp0x/collapse.C: New. * g++.dg/cpp0x/overload-conv-2.C: New. * g++.dg/cpp0x/rv4p.C: New. * g++.dg/cpp0x/rvo.C: New. * g++.dg/cpp0x/iop.C: New. * g++.dg/cpp0x/rv3n.C: New. * g++.dg/cpp0x/rv7p.C: New. * g++.dg/cpp0x/reference_collapsing.C: New. * g++.dg/cpp0x/overload.C: New. * g++.dg/cpp0x/named.C: New. * g++.dg/cpp0x/rv2p.C: New. * g++.dg/cpp0x/rv6n.C: New. * g++.dg/cpp0x/not_special.C: New. * g++.dg/cpp0x/bind.C: New. * g++.dg/cpp0x/rv1n.C: New. * g++.dg/cpp0x/rv5p.C: New. * g++.dg/cpp0x/elision.C: New. * g++.dg/cpp0x/named_refs.C: New. * g++.dg/cpp0x/unnamed_refs.C: New. * g++.dg/cpp0x/rv4n.C: New. * g++.dg/cpp0x/elision_neg.C: New. * g++.dg/init/copy7.C: Run in C++98 mode. * g++.dg/overload/arg1.C: Ditto. * g++.dg/overload/arg4.C: Ditto. 2007-05-30 Russell Yanofsky <russ@yanofsky.org> Douglas Gregor <doug.gregor@gmail.com> Pedro Lamarao <pedro.lamarao@mndfck.org> Howard Hinnant <howard.hinnant@gmail.com> PR c++/7412 PR c++/29939 * typeck.c (comptypes): Don't consider rvalue and lvalue reference types to be equivalent. (check_return_expr): Move from certain lvalues when returning them. * decl.c (grokdeclarator): Implement reference collapsing. (copy_fn_p): Don't consider constructors taking rvalue references to be copy constructors. (move_fn_p): New. * call.c (conversion): New "rvaluedness_matches_p" member. (convert_class_to_reference): Require reference type as first parameter instead of base type. (reference_binding): Add logic to handle rvalue references. (implicit_conversion): Update inaccurate comment. (convert_like_real): Disable creation of temporaries that are impossible to initialize for types with move constructors. (build_over_call): Elide move constructors when possible. (maybe_handle_implicit_object): Set "rvaluedness_matches_p". (maybe_handle_ref_bind): Return conversion instead of type node. (compare_ics): Add logic to use "rvaluedness_matches_p" values to determine preferred conversion sequences. * cp-tree.h (TYPE_REF_IS_RVALUE): New. (LOOKUP_PREFER_RVALUE): New. (DECL_MOVE_CONSTRUCTOR_P): New. (struct cp_declarator): Add "reference" member for reference types, with new "rvalue_ref" flag. (cp_build_reference_type): Declare. (move_fn_p): Declare. * error.c (dump_type_prefix): Format rvalue reference types correctly in error messages. * except.c (build_throw): Move from certain lvalues when throwing. * mangle.c (write_type): Mangle rvalue references differently than regular references. * parser.c (make_reference_declarator): Add boolean parameter for rvalue references. (cp_parser_make_indirect_declarator): New. (cp_parser_new_declarator_opt): Call cp_parser_make_indirect_declarator. (cp_parser_conversion_declarator_opt): Ditto. (cp_parser_declarator): Ditto. (cp_parser_ptr_operator): Parse "&&" tokens into rvalue reference declarators. * pt.c (tsubst): Implement reference collapsing. (maybe_adjust_types_for_deduction): Implement special template parameter deduction rule for rvalue references. (type_unification_real): Update calls to maybe_adjust_types_for_deduction. (try_one_overload): Ditto. (unify_pack_expansion): Ditto. * tree.c (lvalue_p_1): Handle rvalue reference types. (cp_build_reference_type): New. From-SVN: r125211
2007-05-31 03:18:22 +02:00
else
pp_ampersand (pp);
re PR c++/7412 ([DR 106] References to references) 2007-05-30 Russell Yanofsky <russ@yanofsky.org> Douglas Gregor <doug.gregor@gmail.com> Pedro Lamarao <pedro.lamarao@mndfck.org> Howard Hinnant <howard.hinnant@gmail.com> PR c++/7412 PR c++/29939 * g++.dg/cpp0x/rv8p.C: New. * g++.dg/cpp0x/temp-constructor-bug.C: New. * g++.dg/cpp0x/cast-bug.C: New. * g++.dg/cpp0x/elision_weak.C: New. * g++.dg/cpp0x/collapse-bug.C: New. * g++.dg/cpp0x/rv3p.C: New. * g++.dg/cpp0x/rv7n.C: New. * g++.dg/cpp0x/overload-conv-1.C: New. * g++.dg/cpp0x/rv2n.C: New. * g++.dg/cpp0x/deduce.C: New. * g++.dg/cpp0x/temp-va-arg-bug.C: New. * g++.dg/cpp0x/rv6p.C: New. * g++.dg/cpp0x/template_deduction.C: New. * g++.dg/cpp0x/implicit-copy.C: New. * g++.dg/cpp0x/rv1p.C: New. * g++.dg/cpp0x/cast.C: New. * g++.dg/cpp0x/rv5n.C: New. * g++.dg/cpp0x/collapse.C: New. * g++.dg/cpp0x/overload-conv-2.C: New. * g++.dg/cpp0x/rv4p.C: New. * g++.dg/cpp0x/rvo.C: New. * g++.dg/cpp0x/iop.C: New. * g++.dg/cpp0x/rv3n.C: New. * g++.dg/cpp0x/rv7p.C: New. * g++.dg/cpp0x/reference_collapsing.C: New. * g++.dg/cpp0x/overload.C: New. * g++.dg/cpp0x/named.C: New. * g++.dg/cpp0x/rv2p.C: New. * g++.dg/cpp0x/rv6n.C: New. * g++.dg/cpp0x/not_special.C: New. * g++.dg/cpp0x/bind.C: New. * g++.dg/cpp0x/rv1n.C: New. * g++.dg/cpp0x/rv5p.C: New. * g++.dg/cpp0x/elision.C: New. * g++.dg/cpp0x/named_refs.C: New. * g++.dg/cpp0x/unnamed_refs.C: New. * g++.dg/cpp0x/rv4n.C: New. * g++.dg/cpp0x/elision_neg.C: New. * g++.dg/init/copy7.C: Run in C++98 mode. * g++.dg/overload/arg1.C: Ditto. * g++.dg/overload/arg4.C: Ditto. 2007-05-30 Russell Yanofsky <russ@yanofsky.org> Douglas Gregor <doug.gregor@gmail.com> Pedro Lamarao <pedro.lamarao@mndfck.org> Howard Hinnant <howard.hinnant@gmail.com> PR c++/7412 PR c++/29939 * typeck.c (comptypes): Don't consider rvalue and lvalue reference types to be equivalent. (check_return_expr): Move from certain lvalues when returning them. * decl.c (grokdeclarator): Implement reference collapsing. (copy_fn_p): Don't consider constructors taking rvalue references to be copy constructors. (move_fn_p): New. * call.c (conversion): New "rvaluedness_matches_p" member. (convert_class_to_reference): Require reference type as first parameter instead of base type. (reference_binding): Add logic to handle rvalue references. (implicit_conversion): Update inaccurate comment. (convert_like_real): Disable creation of temporaries that are impossible to initialize for types with move constructors. (build_over_call): Elide move constructors when possible. (maybe_handle_implicit_object): Set "rvaluedness_matches_p". (maybe_handle_ref_bind): Return conversion instead of type node. (compare_ics): Add logic to use "rvaluedness_matches_p" values to determine preferred conversion sequences. * cp-tree.h (TYPE_REF_IS_RVALUE): New. (LOOKUP_PREFER_RVALUE): New. (DECL_MOVE_CONSTRUCTOR_P): New. (struct cp_declarator): Add "reference" member for reference types, with new "rvalue_ref" flag. (cp_build_reference_type): Declare. (move_fn_p): Declare. * error.c (dump_type_prefix): Format rvalue reference types correctly in error messages. * except.c (build_throw): Move from certain lvalues when throwing. * mangle.c (write_type): Mangle rvalue references differently than regular references. * parser.c (make_reference_declarator): Add boolean parameter for rvalue references. (cp_parser_make_indirect_declarator): New. (cp_parser_new_declarator_opt): Call cp_parser_make_indirect_declarator. (cp_parser_conversion_declarator_opt): Ditto. (cp_parser_declarator): Ditto. (cp_parser_ptr_operator): Parse "&&" tokens into rvalue reference declarators. * pt.c (tsubst): Implement reference collapsing. (maybe_adjust_types_for_deduction): Implement special template parameter deduction rule for rvalue references. (type_unification_real): Update calls to maybe_adjust_types_for_deduction. (try_one_overload): Ditto. (unify_pack_expansion): Ditto. * tree.c (lvalue_p_1): Handle rvalue reference types. (cp_build_reference_type): New. From-SVN: r125211
2007-05-31 03:18:22 +02:00
}
pp->padding = pp_before;
pp_cxx_cv_qualifier_seq (pp, t);
1994-02-24 02:02:37 +01:00
}
break;
case OFFSET_TYPE:
offset_type:
dump_type_prefix (pp, TREE_TYPE (t), flags);
if (TREE_CODE (t) == OFFSET_TYPE) /* pmfs deal with this in d_t_p */
{
pp_maybe_space (pp);
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
pp_cxx_left_paren (pp);
dump_type (pp, TYPE_OFFSET_BASETYPE (t), flags);
pp_cxx_colon_colon (pp);
}
pp_cxx_star (pp);
pp_cxx_cv_qualifier_seq (pp, t);
pp->padding = pp_before;
1994-02-24 02:02:37 +01:00
break;
/* This can be reached without a pointer when dealing with
templates, e.g. std::is_function. */
1994-02-24 02:02:37 +01:00
case FUNCTION_TYPE:
dump_type_prefix (pp, TREE_TYPE (t), flags);
1994-02-24 02:02:37 +01:00
break;
case METHOD_TYPE:
dump_type_prefix (pp, TREE_TYPE (t), flags);
pp_maybe_space (pp);
pp_cxx_left_paren (pp);
dump_aggr_type (pp, TYPE_METHOD_BASETYPE (t), flags);
pp_cxx_colon_colon (pp);
1994-02-24 02:02:37 +01:00
break;
case ARRAY_TYPE:
dump_type_prefix (pp, TREE_TYPE (t), flags);
1994-02-24 02:02:37 +01:00
break;
case ENUMERAL_TYPE:
case IDENTIFIER_NODE:
case INTEGER_TYPE:
case BOOLEAN_TYPE:
1994-02-24 02:02:37 +01:00
case REAL_TYPE:
case RECORD_TYPE:
case TEMPLATE_TYPE_PARM:
pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Wed Jan 21 10:29:57 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> * pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Substitute default arguments in template template arguments. Correctly convert TEMPLATE_DECL to TEMPLATE_TEMPLATE_PARM. (comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM are no longer treated specially here. * parse.y (template_template_parm): Fix copy error. * decl.c (grokdeclarator): Warn about missing `typename' for nested type created from template template parameters. * parse.y (bad_parm): Likewise * class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM. (push_nested_class): Likewise. * cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code. * cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro. (copy_template_template_parm): Declare. * decl.c (arg_looking_for_template): New variable. (lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM. Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM node if arg_looking_for_template is nonzero. (pushdecl): Handle TEMPLATE_TEMPLATE_PARM. (grok_op_properties, xref_tag, xref_basetypes): Likewise. (grokdeclarator): Handle TEMPLATE_DECL. * decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM. * error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (dump_type_prefix, dump_type_suffix) Handle TEMPLATE_TEMPLATE_PARM. (dump_decl): Handle unnamed template type parameters. Handle template template parameters. (dump_function_name): Handle template template parameters. * init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef): Handle TEMPLATE_TEMPLATE_PARM. * method.c (build_template_template_parm_names): New function. (build_template_parm_names): Handle TEMPLATE_DECL. (build_overload_nested_name, build_overload_name): Handle TEMPLATE_TEMPLATE_PARM. * parse.y (maybe_identifier): New nonterminal. (template_type_parm): Use it. (template_template_parm, template_arg1): New nonterminal. (template_parm): Add template_template_parm rules. (template_arg): Set processing_template_arg. (template_arg1): Rules moved from template_arg. (primary, nonnested_type): Set arg_looking_for_template if we are processing template arguments. * pt.c (begin_member_template_processing): Handle TEMPLATE_DECL. (process_template_parm): Handle template template parameters. (coerce_template_parms, comp_template_args): Likewise. (mangle_class_name_for_template, lookup_template_class): Likewise. (uses_template_parms): Handle TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (current_template_args): Handle TEMPLATE_DECL. (tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM. * search.c (dfs_walk, dfs_record_inheritance): Handle TEMPLATE_TEMPLATE_PARM. * tree.c (copy_template_template_parm): New function. (mapcar): Handle TEMPLATE_TEMPLATE_PARM. * typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM. From-SVN: r17441
1998-01-22 12:03:56 +01:00
case TEMPLATE_TEMPLATE_PARM:
cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code. * cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code. (TEMPLATE_TEMPLATE_PARM): Adjust comment. * cp-tree.h (TYPE_BINFO): Adjust comment. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (IS_AGGR_TYPE): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. (TYPE_TEMPLATE_INFO): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Likewise. * class.c (push_nested_class): Likewise. * decl.c (lookup_name_real): Likewise. (grokdeclarator): Likewise. (grok_op_properties): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. * decl2.c (constructor_name_full): Likewise. (arg_assoc_template_arg): Add TEMPLATE_TEMPLATE_PARM case. (arg_assoc_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. * error.c (dump_type): Split TEMPLATE_TEMPLATE_PARM case. (dump_type_prefix): Add BOUND_TEMPLATE_TEMPLATE_PARM. (dump_type_suffix): Likewise. * init.c (is_aggr_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. (get_aggr_from_typedef): Likewise. * mangle.c (write_type): Split TEMPLATE_TEMPLATE_PARM case. (write_expression): Add BOUND_TEMPLATE_TEMPLATE_PARM. (write_template_parm): Likewise. (write_template_template_parm): Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * method.c (build_overload_nested_name): Add BOUND_TEMPLATE_TEMPLATE_PARM. (process_overload_item): Split TEMPLATE_TEMPLATE_PARM case. * parse.y (bad_parm): Add BOUND_TEMPLATE_TEMPLATE_PARM. * pt.c (convert_template_argument): Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (for_each_template_parm_r): Split TEMPLATE_TEMPLATE_PARM case. (for_each_template_parm): Adjust comment. (tsubst): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize. (tsubst_copy): Add BOUND_TEMPLATE_TEMPLATE_PARM. (unify): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize. Use template_args_equal to compare template template parameter cases. * ptree.c (print_lang_type): Add BOUND_TEMPLATE_TEMPLATE_PARM. * search.c (lookup_field_1): Use BOUND_TEMPLATE_TEMPLATE_PARM instead. * tree.c (copy_template_template_parm): Decide whether to create a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM node. (walk_tree): Add BOUND_TEMPLATE_TEMPLATE_PARM. (copy_tree_r): Likewise. * typeck.c (comptypes): Likewise. Check tree code instead of using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. From-SVN: r36149
2000-09-05 03:01:39 +02:00
case BOUND_TEMPLATE_TEMPLATE_PARM:
1994-02-24 02:02:37 +01:00
case TREE_LIST:
case TYPE_DECL:
case TREE_VEC:
case UNION_TYPE:
case LANG_TYPE:
1994-02-24 02:02:37 +01:00
case VOID_TYPE:
case TYPENAME_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
case TYPEOF_TYPE:
c-common.c (struct c_common_resword): Add __underlying_type. /gcc 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * c-family/c-common.c (struct c_common_resword): Add __underlying_type. * c-family/c-common.h (enum rid): Add RID_UNDERLYING_TYPE. /cp 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * cp-tree.def: Add a new UNDERLYING_TYPE tree code. * cp-tree.h (enum cp_trait_kind): Add CPTK_UNDERLYING_TYPE, tidy. (UNDERLYING_TYPE_TYPE): Add. * cp-objcp-common.c (cp_common_init_ts): Mark UNDERLYING_TYPE as TS_COMMON. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword, cp_parser_simple_type_specifier): Handle UNDERLYING_TYPE. (cp_parser_trait_expr): Deal with RID_UNDERLYING_TYPE; tidy. * semantics.c (finish_underlying_type): New. * typeck.c (structural_comptypes): Handle UNDERLYING_TYPE. * error.c (dump_type, dump_type_prefix, dump_type_suffix): Likewise. * cxx-pretty-print.c (p_cxx_type_id): Likewise. * tree.c (cp_walk_subtrees): Likewise. * pt.c (for_each_template_parm_r, tsubst, unify, dependent_type_p_r): Likewise. * mangle.c (write_type): Sorry for __underlying_type. * doc/extend.texi: Document __underlying_type. /testsuite 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/ext/underlying_type1.C: New. * g++.dg/ext/underlying_type2.C: Likewise. * g++.dg/ext/underlying_type3.C: Likewise. * g++.dg/ext/underlying_type4.C: Likewise. * g++.dg/ext/underlying_type5.C: Likewise. * g++.dg/ext/underlying_type6.C: Likewise. * g++.dg/ext/underlying_type7.C: Likewise. * g++.dg/ext/underlying_type8.C: Likewise. * g++.dg/ext/underlying_type9.C: Likewise. * g++.dg/ext/underlying_type10.C: Likewise. From-SVN: r172943
2011-04-26 00:27:19 +02:00
case UNDERLYING_TYPE:
typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes. * cp-tree.def (DECLTYPE_TYPE): New. * error.c (dump_type): Dump DECLTYPE_TYPE nodes. (dump_type_prefix): Ditto. (dump_type_suffix): Ditto. * tree.c (DECLTYPE_TYPE): Walk DECLTYPE_TYPE nodes. * mangle.c (write_type): Handle DECLTYPE_TYPE. * cp-tree.h (IS_AGGR_TYPE): DECLTYPE_TYPE nodes can be aggregate types. (DECLTYPE_TYPE_EXPR): New. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): New. (finish_declared_type): Declare. * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Print DECLTYPE_TYPE nodes. (pp_cxx_type_id): Ditto. * pt.c (for_each_template_parm_r): Walk DECLTYPE_TYPE children. (tsubst): Substitute into a DECLTYPE_TYPE node. (tsubst_copy): Ditto. (unify): Cannot deduce anything from TYPEOF_TYPE or DECLTYPE_TYPE nodes. (dependent_type_p_r): DECLTYPE_TYPE types are always dependent. * semantics.c (finish_typeof): TYPEOF_TYPE types need to use structural equality (because we can't hash the expressions). (finish_declared_type): New. * lex.c (reswords): Add "decltype" keyword. * parser.c cp_lexer_next_token_is_decl_specifier_keyword (cp_parser_postfix_expression): Add member_access_only_p to restrict postfix expression to member access expressions. (cp_parser_unary_expression): Update call to cp_parser_postfix_expression to reflect new parameter. (cp_parser_declared_type): New. (cp_parser_simple_type_specifier): Parse decltype types. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * c-common.h (enum rid): Add RID_DECLTYPE, update RID_LAST_CXX0X. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/decltype1.C: New. * g++.dg/cpp0x/decltype2.C: New. * g++.dg/cpp0x/decltype3.C: New. * g++.dg/cpp0x/decltype4.C: New. * g++.dg/cpp0x/decltype5.C: New. * g++.dg/cpp0x/decltype6.C: New. From-SVN: r126991
2007-07-27 19:43:05 +02:00
case DECLTYPE_TYPE:
case TYPE_PACK_EXPANSION:
case FIXED_POINT_TYPE:
case NULLPTR_TYPE:
dump_type (pp, t, flags);
pp->padding = pp_before;
1994-02-24 02:02:37 +01:00
break;
1994-02-24 02:02:37 +01:00
default:
pp_unsupported_tree (pp, t);
/* fall through. */
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
case ERROR_MARK:
pp_string (pp, M_("<typeprefixerror>"));
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
break;
1994-02-24 02:02:37 +01:00
}
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* Dump the suffix of type T, under control of FLAGS. This is the part
which appears after the identifier (or function parms). */
1994-02-24 02:02:37 +01:00
static void
dump_type_suffix (cxx_pretty_printer *pp, tree t, int flags)
1994-02-24 02:02:37 +01:00
{
if (TYPE_PTRMEMFUNC_P (t))
t = TYPE_PTRMEMFUNC_FN_TYPE (t);
switch (TREE_CODE (t))
{
case POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
pp_cxx_right_paren (pp);
if (TREE_CODE (t) == POINTER_TYPE)
flags |= TFF_POINTER;
dump_type_suffix (pp, TREE_TYPE (t), flags);
1994-02-24 02:02:37 +01:00
break;
case FUNCTION_TYPE:
case METHOD_TYPE:
{
tree arg;
if (TREE_CODE (t) == METHOD_TYPE)
/* Can only be reached through a pointer. */
pp_cxx_right_paren (pp);
1994-02-24 02:02:37 +01:00
arg = TYPE_ARG_TYPES (t);
if (TREE_CODE (t) == METHOD_TYPE)
arg = TREE_CHAIN (arg);
/* Function pointers don't have default args. Not in standard C++,
anyway; they may in g++, but we'll just pretend otherwise. */
dump_parameters (pp, arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
pp->padding = pp_before;
pp_cxx_cv_qualifiers (pp, type_memfn_quals (t),
TREE_CODE (t) == FUNCTION_TYPE
&& (flags & TFF_POINTER));
dump_ref_qualifier (pp, t, flags);
Implement N4514, C++ Extensions for Transactional Memory. 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-10-04 21:17:19 +02:00
if (tx_safe_fn_type_p (t))
pp_cxx_ws_string (pp, "transaction_safe");
dump_exception_spec (pp, TYPE_RAISES_EXCEPTIONS (t), flags);
dump_type_suffix (pp, TREE_TYPE (t), flags);
1994-02-24 02:02:37 +01:00
break;
}
case ARRAY_TYPE:
pp_maybe_space (pp);
pp_cxx_left_bracket (pp);
PR c++/69251 - [6 Regression] ICE in unify_array_domain on a flexible array PR c++/69251 - [6 Regression] ICE in unify_array_domain on a flexible array member PR c++/69253 - [6 Regression] ICE in cxx_incomplete_type_diagnostic initializing a flexible array member with empty string PR c++/69290 - [6 Regression] ICE on invalid initialization of a flexible array member PR c++/69277 - [6 Regression] ICE mangling a flexible array member PR c++/69349 - template substitution error for flexible array members gcc/testsuite/ChangeLog: 2016-02-03 Martin Sebor <msebor@redhat.com> PR c++/69251 PR c++/69253 PR c++/69290 PR c++/69277 PR c++/69349 * g++.dg/ext/flexarray-mangle-2.C: New test. * g++.dg/ext/flexarray-mangle.C: New test. * g++.dg/ext/flexarray-subst.C: New test. * g++.dg/ext/flexary11.C: New test. * g++.dg/ext/flexary12.C: New test. * g++.dg/ext/flexary13.C: New test. * g++.dg/ext/flexary14.C: New test. * g++.dg/other/dump-ada-spec-2.C: Adjust. gcc/cp/ChangeLog: 2016-02-03 Martain Sebor <msebor@redhat.com> PR c++/69251 PR c++/69253 PR c++/69290 PR c++/69277 PR c++/69349 * class.c (walk_subobject_offsets): Avoid testing the upper bound of a flexible array member for equality to null. (find_flexarrays): Remove spurious whitespace introduced in r231665. (diagnose_flexarrays): Avoid checking the upper bound of arrays. (check_flexarrays): Same. * decl.c (compute_array_index_type): Avoid special case for flexible array members. (grokdeclarator): Avoid calling compute_array_index_type for flexible array members. * error.c (dump_type_suffix): Revert changes introduced in r231665 and rendered unnecessary by the changes above. * pt.c (tsubst): Same. * tree.c (build_ctor_subob_ref): Handle flexible array members. * typeck2.c (digest_init_r): Revert changes introduced in r231665. (process_init_constructor_array): Same. (process_init_constructor_record): Same. From-SVN: r233126
2016-02-04 05:50:42 +01:00
if (tree dtype = TYPE_DOMAIN (t))
{
tree max = TYPE_MAX_VALUE (dtype);
PR c++/69251 - [6 Regression] ICE in unify_array_domain on a flexible array PR c++/69251 - [6 Regression] ICE in unify_array_domain on a flexible array member PR c++/69253 - [6 Regression] ICE in cxx_incomplete_type_diagnostic initializing a flexible array member with empty string PR c++/69290 - [6 Regression] ICE on invalid initialization of a flexible array member PR c++/69277 - [6 Regression] ICE mangling a flexible array member PR c++/69349 - template substitution error for flexible array members gcc/testsuite/ChangeLog: 2016-02-03 Martin Sebor <msebor@redhat.com> PR c++/69251 PR c++/69253 PR c++/69290 PR c++/69277 PR c++/69349 * g++.dg/ext/flexarray-mangle-2.C: New test. * g++.dg/ext/flexarray-mangle.C: New test. * g++.dg/ext/flexarray-subst.C: New test. * g++.dg/ext/flexary11.C: New test. * g++.dg/ext/flexary12.C: New test. * g++.dg/ext/flexary13.C: New test. * g++.dg/ext/flexary14.C: New test. * g++.dg/other/dump-ada-spec-2.C: Adjust. gcc/cp/ChangeLog: 2016-02-03 Martain Sebor <msebor@redhat.com> PR c++/69251 PR c++/69253 PR c++/69290 PR c++/69277 PR c++/69349 * class.c (walk_subobject_offsets): Avoid testing the upper bound of a flexible array member for equality to null. (find_flexarrays): Remove spurious whitespace introduced in r231665. (diagnose_flexarrays): Avoid checking the upper bound of arrays. (check_flexarrays): Same. * decl.c (compute_array_index_type): Avoid special case for flexible array members. (grokdeclarator): Avoid calling compute_array_index_type for flexible array members. * error.c (dump_type_suffix): Revert changes introduced in r231665 and rendered unnecessary by the changes above. * pt.c (tsubst): Same. * tree.c (build_ctor_subob_ref): Handle flexible array members. * typeck2.c (digest_init_r): Revert changes introduced in r231665. (process_init_constructor_array): Same. (process_init_constructor_record): Same. From-SVN: r233126
2016-02-04 05:50:42 +01:00
/* Zero-length arrays have an upper bound of SIZE_MAX. */
if (integer_all_onesp (max))
pp_character (pp, '0');
cuintp.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/ada/ * gcc-interface/cuintp.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/c-family/ * c-ada-spec.c, c-common.c, c-format.c, c-pretty-print.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/c/ * c-parser.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/cp/ * error.c, init.c, parser.c, semantics.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/go/ * gofrontend/expressions.cc: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/java/ * class.c, expr.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/ * builtins.c, config/alpha/alpha.c, config/c6x/predicates.md, config/ia64/predicates.md, config/iq2000/iq2000.c, config/mips/mips.c, config/s390/s390.c, dbxout.c, dwarf2out.c, except.c, explow.c, expr.c, expr.h, fold-const.c, gimple-fold.c, gimple-ssa-strength-reduction.c, gimple.c, godump.c, graphite-scop-detection.c, graphite-sese-to-poly.c, omp-low.c, predict.c, rtlanal.c, sdbout.c, simplify-rtx.c, stor-layout.c, tree-data-ref.c, tree-dfa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-alias.c, tree-ssa-forwprop.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c, tree-ssa-math-opts.c, tree-ssa-phiopt.c, tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-vect-data-refs.c, tree-vect-patterns.c, tree-vectorizer.h, tree.c, var-tracking.c, varasm.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. From-SVN: r204955
2013-11-18 15:51:10 +01:00
else if (tree_fits_shwi_p (max))
pp_wide_integer (pp, tree_to_shwi (max) + 1);
else
{
STRIP_NOPS (max);
if (TREE_CODE (max) == SAVE_EXPR)
max = TREE_OPERAND (max, 0);
if (TREE_CODE (max) == MINUS_EXPR
|| TREE_CODE (max) == PLUS_EXPR)
{
max = TREE_OPERAND (max, 0);
while (CONVERT_EXPR_P (max))
max = TREE_OPERAND (max, 0);
}
else
max = fold_build2_loc (input_location,
PLUS_EXPR, dtype, max,
build_int_cst (dtype, 1));
dump_expr (pp, max, flags & ~TFF_EXPR_IN_PARENS);
}
}
pp_cxx_right_bracket (pp);
dump_type_suffix (pp, TREE_TYPE (t), flags);
1994-02-24 02:02:37 +01:00
break;
1994-02-24 02:02:37 +01:00
case ENUMERAL_TYPE:
case IDENTIFIER_NODE:
case INTEGER_TYPE:
case BOOLEAN_TYPE:
1994-02-24 02:02:37 +01:00
case REAL_TYPE:
case RECORD_TYPE:
case TEMPLATE_TYPE_PARM:
pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Wed Jan 21 10:29:57 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> * pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. Substitute default arguments in template template arguments. Correctly convert TEMPLATE_DECL to TEMPLATE_TEMPLATE_PARM. (comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM are no longer treated specially here. * parse.y (template_template_parm): Fix copy error. * decl.c (grokdeclarator): Warn about missing `typename' for nested type created from template template parameters. * parse.y (bad_parm): Likewise * class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM. (push_nested_class): Likewise. * cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code. * cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro. (copy_template_template_parm): Declare. * decl.c (arg_looking_for_template): New variable. (lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM. Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM node if arg_looking_for_template is nonzero. (pushdecl): Handle TEMPLATE_TEMPLATE_PARM. (grok_op_properties, xref_tag, xref_basetypes): Likewise. (grokdeclarator): Handle TEMPLATE_DECL. * decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM. * error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (dump_type_prefix, dump_type_suffix) Handle TEMPLATE_TEMPLATE_PARM. (dump_decl): Handle unnamed template type parameters. Handle template template parameters. (dump_function_name): Handle template template parameters. * init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef): Handle TEMPLATE_TEMPLATE_PARM. * method.c (build_template_template_parm_names): New function. (build_template_parm_names): Handle TEMPLATE_DECL. (build_overload_nested_name, build_overload_name): Handle TEMPLATE_TEMPLATE_PARM. * parse.y (maybe_identifier): New nonterminal. (template_type_parm): Use it. (template_template_parm, template_arg1): New nonterminal. (template_parm): Add template_template_parm rules. (template_arg): Set processing_template_arg. (template_arg1): Rules moved from template_arg. (primary, nonnested_type): Set arg_looking_for_template if we are processing template arguments. * pt.c (begin_member_template_processing): Handle TEMPLATE_DECL. (process_template_parm): Handle template template parameters. (coerce_template_parms, comp_template_args): Likewise. (mangle_class_name_for_template, lookup_template_class): Likewise. (uses_template_parms): Handle TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. (current_template_args): Handle TEMPLATE_DECL. (tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM. * search.c (dfs_walk, dfs_record_inheritance): Handle TEMPLATE_TEMPLATE_PARM. * tree.c (copy_template_template_parm): New function. (mapcar): Handle TEMPLATE_TEMPLATE_PARM. * typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM. From-SVN: r17441
1998-01-22 12:03:56 +01:00
case TEMPLATE_TEMPLATE_PARM:
2000-09-05 05:52:27 +02:00
case BOUND_TEMPLATE_TEMPLATE_PARM:
1994-02-24 02:02:37 +01:00
case TREE_LIST:
case TYPE_DECL:
case TREE_VEC:
case UNION_TYPE:
case LANG_TYPE:
1994-02-24 02:02:37 +01:00
case VOID_TYPE:
case TYPENAME_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
case TYPEOF_TYPE:
c-common.c (struct c_common_resword): Add __underlying_type. /gcc 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * c-family/c-common.c (struct c_common_resword): Add __underlying_type. * c-family/c-common.h (enum rid): Add RID_UNDERLYING_TYPE. /cp 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * cp-tree.def: Add a new UNDERLYING_TYPE tree code. * cp-tree.h (enum cp_trait_kind): Add CPTK_UNDERLYING_TYPE, tidy. (UNDERLYING_TYPE_TYPE): Add. * cp-objcp-common.c (cp_common_init_ts): Mark UNDERLYING_TYPE as TS_COMMON. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword, cp_parser_simple_type_specifier): Handle UNDERLYING_TYPE. (cp_parser_trait_expr): Deal with RID_UNDERLYING_TYPE; tidy. * semantics.c (finish_underlying_type): New. * typeck.c (structural_comptypes): Handle UNDERLYING_TYPE. * error.c (dump_type, dump_type_prefix, dump_type_suffix): Likewise. * cxx-pretty-print.c (p_cxx_type_id): Likewise. * tree.c (cp_walk_subtrees): Likewise. * pt.c (for_each_template_parm_r, tsubst, unify, dependent_type_p_r): Likewise. * mangle.c (write_type): Sorry for __underlying_type. * doc/extend.texi: Document __underlying_type. /testsuite 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/ext/underlying_type1.C: New. * g++.dg/ext/underlying_type2.C: Likewise. * g++.dg/ext/underlying_type3.C: Likewise. * g++.dg/ext/underlying_type4.C: Likewise. * g++.dg/ext/underlying_type5.C: Likewise. * g++.dg/ext/underlying_type6.C: Likewise. * g++.dg/ext/underlying_type7.C: Likewise. * g++.dg/ext/underlying_type8.C: Likewise. * g++.dg/ext/underlying_type9.C: Likewise. * g++.dg/ext/underlying_type10.C: Likewise. From-SVN: r172943
2011-04-26 00:27:19 +02:00
case UNDERLYING_TYPE:
typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes. * cp-tree.def (DECLTYPE_TYPE): New. * error.c (dump_type): Dump DECLTYPE_TYPE nodes. (dump_type_prefix): Ditto. (dump_type_suffix): Ditto. * tree.c (DECLTYPE_TYPE): Walk DECLTYPE_TYPE nodes. * mangle.c (write_type): Handle DECLTYPE_TYPE. * cp-tree.h (IS_AGGR_TYPE): DECLTYPE_TYPE nodes can be aggregate types. (DECLTYPE_TYPE_EXPR): New. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): New. (finish_declared_type): Declare. * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Print DECLTYPE_TYPE nodes. (pp_cxx_type_id): Ditto. * pt.c (for_each_template_parm_r): Walk DECLTYPE_TYPE children. (tsubst): Substitute into a DECLTYPE_TYPE node. (tsubst_copy): Ditto. (unify): Cannot deduce anything from TYPEOF_TYPE or DECLTYPE_TYPE nodes. (dependent_type_p_r): DECLTYPE_TYPE types are always dependent. * semantics.c (finish_typeof): TYPEOF_TYPE types need to use structural equality (because we can't hash the expressions). (finish_declared_type): New. * lex.c (reswords): Add "decltype" keyword. * parser.c cp_lexer_next_token_is_decl_specifier_keyword (cp_parser_postfix_expression): Add member_access_only_p to restrict postfix expression to member access expressions. (cp_parser_unary_expression): Update call to cp_parser_postfix_expression to reflect new parameter. (cp_parser_declared_type): New. (cp_parser_simple_type_specifier): Parse decltype types. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * c-common.h (enum rid): Add RID_DECLTYPE, update RID_LAST_CXX0X. 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/decltype1.C: New. * g++.dg/cpp0x/decltype2.C: New. * g++.dg/cpp0x/decltype3.C: New. * g++.dg/cpp0x/decltype4.C: New. * g++.dg/cpp0x/decltype5.C: New. * g++.dg/cpp0x/decltype6.C: New. From-SVN: r126991
2007-07-27 19:43:05 +02:00
case DECLTYPE_TYPE:
case TYPE_PACK_EXPANSION:
case FIXED_POINT_TYPE:
case NULLPTR_TYPE:
1994-02-24 02:02:37 +01:00
break;
default:
pp_unsupported_tree (pp, t);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
case ERROR_MARK:
/* Don't mark it here, we should have already done in
dump_type_prefix. */
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
break;
1994-02-24 02:02:37 +01:00
}
}
static void
dump_global_iord (cxx_pretty_printer *pp, tree t)
1994-02-24 02:02:37 +01:00
{
const char *p = NULL;
1994-02-24 02:02:37 +01:00
Compute DECL_ASSEMBLER_NAME lazily. * tree.h (DECL_ASSEMBLER_NAME): Compute it lazily. (DECL_ASSEMBLER_NAME_SET_P): New macro. (SET_DECL_ASSEMBLER_NAME): Likewise. (COPY_DECL_ASSEMBLER_NAME): Likewise. (set_decl_assembler_name): Declare. (lang_set_decl_assembler_name): Likewise. * tree.c (lang_set_decl_assembler_name): New variab.e (set_decl_assembler_name): New function. (init_obstacks): Set lang_set_decl_assembler_name. (build_decl): Don't set DECL_ASSEMBLER_NAME. * c-decl.c (duplicate_decls): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (builtin_function): Likewise. (finish_decl): Likewise. * dbxout.c (dbxout_type_methods): Likewise. * ggc-common.c (ggc_mark_trees): Likewise. * profile.c (output_func_start_profiler): Likewise. * varasm.c (make_decl_rtl): Likewise. * class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (add_method): Remove optimization involving comparison of DECL_ASSEMBLER_NAME. (build_vtbl_or_vbase_field): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (check_methods): Likewise. (build_clone): Likewise. (built_vtt): Likewise. * cp-tree.h (DECL_NEEDED_P): Likewise. * decl.c (pushtag): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (builtin_function): Likewise. (build_library_fn_1): Set DECL_LANGUAGE for library functions. (build_cp_library_fn): Likewise. (maybe_commonize_var): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (make_rtl_for_nonlocal_decl): Likewise. (cp_finish_decl): Likewise. (grokfndecl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (start_function): Likewise. (cp_missing_return_ok_p): Likewise. * decl2.c (grokclassfn): Likewise. (check_classfn): Likewise. (finish_static_data_member_decl): Likewise. (grokfield): Likewise. * error.c (GLOBAL_IORD_P): Remove. (dump_global_iord): Improve output. (dump_decl): Avoid using DECL_ASSEMBLER_NAME. * except.c (nothrow_libfn_p): Summarily reject any function not in namespace-scope. * init.c (build_java_class_ref): Don't explicitly set DECL_ASSEMBLER_NAME after calling mangle_decl. * mangle.c (mangle_decl_string): Handle extern "C" functions. (mangle_decl): Set the DECL_ASSEMBLER_NAME for the decl. * method.c (set_mangled_name_for_decl): Don't explicitly set DECL_ASSEMBLER_NAME after calling mangle_decl. (make_thunk): Explicitly set the DECL_ASSEMBLER_NAME and IDENTIFIER_GLOBAL_VALUE for the thunk. * pt.c (set_mangled_name_for_template_decl): Remove. (check_explicit_specialization): Don't use it. (looup_template_class): Don't set DECL_ASSEMBLER_NAME. (tsubst_friend_function): Likewise. (tsubst_decl): Likewise. (regenerate_decl_from_template): Use COPY_DECL_ASSEMBLER_NAME. * rtti.c (get_tinfo_decl): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (tinfo_base_init): Likewise. (create_real_tinfo_var): Likewise. * search.c (looup_field_1): Likewise. * semantics.c (finish_named_return_value): Likewise. * tree.c (init_tree): Set lang_set_decl_assembler_name. * com.c (builtin_function): Use SET_DECL_ASSEMBLER_NAME. * class.c (build_class_ref): Use SET_DECL_ASSEMBLER_NAME. (layout_class): Likewise. (layout_class_method): Likewise. (emit_register_classes): Likewise. * decl.c (builtin_function): Likewise. (give_name_to_locals): Likewise. From-SVN: r40642
2001-03-20 00:50:04 +01:00
if (DECL_GLOBAL_CTOR_P (t))
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
p = M_("(static initializers for %s)");
Compute DECL_ASSEMBLER_NAME lazily. * tree.h (DECL_ASSEMBLER_NAME): Compute it lazily. (DECL_ASSEMBLER_NAME_SET_P): New macro. (SET_DECL_ASSEMBLER_NAME): Likewise. (COPY_DECL_ASSEMBLER_NAME): Likewise. (set_decl_assembler_name): Declare. (lang_set_decl_assembler_name): Likewise. * tree.c (lang_set_decl_assembler_name): New variab.e (set_decl_assembler_name): New function. (init_obstacks): Set lang_set_decl_assembler_name. (build_decl): Don't set DECL_ASSEMBLER_NAME. * c-decl.c (duplicate_decls): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (builtin_function): Likewise. (finish_decl): Likewise. * dbxout.c (dbxout_type_methods): Likewise. * ggc-common.c (ggc_mark_trees): Likewise. * profile.c (output_func_start_profiler): Likewise. * varasm.c (make_decl_rtl): Likewise. * class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (add_method): Remove optimization involving comparison of DECL_ASSEMBLER_NAME. (build_vtbl_or_vbase_field): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (check_methods): Likewise. (build_clone): Likewise. (built_vtt): Likewise. * cp-tree.h (DECL_NEEDED_P): Likewise. * decl.c (pushtag): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (builtin_function): Likewise. (build_library_fn_1): Set DECL_LANGUAGE for library functions. (build_cp_library_fn): Likewise. (maybe_commonize_var): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (make_rtl_for_nonlocal_decl): Likewise. (cp_finish_decl): Likewise. (grokfndecl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (start_function): Likewise. (cp_missing_return_ok_p): Likewise. * decl2.c (grokclassfn): Likewise. (check_classfn): Likewise. (finish_static_data_member_decl): Likewise. (grokfield): Likewise. * error.c (GLOBAL_IORD_P): Remove. (dump_global_iord): Improve output. (dump_decl): Avoid using DECL_ASSEMBLER_NAME. * except.c (nothrow_libfn_p): Summarily reject any function not in namespace-scope. * init.c (build_java_class_ref): Don't explicitly set DECL_ASSEMBLER_NAME after calling mangle_decl. * mangle.c (mangle_decl_string): Handle extern "C" functions. (mangle_decl): Set the DECL_ASSEMBLER_NAME for the decl. * method.c (set_mangled_name_for_decl): Don't explicitly set DECL_ASSEMBLER_NAME after calling mangle_decl. (make_thunk): Explicitly set the DECL_ASSEMBLER_NAME and IDENTIFIER_GLOBAL_VALUE for the thunk. * pt.c (set_mangled_name_for_template_decl): Remove. (check_explicit_specialization): Don't use it. (looup_template_class): Don't set DECL_ASSEMBLER_NAME. (tsubst_friend_function): Likewise. (tsubst_decl): Likewise. (regenerate_decl_from_template): Use COPY_DECL_ASSEMBLER_NAME. * rtti.c (get_tinfo_decl): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (tinfo_base_init): Likewise. (create_real_tinfo_var): Likewise. * search.c (looup_field_1): Likewise. * semantics.c (finish_named_return_value): Likewise. * tree.c (init_tree): Set lang_set_decl_assembler_name. * com.c (builtin_function): Use SET_DECL_ASSEMBLER_NAME. * class.c (build_class_ref): Use SET_DECL_ASSEMBLER_NAME. (layout_class): Likewise. (layout_class_method): Likewise. (emit_register_classes): Likewise. * decl.c (builtin_function): Likewise. (give_name_to_locals): Likewise. From-SVN: r40642
2001-03-20 00:50:04 +01:00
else if (DECL_GLOBAL_DTOR_P (t))
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
p = M_("(static destructors for %s)");
1994-02-24 02:02:37 +01:00
else
call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. * call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. From-SVN: r86778
2004-08-30 17:28:48 +02:00
gcc_unreachable ();
pp_printf (pp, p, DECL_SOURCE_FILE (t));
1994-02-24 02:02:37 +01:00
}
static void
dump_simple_decl (cxx_pretty_printer *pp, tree t, tree type, int flags)
{
if (flags & TFF_DECL_SPECIFIERS)
{
if (VAR_P (t) && DECL_DECLARED_CONSTEXPR_P (t))
{
if (DECL_LANG_SPECIFIC (t) && DECL_DECLARED_CONCEPT_P (t))
pp_cxx_ws_string (pp, "concept");
else
pp_cxx_ws_string (pp, "constexpr");
}
dump_type_prefix (pp, type, flags & ~TFF_UNQUALIFIED_NAME);
pp_maybe_space (pp);
}
if (! (flags & TFF_UNQUALIFIED_NAME)
&& TREE_CODE (t) != PARM_DECL
&& (!DECL_INITIAL (t)
|| TREE_CODE (DECL_INITIAL (t)) != TEMPLATE_PARM_INDEX))
dump_scope (pp, CP_DECL_CONTEXT (t), flags);
flags &= ~TFF_UNQUALIFIED_NAME;
if ((flags & TFF_DECL_SPECIFIERS)
&& DECL_TEMPLATE_PARM_P (t)
&& TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (t)))
pp_string (pp, "...");
if (DECL_NAME (t))
{
if (TREE_CODE (t) == FIELD_DECL && DECL_NORMAL_CAPTURE_P (t))
{
pp_less (pp);
pp_string (pp, IDENTIFIER_POINTER (DECL_NAME (t)) + 2);
pp_string (pp, " capture>");
}
else
dump_decl (pp, DECL_NAME (t), flags);
}
else
pp_string (pp, M_("<anonymous>"));
if (flags & TFF_DECL_SPECIFIERS)
dump_type_suffix (pp, type, flags);
}
/* Print an IDENTIFIER_NODE that is the name of a declaration. */
static void
dump_decl_name (cxx_pretty_printer *pp, tree t, int flags)
{
/* These special cases are duplicated here so that other functions
can feed identifiers to error and get them demangled properly. */
if (IDENTIFIER_TYPENAME_P (t))
{
pp_cxx_ws_string (pp, "operator");
/* Not exactly IDENTIFIER_TYPE_VALUE. */
dump_type (pp, TREE_TYPE (t), flags);
return;
}
if (dguide_name_p (t))
{
dump_decl (pp, CLASSTYPE_TI_TEMPLATE (TREE_TYPE (t)),
TFF_UNQUALIFIED_NAME);
return;
}
const char *str = IDENTIFIER_POINTER (t);
if (!strncmp (str, "_ZGR", 3))
{
pp_cxx_ws_string (pp, "<temporary>");
return;
}
pp_cxx_tree_identifier (pp, t);
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* Dump a human readable string for the decl T under control of FLAGS. */
1994-02-24 02:02:37 +01:00
static void
dump_decl (cxx_pretty_printer *pp, tree t, int flags)
1994-02-24 02:02:37 +01:00
{
if (t == NULL_TREE)
return;
In gcc/cp/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/cp/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> Removed Objective-C++ specific replacement of cxx_printable_name. * cp-objcp-common.h: Added LANG_HOOKS_DECL_PRINTABLE_NAME, set to cxx_printable_name for both C++ and Objective-C++. * cp-lang.h: Removed LANG_HOOKS_DECL_PRINTABLE_NAME. * error.c (dump_decl): For Objective-C++, call objc_maybe_printable_name here ... * tree.c (cxx_printable_name_internal): ... instead of here. In gcc/objcp/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> * objcp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Do not define. In gcc/objc/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_build_keyword_decl): Updated comments. Do not emit a warning that method parameter attributes are unimplemented. Instead, store them into DECL_ATTRIBUTES of the KEYWORD_DECL. (start_method_def): Copy attributes from each KEYWORD_DECL into the corresponding PARM_DECL. (objc_warn_deprecated_use): Removed. (build_objc_method_call): Call warn_deprecated_use, not objc_warn_deprecated_use. (objc_maybe_printable_name): Do not try to get the identifier name of DECLs that we don't recognize. Immediately return NULL for them. (objc_printable_name): Removed C++-specific case, which is no longer used. Updated comments. In gcc/testsuite/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/attributes/method-attribute-2.m: Updated test. Method parameter attributes are now supported. * obj-c++.dg/attributes/method-attribute-2.m: Same change. * objc.dg/attributes/parameter-attribute-1.m: New test. * objc.dg/attributes/parameter-attribute-2.m: New test. * obj-c++.dg/attributes/parameter-attribute-1.m: New test. * obj-c++.dg/attributes/parameter-attribute-2.m: New test. From-SVN: r165896
2010-10-24 04:44:03 +02:00
/* If doing Objective-C++, give Objective-C a chance to demangle
Objective-C method names. */
if (c_dialect_objc ())
{
const char *demangled = objc_maybe_printable_name (t, flags);
if (demangled)
{
pp_string (pp, demangled);
In gcc/cp/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/cp/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> Removed Objective-C++ specific replacement of cxx_printable_name. * cp-objcp-common.h: Added LANG_HOOKS_DECL_PRINTABLE_NAME, set to cxx_printable_name for both C++ and Objective-C++. * cp-lang.h: Removed LANG_HOOKS_DECL_PRINTABLE_NAME. * error.c (dump_decl): For Objective-C++, call objc_maybe_printable_name here ... * tree.c (cxx_printable_name_internal): ... instead of here. In gcc/objcp/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> * objcp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Do not define. In gcc/objc/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_build_keyword_decl): Updated comments. Do not emit a warning that method parameter attributes are unimplemented. Instead, store them into DECL_ATTRIBUTES of the KEYWORD_DECL. (start_method_def): Copy attributes from each KEYWORD_DECL into the corresponding PARM_DECL. (objc_warn_deprecated_use): Removed. (build_objc_method_call): Call warn_deprecated_use, not objc_warn_deprecated_use. (objc_maybe_printable_name): Do not try to get the identifier name of DECLs that we don't recognize. Immediately return NULL for them. (objc_printable_name): Removed C++-specific case, which is no longer used. Updated comments. In gcc/testsuite/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/attributes/method-attribute-2.m: Updated test. Method parameter attributes are now supported. * obj-c++.dg/attributes/method-attribute-2.m: Same change. * objc.dg/attributes/parameter-attribute-1.m: New test. * objc.dg/attributes/parameter-attribute-2.m: New test. * obj-c++.dg/attributes/parameter-attribute-1.m: New test. * obj-c++.dg/attributes/parameter-attribute-2.m: New test. From-SVN: r165896
2010-10-24 04:44:03 +02:00
return;
}
}
1994-02-24 02:02:37 +01:00
switch (TREE_CODE (t))
{
case TYPE_DECL:
/* Don't say 'typedef class A' */
if (DECL_ARTIFICIAL (t) && !DECL_SELF_REFERENCE_P (t))
{
if ((flags & TFF_DECL_SPECIFIERS)
&& TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
{
/* Say `class T' not just `T'. */
pp_cxx_ws_string (pp, "class");
/* Emit the `...' for a parameter pack. */
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
pp_cxx_ws_string (pp, "...");
}
dump_type (pp, TREE_TYPE (t), flags);
break;
}
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
if (TYPE_DECL_ALIAS_P (t)
&& (flags & TFF_DECL_SPECIFIERS
|| flags & TFF_CLASS_KEY_OR_ENUM))
{
pp_cxx_ws_string (pp, "using");
dump_decl (pp, DECL_NAME (t), flags);
pp_cxx_whitespace (pp);
pp_cxx_ws_string (pp, "=");
pp_cxx_whitespace (pp);
dump_type (pp, (DECL_ORIGINAL_TYPE (t)
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t)),
flags);
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
break;
}
if ((flags & TFF_DECL_SPECIFIERS)
&& !DECL_SELF_REFERENCE_P (t))
pp_cxx_ws_string (pp, "typedef");
dump_simple_decl (pp, t, DECL_ORIGINAL_TYPE (t)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t),
flags);
break;
1994-02-24 02:02:37 +01:00
case VAR_DECL:
if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t)))
1994-02-24 02:02:37 +01:00
{
pp_string (pp, M_("vtable for "));
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (TYPE_P (DECL_CONTEXT (t)));
dump_type (pp, DECL_CONTEXT (t), flags);
1994-02-24 02:02:37 +01:00
break;
}
re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) 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-12 12:30:47 +02:00
/* Fall through. */
1994-02-24 02:02:37 +01:00
case FIELD_DECL:
case PARM_DECL:
dump_simple_decl (pp, t, TREE_TYPE (t), flags);
/* Handle variable template specializations. */
if (VAR_P (t)
&& DECL_LANG_SPECIFIC (t)
&& DECL_TEMPLATE_INFO (t)
&& PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t)))
{
pp_cxx_begin_template_argument_list (pp);
tree args = INNERMOST_TEMPLATE_ARGS (DECL_TI_ARGS (t));
dump_template_argument_list (pp, args, flags);
pp_cxx_end_template_argument_list (pp);
}
1994-02-24 02:02:37 +01:00
break;
case RESULT_DECL:
pp_string (pp, M_("<return value> "));
dump_simple_decl (pp, t, TREE_TYPE (t), flags);
break;
case NAMESPACE_DECL:
if (flags & TFF_DECL_SPECIFIERS)
c-pretty-print.h (c_pretty_printer::declaration): Now a virtual member function. c-family/ * c-pretty-print.h (c_pretty_printer::declaration): Now a virtual member function. (c_pretty_printer::declaration_specifiers): Likewise. (c_pretty_printer::declarator): Likewise. (c_pretty_printer::abstract_declarator): Likewise. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::direct_declarator): Likewise. (c_pretty_printer::function_specifier): Likewise. (pp_declaration): Adjust. (pp_declaration_specifiers): Likewise. (pp_abstract_declarator): Likewise. (pp_direct_declarator): Likewise. (pp_function_specifier): Likewise. (pp_direct_abstract_declarator): Remove as unused. (pp_c_declaration): Remove. (pp_c_declaration_specifiers): Likewise. (pp_c_declarator): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_function_specifier): Likewise. (pp_c_direct_abstract_declarator): Likewise. * c-pretty-print.c (c_pretty_printer::abstract_declarator): Rename from pp_c_abstract_declarator. Adjust. (c_pretty_printer::direct_abstract_declarator): Rename from pp_c_direct_abstract_declarator. Adjust. (c_pretty_printer::function_specifier): Rename from pp_c_function_specifier. Adjust. (c_pretty_printer::declaration_specifiers): Rename from pp_c_declaration_specifiers. Adjust. (c_pretty_printer::direct_declarator): Rename from pp_c_direct_declarator. Adjust. (c_pretty_printer::declarator): Rename from pp_c_declarator. Adjust. (c_pretty_printer::declaration): Rename from pp_c_declaration. Adjust. (c_pretty_printer::c_pretty_printer): Do not assign to declaration, declaration_specifiers, declarator, direct_declarator, direct_abstract_declarator, function_specifier. cp/ * cxx-pretty-print.h (cxx_pretty_printer::declaration): Declare as overrider. (cxx_pretty_printer::declaration_specifiers): Likewise. (cxx_pretty_printer::function_specifier): Likewise. (cxx_pretty_printer::declarator): Likewise. (cxx_pretty_printer::direct_declarator): Likewise. (cxx_pretty_printer::abstract_declarator): Likewise. (cxx_pretty_printer::direct_abstract_declarator): Likewise. (pp_cxx_declaration): Remove. * cxx-pretty-print.c (cxx_pretty_printer::function_specifier): Rename from pp_cxx_function_specifier. Adjust. (cxx_pretty_printer::declaration_specifiers): Rename from pp_cxx_decl_specifier_seq. Adjust. (cxx_pretty_printer::direct_declarator): Rename from pp_cxx_direct_declarator. Adjust. (cxx_pretty_printer::declarator): Rename from pp_cxx_declarator. Adjust. (cxx_pretty_printer::abstract_declarator): Rename from pp_cxx_abstract_declarator. Adjust. (cxx_pretty_printer::direct_abstract_declarator): Rename from pp_cxx_direct_abstract_declarator. Adjust. (cxx_pretty_printer::declaration): Rename from pp_cxx_declaration. Adjust. (cxx_pretty_printer::cxx_pretty_printer): Do not assign to declaration, declaration_specifiers, function_specifier, declarator, direct_declarator, abstract_declarator, direct_abstract_declarator. * error.c (dump_decl): Adjust. From-SVN: r202109
2013-08-30 17:28:51 +02:00
pp->declaration (t);
else
{
if (! (flags & TFF_UNQUALIFIED_NAME))
dump_scope (pp, CP_DECL_CONTEXT (t), flags);
flags &= ~TFF_UNQUALIFIED_NAME;
if (DECL_NAME (t) == NULL_TREE)
{
if (!(pp->flags & pp_c_flag_gnu_v3))
pp_cxx_ws_string (pp, M_("{anonymous}"));
else
pp_cxx_ws_string (pp, M_("(anonymous namespace)"));
}
else
pp_cxx_tree_identifier (pp, DECL_NAME (t));
}
break;
case SCOPE_REF:
dump_type (pp, TREE_OPERAND (t, 0), flags);
pp_colon_colon (pp);
dump_decl (pp, TREE_OPERAND (t, 1), TFF_UNQUALIFIED_NAME);
break;
1994-02-24 02:02:37 +01:00
case ARRAY_REF:
dump_decl (pp, TREE_OPERAND (t, 0), flags);
pp_cxx_left_bracket (pp);
dump_decl (pp, TREE_OPERAND (t, 1), flags);
pp_cxx_right_bracket (pp);
1994-02-24 02:02:37 +01:00
break;
Implemented Cilk Plus Array Notation for C++ Implemented Cilk Plus Array Notation for C++ gcc/c-family/ChangeLog 2013-06-21 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-common.h (struct cilkplus_an_parts): New structure. (struct cilkplus_an_loop_parts): Likewise. (cilkplus_extract_an_triplets): New prototype. (fix_sec_implicit_args): Likewise. * array-notation-common.c (cilkplus_extract_an_triplets): New function. (fix_sec_implicit_args): Likewise. gcc/cp/ChangeLog 2013-06-21 Balaji V. Iyer <balaji.v.iyer@intel.com> * call.c (convert_like_real): Added a check if array notation is present in expression. If so, then no conversion of arguments is necessary. (build_over_call): Likewise. * typeck.c (cp_build_function_call_vec): Likewise. (convert_for_assignment): Likewise. (cp_build_array_ref): Reject array notations with a rank greater than 1 as an array's index. (cp_build_binary_op): If array notations are preent in op, then call find_correct_array_notation_type. (cp_build_addr_expr_1): Handle ARRAY_NOTATION_REF similar to ARRAY_REF. * cp-array-notation.c: New file. * cp-objcp-common.c (cp_common_init_ts): Marked ARRAY_NOTATION_REF tree as typed. * cp-tree.h (fix_array_notation_exprs): New prototype. * semantics.c (finish_return_stmt): Reject array notations as return value. (cxx_eval_constant_expression): Added ARRAY_NOTATION_REF case. (potential_constant_expression_1): Likewise. * tree.c (lvalue_kind): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Likewise. * pt.c (ARRAY_NOTATION_REF): Likewise. (type_unification_real): Do not unify any arguments if array notations are found in arg. (instantiate_decl): Added a check for array notaitons inside the function body. If so, then expand them. * parser.c (cp_parser_array_notation): New function. (cp_parser_postfix_open_square_expression): Added a check for colons inside square braces. If found, then handle the array access as an array notation access. Also, disable auto-correction from a single colon to scope when Cilk Plus is enabled. (cp_parser_compound_statement): Added a check for array notations inside the statement. If found, then expand them. (cp_parser_ctor_initializer_opt_and_function_body): Likewise. (cp_parser_function_definition_after_declarator): Likewise. (cp_parser_selection_statement): Searched for array notations inside condition. If so, then emit an error. (cp_parser_iteration_statement): Likewise. (cp_parser_direct_declarator): Reject array notations inside a variable or array declaration. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Added cp/cp-array-notation.o. gcc/testsuite/ChangeLog 2013-06-21 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-c++-common/cilk-plus/AN/array_test1.c: Make this an execution test. Also changed the returns from error as distinct values so that debugging can get easier. * c-c++-common/cilk-plus/AN/if_test_errors.c (main): Made certain errors specific to C, if necessary. Also added new error hooks for C++. * c-c++-common/cilk-plus/AN/misc.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors2.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors3.c (main): Likewise. * c-c++-common/cilk-plus/AN/pr57541.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors4.c (main): In addition to the same changes as parser_errors3.c, spaces were added between colons to not confuse C++ compiler with 2 colons as scope. * c-c++-common/cilk-plus/AN/vla.c: Make this test C specific. * g++.dg/cilk-plus/AN/array_test1_tplt.cc: New test. * g++.dg/cilk-plus/AN/array_test2_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/array_test_ND_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/braced_list.cc: Likewise. * g++.dg/cilk-plus/AN/builtin_fn_custom_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/fp_triplet_values_tplt.c: Likewise. * g++.dg/cilk-plus/AN/preincr_test.cc: Likewise. * g++.dg/cilk-plus/AN/postincr_test.cc: Likewise. * g++.dg/cilk-plus/cilk-plus.exp: New script. * gcc/testsuite/g++.dg/dg.exp: Included Cilk Plus C++ tests in the list. From-SVN: r200319
2013-06-21 21:36:47 +02:00
case ARRAY_NOTATION_REF:
dump_decl (pp, ARRAY_NOTATION_ARRAY (t), flags | TFF_EXPR_IN_PARENS);
pp_cxx_left_bracket (pp);
dump_decl (pp, ARRAY_NOTATION_START (t), flags | TFF_EXPR_IN_PARENS);
pp_colon (pp);
dump_decl (pp, ARRAY_NOTATION_LENGTH (t), flags | TFF_EXPR_IN_PARENS);
pp_colon (pp);
dump_decl (pp, ARRAY_NOTATION_STRIDE (t), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_bracket (pp);
Implemented Cilk Plus Array Notation for C++ Implemented Cilk Plus Array Notation for C++ gcc/c-family/ChangeLog 2013-06-21 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-common.h (struct cilkplus_an_parts): New structure. (struct cilkplus_an_loop_parts): Likewise. (cilkplus_extract_an_triplets): New prototype. (fix_sec_implicit_args): Likewise. * array-notation-common.c (cilkplus_extract_an_triplets): New function. (fix_sec_implicit_args): Likewise. gcc/cp/ChangeLog 2013-06-21 Balaji V. Iyer <balaji.v.iyer@intel.com> * call.c (convert_like_real): Added a check if array notation is present in expression. If so, then no conversion of arguments is necessary. (build_over_call): Likewise. * typeck.c (cp_build_function_call_vec): Likewise. (convert_for_assignment): Likewise. (cp_build_array_ref): Reject array notations with a rank greater than 1 as an array's index. (cp_build_binary_op): If array notations are preent in op, then call find_correct_array_notation_type. (cp_build_addr_expr_1): Handle ARRAY_NOTATION_REF similar to ARRAY_REF. * cp-array-notation.c: New file. * cp-objcp-common.c (cp_common_init_ts): Marked ARRAY_NOTATION_REF tree as typed. * cp-tree.h (fix_array_notation_exprs): New prototype. * semantics.c (finish_return_stmt): Reject array notations as return value. (cxx_eval_constant_expression): Added ARRAY_NOTATION_REF case. (potential_constant_expression_1): Likewise. * tree.c (lvalue_kind): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Likewise. * pt.c (ARRAY_NOTATION_REF): Likewise. (type_unification_real): Do not unify any arguments if array notations are found in arg. (instantiate_decl): Added a check for array notaitons inside the function body. If so, then expand them. * parser.c (cp_parser_array_notation): New function. (cp_parser_postfix_open_square_expression): Added a check for colons inside square braces. If found, then handle the array access as an array notation access. Also, disable auto-correction from a single colon to scope when Cilk Plus is enabled. (cp_parser_compound_statement): Added a check for array notations inside the statement. If found, then expand them. (cp_parser_ctor_initializer_opt_and_function_body): Likewise. (cp_parser_function_definition_after_declarator): Likewise. (cp_parser_selection_statement): Searched for array notations inside condition. If so, then emit an error. (cp_parser_iteration_statement): Likewise. (cp_parser_direct_declarator): Reject array notations inside a variable or array declaration. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Added cp/cp-array-notation.o. gcc/testsuite/ChangeLog 2013-06-21 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-c++-common/cilk-plus/AN/array_test1.c: Make this an execution test. Also changed the returns from error as distinct values so that debugging can get easier. * c-c++-common/cilk-plus/AN/if_test_errors.c (main): Made certain errors specific to C, if necessary. Also added new error hooks for C++. * c-c++-common/cilk-plus/AN/misc.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors2.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors3.c (main): Likewise. * c-c++-common/cilk-plus/AN/pr57541.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors4.c (main): In addition to the same changes as parser_errors3.c, spaces were added between colons to not confuse C++ compiler with 2 colons as scope. * c-c++-common/cilk-plus/AN/vla.c: Make this test C specific. * g++.dg/cilk-plus/AN/array_test1_tplt.cc: New test. * g++.dg/cilk-plus/AN/array_test2_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/array_test_ND_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/braced_list.cc: Likewise. * g++.dg/cilk-plus/AN/builtin_fn_custom_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/fp_triplet_values_tplt.c: Likewise. * g++.dg/cilk-plus/AN/preincr_test.cc: Likewise. * g++.dg/cilk-plus/AN/postincr_test.cc: Likewise. * g++.dg/cilk-plus/cilk-plus.exp: New script. * gcc/testsuite/g++.dg/dg.exp: Included Cilk Plus C++ tests in the list. From-SVN: r200319
2013-06-21 21:36:47 +02:00
break;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* So that we can do dump_decl on an aggr type. */
1994-02-24 02:02:37 +01:00
case RECORD_TYPE:
case UNION_TYPE:
case ENUMERAL_TYPE:
dump_type (pp, t, flags);
1994-02-24 02:02:37 +01:00
break;
case BIT_NOT_EXPR:
2003-07-02 23:32:58 +02:00
/* This is a pseudo destructor call which has not been folded into
a PSEUDO_DTOR_EXPR yet. */
pp_cxx_complement (pp);
dump_type (pp, TREE_OPERAND (t, 0), flags);
break;
1994-02-24 02:02:37 +01:00
case TYPE_EXPR:
call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. * call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. From-SVN: r86778
2004-08-30 17:28:48 +02:00
gcc_unreachable ();
1994-02-24 02:02:37 +01:00
break;
case IDENTIFIER_NODE:
dump_decl_name (pp, t, flags);
1994-02-24 02:02:37 +01:00
break;
tinfo.h (__class_type_info): Fix illegal declaration. 1999-04-02 Mark Mitchell <mark@codesourcery.com> * tinfo.h (__class_type_info): Fix illegal declaration. * cp-tree.def (TEMPLATE_ID_EXPR): Update comment. * cp-tree.h (INHERITED_VALUE_BINDING_P): New macro. (IDENTIFIER_CLASS_VALUE): Improve documentation. (is_properly_derived_from): Declare. (invalidate_class_lookup_cache): Likewise. (maybe_maybe_note_name_used_in_class): Likewise. (note_name_declared_in_class): Likewise. (push_using_decl): Remove duplicate declaration. (id_in_current_class): Remove declaration. (push_class_binding): Change prototype. (clear_identitifer_class_values): Declare. * call.c (is_properly_derived_from): Make it global. (build_new_function_call): Be careful about updating candidates. (build_new_method_call): Handle COMPONENT_REFs. Don't crash when asked to make illegal calls. * class.c: Include splay-tree.h. (class_stack_node): Add names_used slot. (check_member_decl_is_same_in_complete_scope): Remove. (add_method): Fix comment. Push the declaration into class scope. (finish_struct_1): When popping the class, pop the bindings too. Remove check for data member/function member conflict. (finish_struct): Remove calls to check_member_decl_is_same_in_complete_scope. Change calls to popclass. (pushclass): Clear names_used in the class stack entry. Use invalidate_class_lookup_cache to remove cached entries, rather than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE before entering a new class. Remove dead code. Don't mess with current_function_decl when pushing declarations. (invalidate_class_lookup_cache): New function, split out from ... (popclass): Here. Clean up names_used on our way out. (instantiate_type): Adjust. (build_self_reference): Don't push the declaration here. (maybe_note_name_used_in_class): New function. (note_name_declared_in_class): Likewise. * decl.c (add_binding): Change prototype. (find_class_binding_level): New function. (innermost_nonclass_level): Likewise. (current_binding_level): Update documentation. (inner_binding_level): Remove. Replace with current_binding_level throughout. (push_binding_level): Remove special handling of class_binding_level. (pop_binding_level): Likewise. Use find_class_binding_level. (suspend_binding_level): Likewise. (global_bindings_p): Use innermost_nonclass_level. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (pseudo_global_level_p): Likewise. (push_binding): Clear INHERITED_VALUE_BINDING_P. (add_binding): Check for illegal multiple declarations. Return a value indicating whether or not the new binding was legal. (push_local_binding): Skip over class binding levels. Check return value from add_binding. (push_class_binding): Set INHERITED_VALUE_BINDING_P. Call note_name_declared_in_class. (pushlevel_class): Remove "fake out the rest of the compiler" code. (poplevel_class): Reset IDENTIFIER_CLASS_VALUEs. (clear_identifier_class_values): New function. (pop_from_top_level): Use it. (pop_everything): Tweak. (maybe_process_template_type_declaration): Don't push the declaration for the template here. (pushtag): Don't push tag declarations into class scope here. (pushdecl): Apply DeMorgan's law for readability. (pushdecl_class_level): Remove special-case code for TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions. (push_class_level_bindng): Deal with inherited bindings. (lookup_name_real): Remove special-case code for TYPE_BEING_DEFINED, and some implicit typename magic. (grokdeclarator): Handle COMPONENT_REF for a template function. (build_enumerator): Don't call pushdecl_class_level here. (id_in_current_class): Remove. * decl2.c (grokfield): Don't call pushdecl_class_level or check_template_shadow. * errfn.c (cp_file_of): Don't declare. (cp_line_of): Likewise. * error.c (dump_decl): Handle an OVERLOAD. (cp_file_of): Likewise. (cp_line_of): Likewise. * init.c (build_member_call): Handle a COMPONENT_REF. * lex.c (do_identifier): Call maybe_note_name_used_in_class, not pushdecl_class_level. * method.c (hack_identifier): Build COMPONENT_REFs for references to member templates as well as member functions. Remove dead code. * parse.y (left_curly): Remove. (nonnested_type): Call maybe_note_name_used_in_class, not pushdecl_class_level. * parse.c: Regenerated. (nested_name_specifier_1): Likewise. * pt.c (check_explicit_specialization): Adjust, for robustness. (check_template_shadow): Handle OVERLOADs. (build_template_decl): Set DECL_CONSTRUCTOR_P on the TEMPLATE_DECL, if appropriate. * search.c (envelope_add_decl): Remove. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (dfs_push_decls): New function. (dfs_push_type_decls): Likewise. (setup_class_bindings): Likewise. (template_self_reference_p): Likewise. (lookup_field_r): Use it. (looup_member): Remove old comment. Deal with ambiguity. (push_class_decls): Use dfs_push_decls and dfs_push_type_decls, and remove envelope processing. * semantics.c (begin_class_definition): Let pushclass push declarations for base classes. (finish_member_declaration): Push declarations into class scope. * typeck.c (build_component_ref): Just put an OVERLOAD into the COMPONENT_REF, not a TREE_LIST of an OVERLOAD. (build_x_function_call): Deal with OVERLOAD. Handle template-ids. * Makefile.in (class.o): Depend on splay-tree.h. From-SVN: r26133
1999-04-02 17:36:57 +02:00
case OVERLOAD:
if (OVL_CHAIN (t))
{
t = OVL_CURRENT (t);
if (DECL_CLASS_SCOPE_P (t))
{
dump_type (pp, DECL_CONTEXT (t), flags);
pp_cxx_colon_colon (pp);
}
else if (!DECL_FILE_SCOPE_P (t))
{
dump_decl (pp, DECL_CONTEXT (t), flags);
pp_cxx_colon_colon (pp);
}
dump_decl (pp, DECL_NAME (t), flags);
break;
}
/* If there's only one function, just treat it like an ordinary
FUNCTION_DECL. */
tinfo.h (__class_type_info): Fix illegal declaration. 1999-04-02 Mark Mitchell <mark@codesourcery.com> * tinfo.h (__class_type_info): Fix illegal declaration. * cp-tree.def (TEMPLATE_ID_EXPR): Update comment. * cp-tree.h (INHERITED_VALUE_BINDING_P): New macro. (IDENTIFIER_CLASS_VALUE): Improve documentation. (is_properly_derived_from): Declare. (invalidate_class_lookup_cache): Likewise. (maybe_maybe_note_name_used_in_class): Likewise. (note_name_declared_in_class): Likewise. (push_using_decl): Remove duplicate declaration. (id_in_current_class): Remove declaration. (push_class_binding): Change prototype. (clear_identitifer_class_values): Declare. * call.c (is_properly_derived_from): Make it global. (build_new_function_call): Be careful about updating candidates. (build_new_method_call): Handle COMPONENT_REFs. Don't crash when asked to make illegal calls. * class.c: Include splay-tree.h. (class_stack_node): Add names_used slot. (check_member_decl_is_same_in_complete_scope): Remove. (add_method): Fix comment. Push the declaration into class scope. (finish_struct_1): When popping the class, pop the bindings too. Remove check for data member/function member conflict. (finish_struct): Remove calls to check_member_decl_is_same_in_complete_scope. Change calls to popclass. (pushclass): Clear names_used in the class stack entry. Use invalidate_class_lookup_cache to remove cached entries, rather than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE before entering a new class. Remove dead code. Don't mess with current_function_decl when pushing declarations. (invalidate_class_lookup_cache): New function, split out from ... (popclass): Here. Clean up names_used on our way out. (instantiate_type): Adjust. (build_self_reference): Don't push the declaration here. (maybe_note_name_used_in_class): New function. (note_name_declared_in_class): Likewise. * decl.c (add_binding): Change prototype. (find_class_binding_level): New function. (innermost_nonclass_level): Likewise. (current_binding_level): Update documentation. (inner_binding_level): Remove. Replace with current_binding_level throughout. (push_binding_level): Remove special handling of class_binding_level. (pop_binding_level): Likewise. Use find_class_binding_level. (suspend_binding_level): Likewise. (global_bindings_p): Use innermost_nonclass_level. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (pseudo_global_level_p): Likewise. (push_binding): Clear INHERITED_VALUE_BINDING_P. (add_binding): Check for illegal multiple declarations. Return a value indicating whether or not the new binding was legal. (push_local_binding): Skip over class binding levels. Check return value from add_binding. (push_class_binding): Set INHERITED_VALUE_BINDING_P. Call note_name_declared_in_class. (pushlevel_class): Remove "fake out the rest of the compiler" code. (poplevel_class): Reset IDENTIFIER_CLASS_VALUEs. (clear_identifier_class_values): New function. (pop_from_top_level): Use it. (pop_everything): Tweak. (maybe_process_template_type_declaration): Don't push the declaration for the template here. (pushtag): Don't push tag declarations into class scope here. (pushdecl): Apply DeMorgan's law for readability. (pushdecl_class_level): Remove special-case code for TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions. (push_class_level_bindng): Deal with inherited bindings. (lookup_name_real): Remove special-case code for TYPE_BEING_DEFINED, and some implicit typename magic. (grokdeclarator): Handle COMPONENT_REF for a template function. (build_enumerator): Don't call pushdecl_class_level here. (id_in_current_class): Remove. * decl2.c (grokfield): Don't call pushdecl_class_level or check_template_shadow. * errfn.c (cp_file_of): Don't declare. (cp_line_of): Likewise. * error.c (dump_decl): Handle an OVERLOAD. (cp_file_of): Likewise. (cp_line_of): Likewise. * init.c (build_member_call): Handle a COMPONENT_REF. * lex.c (do_identifier): Call maybe_note_name_used_in_class, not pushdecl_class_level. * method.c (hack_identifier): Build COMPONENT_REFs for references to member templates as well as member functions. Remove dead code. * parse.y (left_curly): Remove. (nonnested_type): Call maybe_note_name_used_in_class, not pushdecl_class_level. * parse.c: Regenerated. (nested_name_specifier_1): Likewise. * pt.c (check_explicit_specialization): Adjust, for robustness. (check_template_shadow): Handle OVERLOADs. (build_template_decl): Set DECL_CONSTRUCTOR_P on the TEMPLATE_DECL, if appropriate. * search.c (envelope_add_decl): Remove. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (dfs_push_decls): New function. (dfs_push_type_decls): Likewise. (setup_class_bindings): Likewise. (template_self_reference_p): Likewise. (lookup_field_r): Use it. (looup_member): Remove old comment. Deal with ambiguity. (push_class_decls): Use dfs_push_decls and dfs_push_type_decls, and remove envelope processing. * semantics.c (begin_class_definition): Let pushclass push declarations for base classes. (finish_member_declaration): Push declarations into class scope. * typeck.c (build_component_ref): Just put an OVERLOAD into the COMPONENT_REF, not a TREE_LIST of an OVERLOAD. (build_x_function_call): Deal with OVERLOAD. Handle template-ids. * Makefile.in (class.o): Depend on splay-tree.h. From-SVN: r26133
1999-04-02 17:36:57 +02:00
t = OVL_CURRENT (t);
/* Fall through. */
1994-02-24 02:02:37 +01:00
case FUNCTION_DECL:
if (! DECL_LANG_SPECIFIC (t))
{
if (DECL_ABSTRACT_ORIGIN (t)
&& DECL_ABSTRACT_ORIGIN (t) != t)
dump_decl (pp, DECL_ABSTRACT_ORIGIN (t), flags);
else
dump_function_name (pp, t, flags);
}
else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
dump_global_iord (pp, t);
1994-02-24 02:02:37 +01:00
else
dump_function_decl (pp, t, flags);
1994-02-24 02:02:37 +01:00
break;
case TEMPLATE_DECL:
dump_template_decl (pp, t, flags);
1994-02-24 02:02:37 +01:00
break;
case TEMPLATE_ID_EXPR:
{
tree name = TREE_OPERAND (t, 0);
tree args = TREE_OPERAND (t, 1);
if (is_overloaded_fn (name))
name = get_first_fn (name);
if (DECL_P (name))
name = DECL_NAME (name);
dump_decl (pp, name, flags);
pp_cxx_begin_template_argument_list (pp);
if (args == error_mark_node)
pp_string (pp, M_("<template arguments error>"));
else if (args)
dump_template_argument_list
(pp, args, flags|TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS);
pp_cxx_end_template_argument_list (pp);
}
break;
1994-02-24 02:02:37 +01:00
case LABEL_DECL:
pp_cxx_tree_identifier (pp, DECL_NAME (t));
1994-02-24 02:02:37 +01:00
break;
case CONST_DECL:
if ((TREE_TYPE (t) != NULL_TREE && NEXT_CODE (t) == ENUMERAL_TYPE)
|| (DECL_INITIAL (t) &&
Support for friend templates. * typeck.c (build_x_function_call): Handle static member function templates like non-templates. Handle friend templates like normal function templates. * pt.c (tsubst, *_PARM): Don't use orig_level. (get_bindings): Don't call add_to_template_args. (instantiate_template): Likewise. (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate. * ptree.c (print_lang_type): Print index/level for template parms. * Make-lang.in (cc1plus): Note that cc1plus depends on cp/cp-tree.h and cp/cp-tree.def. * cp-tree.def (TEMPLATE_CONST_PARM): Remove. (TEMPLATE_PARM_INDEX): New tree code, used to indicate a position in a template parameter list. * cp-tree.h (template_parm_index): New structure, used as the tree structure for a TEMPLATE_PARM_INDEX. (TEMPLATE_PARM_IDX): New macro. (TEMPLATE_PARM_LEVEL): Likewise. (TEMPLATE_PARM_DESCENDANTS): Likewise. (TEMPLATE_PARM_ORIG_LEVEL): Likewise. (TEMPLATE_PARM_DECL): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (TEMPLATE_TYPE_ORIG_LEVEL): Likewise. (TEMPLATE_TYPE_DECL): Likewise. (TEMPLATE_CONST_IDX): Remove. (TEMPLATE_CONST_LEVEL): Likewise. (TEMPLATE_CONST_SET_INFO): Likewise. (TEMPLATE_TYPE_SET_INFO): Likewise. (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX node. (TEMPLATE_TYPE_LEVEL): Likewise. * decl.c (decls_match): Call comp_template_parms, rather than expanding it inline. (duplicate_decls): If two template declarations are being merged, then their TEMPLATE_INFOs should be merged as well. (grokfndecl): Save template-id information when declaring a friend with explicit template arguments. Pass arguments to check_explicit_specialization via correct convention; at some point check_explicit_specialization changed, but these call-sites did not. (grokdeclarator): Tidy up slightly. * decl2.c (check_classfn): Tidy up slightly. Don't assume that two template functions with the same DECL_ASSEMBLER_NAME the same, since the names are not yet mangled. * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the decl for a non-type parameter, rather than printing `<tparm ...>'. * friend.c (is_friend): Handle TEMPLATE_DECL friends. (do_friend): Deal with template friends. * lex.c (do_pending_inlines): Call maybe_begin_member_template_processing, rather than conditionally calling begin_member_template_processing. (process_next_inline): Likewise. Call maybe_end_member_template_processing, rather than conditionally calling end_member_template_processing. (do_pending_defargs): Likewise. (do_identifier): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. * method.c (build_mangled_template_parm_index): New function. (build_overload_value): Use it. (build_overload_name): Likewise. * pt.c (finish_member_template_decl): Allow friend declarations. (template_class_depth): New function. (is_member_template): Rename, and modify, to become... (is_member_or_friend_template): New function. (end_member_template_processing): Rename, and modify, to become... (maybe_end_member_template_processing). (build_template_parm_index): New function. (reduce_template_parm_level): New function. (process_template_parm): Modify to use build_template_parm_index. (current_template_args): Change name to current_template_parms. (push_template_decl): Deal with friend templates. (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (tsubst_friend_function): New function. (instantiate_class_template): Generate the DECL_FRIENDLIST for a new instantiation by using tsubst_friend_function rather than just tsubst. (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the appropriate new macros. Use reduce_template_parm_level to generate lower-level template parameters. Handle tsubst'ing into TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created templates. Similarly for the template parameters for a new template. (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them. (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (get_bindings): Call add_to_template_args if necessary. (instantiate_decl): Handle instantiations of friend templates. * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a TEMPLATE_TYPE_PARM as a list of fields; it's not! * spew.c (yylex): Do a little manual constant propogation to clarify the code. From-SVN: r18198
1998-02-23 04:17:44 +01:00
TREE_CODE (DECL_INITIAL (t)) == TEMPLATE_PARM_INDEX))
dump_simple_decl (pp, t, TREE_TYPE (t), flags);
else if (DECL_NAME (t))
dump_decl (pp, DECL_NAME (t), flags);
else if (DECL_INITIAL (t))
dump_expr (pp, DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS);
else
pp_string (pp, M_("<enumerator>"));
1994-02-24 02:02:37 +01:00
break;
case USING_DECL:
{
pp_cxx_ws_string (pp, "using");
tree scope = USING_DECL_SCOPE (t);
bool variadic = false;
if (PACK_EXPANSION_P (scope))
{
scope = PACK_EXPANSION_PATTERN (scope);
variadic = true;
}
dump_type (pp, scope, flags);
pp_cxx_colon_colon (pp);
dump_decl (pp, DECL_NAME (t), flags);
if (variadic)
pp_cxx_ws_string (pp, "...");
}
break;
case STATIC_ASSERT:
c-pretty-print.h (c_pretty_printer::declaration): Now a virtual member function. c-family/ * c-pretty-print.h (c_pretty_printer::declaration): Now a virtual member function. (c_pretty_printer::declaration_specifiers): Likewise. (c_pretty_printer::declarator): Likewise. (c_pretty_printer::abstract_declarator): Likewise. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::direct_declarator): Likewise. (c_pretty_printer::function_specifier): Likewise. (pp_declaration): Adjust. (pp_declaration_specifiers): Likewise. (pp_abstract_declarator): Likewise. (pp_direct_declarator): Likewise. (pp_function_specifier): Likewise. (pp_direct_abstract_declarator): Remove as unused. (pp_c_declaration): Remove. (pp_c_declaration_specifiers): Likewise. (pp_c_declarator): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_function_specifier): Likewise. (pp_c_direct_abstract_declarator): Likewise. * c-pretty-print.c (c_pretty_printer::abstract_declarator): Rename from pp_c_abstract_declarator. Adjust. (c_pretty_printer::direct_abstract_declarator): Rename from pp_c_direct_abstract_declarator. Adjust. (c_pretty_printer::function_specifier): Rename from pp_c_function_specifier. Adjust. (c_pretty_printer::declaration_specifiers): Rename from pp_c_declaration_specifiers. Adjust. (c_pretty_printer::direct_declarator): Rename from pp_c_direct_declarator. Adjust. (c_pretty_printer::declarator): Rename from pp_c_declarator. Adjust. (c_pretty_printer::declaration): Rename from pp_c_declaration. Adjust. (c_pretty_printer::c_pretty_printer): Do not assign to declaration, declaration_specifiers, declarator, direct_declarator, direct_abstract_declarator, function_specifier. cp/ * cxx-pretty-print.h (cxx_pretty_printer::declaration): Declare as overrider. (cxx_pretty_printer::declaration_specifiers): Likewise. (cxx_pretty_printer::function_specifier): Likewise. (cxx_pretty_printer::declarator): Likewise. (cxx_pretty_printer::direct_declarator): Likewise. (cxx_pretty_printer::abstract_declarator): Likewise. (cxx_pretty_printer::direct_abstract_declarator): Likewise. (pp_cxx_declaration): Remove. * cxx-pretty-print.c (cxx_pretty_printer::function_specifier): Rename from pp_cxx_function_specifier. Adjust. (cxx_pretty_printer::declaration_specifiers): Rename from pp_cxx_decl_specifier_seq. Adjust. (cxx_pretty_printer::direct_declarator): Rename from pp_cxx_direct_declarator. Adjust. (cxx_pretty_printer::declarator): Rename from pp_cxx_declarator. Adjust. (cxx_pretty_printer::abstract_declarator): Rename from pp_cxx_abstract_declarator. Adjust. (cxx_pretty_printer::direct_abstract_declarator): Rename from pp_cxx_direct_abstract_declarator. Adjust. (cxx_pretty_printer::declaration): Rename from pp_cxx_declaration. Adjust. (cxx_pretty_printer::cxx_pretty_printer): Do not assign to declaration, declaration_specifiers, function_specifier, declarator, direct_declarator, abstract_declarator, direct_abstract_declarator. * error.c (dump_decl): Adjust. From-SVN: r202109
2013-08-30 17:28:51 +02:00
pp->declaration (t);
break;
Rework build_component_ref. * call.c (build_vfield_ref): Do not go through build_component_ref. (build_field_call): Use build_class_member_access_expr. (build_user_type_conversion_1): Use BASELINK_FUNCTIONS. (build_object_call): Likewise. * class.c (convert_to_base): New function. (type_requires_array_cookie): Use BASELINK_FUNCTIONS. (instantiate_type): Handle BASELINKs. * cp-tree.def (BASELINK): New tree code. * cp-tree.h (BASELINK_P): Reimplement. (SET_BASELINK_P): Remove. (BASELINK_BINFO): Reimplement. (BASELINK_FUNCTIONS): Likewise. (BASELINK_ACCESS_BINFO): Likewise. (BASELINK_OPTYPE): Likewise. (convert_to_base): New function. (name_p): Likewise. (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_component_ref): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. * decl.c (grokdeclarator): Handle BASELINKs. * decl2. (build_expr_from_tree): Handle COMPONENT_REFs by using finish_class_member_access_expr. (arg_assoc): Handle BASELINKs. (do_class_using_decl): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Use build_ptrmemfunc_access_expr. * except.c (dtor_nothrow): Use CLASSTYPE_DESTRUCTORS to find destructors. (build_throw): Use BASELINK_FUNCTIONS. * init.c (perform_member_init): Use build_class_member_access_expr. (build_offset_ref): Handle BASELINKs. Use build_class_member_access_expr. * method.c (hack_identifier): Likewise. * parse.y (do_id): Use BASELINK, not TREE_LIST. (primary): Remove uses of build_object_ref. * pt.c (lookup_template_function): Handle BASELINKs. (resolve_overloaded_unification): Likewise. * search.c (build_baselink): Build a BASELINK, not a TREE_LIST. (lookup_field): Use BASELINK, not TREE_LIST. (lookup_fnfiels): Likewise. (setup_class_bindings): Likewise. * semantics.c (finish_object_call_expr): Do not use build_method_call when we already know what function is being called. * spew.c (identifier_type): Use BASELINK, not TREE_LIST. * tree.c (really_overloaded_fn): Use OVL_CHAIN for OVERLOADs, not TREE_CHAIN. (name_p): New function. * typeck.c (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. (get_member_function_from_ptrfunc): Use build_ptrmemfunc_access_expr. (build_binary_op): Likewise. (build_unary_op): Likewise. (build_ptrmemfunc): Likewise. (pfn_from_ptrmemfunc): Likewise. * typeck2.c (build_m_component_ref): Adjust comment. * g++.dg/abi/offsetof.C: Tweak error messages. * g++.old-deja/g++.mike/p10769a.C: Likewise. From-SVN: r56117
2002-08-08 07:48:39 +02:00
case BASELINK:
dump_decl (pp, BASELINK_FUNCTIONS (t), flags);
Rework build_component_ref. * call.c (build_vfield_ref): Do not go through build_component_ref. (build_field_call): Use build_class_member_access_expr. (build_user_type_conversion_1): Use BASELINK_FUNCTIONS. (build_object_call): Likewise. * class.c (convert_to_base): New function. (type_requires_array_cookie): Use BASELINK_FUNCTIONS. (instantiate_type): Handle BASELINKs. * cp-tree.def (BASELINK): New tree code. * cp-tree.h (BASELINK_P): Reimplement. (SET_BASELINK_P): Remove. (BASELINK_BINFO): Reimplement. (BASELINK_FUNCTIONS): Likewise. (BASELINK_ACCESS_BINFO): Likewise. (BASELINK_OPTYPE): Likewise. (convert_to_base): New function. (name_p): Likewise. (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_component_ref): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. * decl.c (grokdeclarator): Handle BASELINKs. * decl2. (build_expr_from_tree): Handle COMPONENT_REFs by using finish_class_member_access_expr. (arg_assoc): Handle BASELINKs. (do_class_using_decl): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Use build_ptrmemfunc_access_expr. * except.c (dtor_nothrow): Use CLASSTYPE_DESTRUCTORS to find destructors. (build_throw): Use BASELINK_FUNCTIONS. * init.c (perform_member_init): Use build_class_member_access_expr. (build_offset_ref): Handle BASELINKs. Use build_class_member_access_expr. * method.c (hack_identifier): Likewise. * parse.y (do_id): Use BASELINK, not TREE_LIST. (primary): Remove uses of build_object_ref. * pt.c (lookup_template_function): Handle BASELINKs. (resolve_overloaded_unification): Likewise. * search.c (build_baselink): Build a BASELINK, not a TREE_LIST. (lookup_field): Use BASELINK, not TREE_LIST. (lookup_fnfiels): Likewise. (setup_class_bindings): Likewise. * semantics.c (finish_object_call_expr): Do not use build_method_call when we already know what function is being called. * spew.c (identifier_type): Use BASELINK, not TREE_LIST. * tree.c (really_overloaded_fn): Use OVL_CHAIN for OVERLOADs, not TREE_CHAIN. (name_p): New function. * typeck.c (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. (get_member_function_from_ptrfunc): Use build_ptrmemfunc_access_expr. (build_binary_op): Likewise. (build_unary_op): Likewise. (build_ptrmemfunc): Likewise. (pfn_from_ptrmemfunc): Likewise. * typeck2.c (build_m_component_ref): Adjust comment. * g++.dg/abi/offsetof.C: Tweak error messages. * g++.old-deja/g++.mike/p10769a.C: Likewise. From-SVN: r56117
2002-08-08 07:48:39 +02:00
break;
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
case NON_DEPENDENT_EXPR:
dump_expr (pp, t, flags);
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
break;
case TEMPLATE_TYPE_PARM:
if (flags & TFF_DECL_SPECIFIERS)
c-pretty-print.h (c_pretty_printer::declaration): Now a virtual member function. c-family/ * c-pretty-print.h (c_pretty_printer::declaration): Now a virtual member function. (c_pretty_printer::declaration_specifiers): Likewise. (c_pretty_printer::declarator): Likewise. (c_pretty_printer::abstract_declarator): Likewise. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::direct_declarator): Likewise. (c_pretty_printer::function_specifier): Likewise. (pp_declaration): Adjust. (pp_declaration_specifiers): Likewise. (pp_abstract_declarator): Likewise. (pp_direct_declarator): Likewise. (pp_function_specifier): Likewise. (pp_direct_abstract_declarator): Remove as unused. (pp_c_declaration): Remove. (pp_c_declaration_specifiers): Likewise. (pp_c_declarator): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_function_specifier): Likewise. (pp_c_direct_abstract_declarator): Likewise. * c-pretty-print.c (c_pretty_printer::abstract_declarator): Rename from pp_c_abstract_declarator. Adjust. (c_pretty_printer::direct_abstract_declarator): Rename from pp_c_direct_abstract_declarator. Adjust. (c_pretty_printer::function_specifier): Rename from pp_c_function_specifier. Adjust. (c_pretty_printer::declaration_specifiers): Rename from pp_c_declaration_specifiers. Adjust. (c_pretty_printer::direct_declarator): Rename from pp_c_direct_declarator. Adjust. (c_pretty_printer::declarator): Rename from pp_c_declarator. Adjust. (c_pretty_printer::declaration): Rename from pp_c_declaration. Adjust. (c_pretty_printer::c_pretty_printer): Do not assign to declaration, declaration_specifiers, declarator, direct_declarator, direct_abstract_declarator, function_specifier. cp/ * cxx-pretty-print.h (cxx_pretty_printer::declaration): Declare as overrider. (cxx_pretty_printer::declaration_specifiers): Likewise. (cxx_pretty_printer::function_specifier): Likewise. (cxx_pretty_printer::declarator): Likewise. (cxx_pretty_printer::direct_declarator): Likewise. (cxx_pretty_printer::abstract_declarator): Likewise. (cxx_pretty_printer::direct_abstract_declarator): Likewise. (pp_cxx_declaration): Remove. * cxx-pretty-print.c (cxx_pretty_printer::function_specifier): Rename from pp_cxx_function_specifier. Adjust. (cxx_pretty_printer::declaration_specifiers): Rename from pp_cxx_decl_specifier_seq. Adjust. (cxx_pretty_printer::direct_declarator): Rename from pp_cxx_direct_declarator. Adjust. (cxx_pretty_printer::declarator): Rename from pp_cxx_declarator. Adjust. (cxx_pretty_printer::abstract_declarator): Rename from pp_cxx_abstract_declarator. Adjust. (cxx_pretty_printer::direct_abstract_declarator): Rename from pp_cxx_direct_abstract_declarator. Adjust. (cxx_pretty_printer::declaration): Rename from pp_cxx_declaration. Adjust. (cxx_pretty_printer::cxx_pretty_printer): Do not assign to declaration, declaration_specifiers, function_specifier, declarator, direct_declarator, abstract_declarator, direct_abstract_declarator. * error.c (dump_decl): Adjust. From-SVN: r202109
2013-08-30 17:28:51 +02:00
pp->declaration (t);
else
c-objc-common.c (c_tree_printer): Tidy. c/ * c-objc-common.c (c_tree_printer): Tidy. c-family/ * c-pretty-print.h (c_pretty_printer::type_id): Now a virtual member function. (c_pretty_printer::storage_class_specifier): Likewise. (c_pretty_printer::initializer): Likewise. (pp_declaration): Remove. (pp_declaration_specifiers): Likewise. (pp_abstract_declarator): Likewise. (pp_declarator): Likewise. (pp_type_id): Likewise. (pp_statement): Likewise. (pp_constant): Likewise. (pp_id_expression): Likewise. (pp_primary_expression): Likewise. (pp_unary_expression): Likewise. (pp_multiplicative_expression): Likewise. (pp_conditional_expression): Likewise. (pp_assignment_expression): Likewise. (pp_expression): Likewise. (pp_c_type_id): Likewise. (pp_c_storage_class_specifier): Likewise. * c-pretty-print.c (pp_c_type_cast): Tidy. (pp_c_pointer): Likewise. (pp_c_type_specifier): Likewise. (pp_c_parameter_type_list): Likewise. (pp_c_function_definition): Likewise. (pp_c_init_declarator): Likewise. (pp_c_initializer_list): Likewise. (pp_c_constructor_elts): Likewise. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::declaration_specifiers): Likewise. (c_pretty_printer::primary_expression): Likewise. (c_pretty_printer::postfix_expression): Likewise. (c_pretty_printer::type_id): Rename from pp_c_type_id. (c_pretty_printer::storage_class_specifier): Rename from pp_c_storage_class_specifier. (c_pretty_printer::initializer): Rename from pp_c_initializer. (c_pretty_printer::c_pretty_printer): Do not assign to type_id, storage_class_specifier, initializer, offset_list, flags. cp/ * cxx-pretty-print.h (cxx_pretty_printer::type_id): Declare as overrider. * cxx-pretty-print.c (pp_cxx_storage_class_specifier): Remove. (pp_cxx_userdef_literal): Tidy. (pp_cxx_template_argument_list): Likewise. (pp_cxx_typeid_expression): Likewise. (pp_cxx_offsetof_expression_1): Likewise. (cxx_pretty_printer::postfix_expression): Likewise. (cxx_pretty_printer::unary_expression): Likewise. (cxx_pretty_printer::statement): Likewise. (cxx_pretty_printer::type_id): Rename from pp_cxx_type_id. (c_pretty_printer::cxx_pretty_printer): Do not assign to type_id. * error.c (dump_decl): Tidy. (dump_expr): Likewise. From-SVN: r202203
2013-09-03 11:52:19 +02:00
pp->type_id (t);
break;
case UNBOUND_CLASS_TEMPLATE:
case TYPE_PACK_EXPANSION:
case TREE_BINFO:
dump_type (pp, t, flags);
break;
1994-02-24 02:02:37 +01:00
default:
pp_unsupported_tree (pp, t);
/* Fall through. */
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
case ERROR_MARK:
pp_string (pp, M_("<declaration error>"));
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
break;
}
}
/* Dump a template declaration T under control of FLAGS. This means the
'template <...> leaders plus the 'class X' or 'void fn(...)' part. */
static void
dump_template_decl (cxx_pretty_printer *pp, tree t, int flags)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
{
tree orig_parms = DECL_TEMPLATE_PARMS (t);
tree parms;
int i;
if (flags & TFF_TEMPLATE_HEADER)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
{
for (parms = orig_parms = nreverse (orig_parms);
parms;
parms = TREE_CHAIN (parms))
{
tree inner_parms = INNERMOST_TEMPLATE_PARMS (parms);
int len = TREE_VEC_LENGTH (inner_parms);
if (len == 0)
{
/* Skip over the dummy template levels of a template template
parm. */
gcc_assert (TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TEMPLATE_PARM);
continue;
}
pp_cxx_ws_string (pp, "template");
pp_cxx_begin_template_argument_list (pp);
/* If we've shown the template prefix, we'd better show the
parameters' and decl's type too. */
flags |= TFF_DECL_SPECIFIERS;
for (i = 0; i < len; i++)
{
if (i)
pp_separate_with_comma (pp);
dump_template_parameter (pp, TREE_VEC_ELT (inner_parms, i),
flags);
}
pp_cxx_end_template_argument_list (pp);
pp_cxx_whitespace (pp);
}
nreverse(orig_parms);
if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
{
/* Say `template<arg> class TT' not just `template<arg> TT'. */
pp_cxx_ws_string (pp, "class");
/* If this is a parameter pack, print the ellipsis. */
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
pp_cxx_ws_string (pp, "...");
}
Improving concepts performance and diagnostics. PR c++/67565 PR c++/67579 PR c++/71843 gcc/ * timevar.def (TV_CONSTRAINT_SAT, TV_CONSTRAINT_SUB): New time vars for constraint satisfaction and subsumption. * timevar.h (auto_timevar): New constructor that matches the push/pop pattern of usage in pt.c. gcc/cp/ * cp-tree.def (CHECK_CONSTR): New. * cp-tree.h (CHECK_CONSTR_CONCEPT): New. (CHECK_CONSTR_ARGS): New. * constraint.cc (make_predicate_constraint): Remove in favor of normalize_expression. (resolve_constraint_check): Actually return error_mark_node when resolution fails. (resolve_variable_concept_check): Perform coercion as if processing a template. Also return errors on resolution failure. (lift_*): Remove all of these functions. Don't unnecessarily inline concepts. (learn_*): Add facilities to memoize implications for subsumption during normalization. (expanding_concept): New. (expand_concept): New. Return the inlined and normalized definition of a concept when needed. (transform_*, xform_*): Rename to normalize_* to better reflect the responsibility of those functions. (normalize_template_id_expression): Check for non-boolean operands when possible. Generate check constraints instead of normal variable references. (normalize_call_expression): Report errors when resolution fails. (check_for_logical_overloads): Rewrite this check to more accurately report the error. (normalize_atom): Check for overloaded calls and invalid types before determining if the expression refers to a concept. (build_constraints): Don't cache normalized constraints or decmposed assumptions. (finish_shorthand_constraint): Return a normalized expression instead of a predicate constraint. (finish_template_introduction): Same. (placeholder_extract_concept_and_args): Rewrite this since we only ever get check constraints here. (equivalent_placeholder_constraints): Rewrite in terms of check constraints, and handle error_mark_nodes correctly. (tsubst_check_constraint, tsubst_expr_constr, tsubst_type_constr) (tsubst_implicit_conversion_constr) (tsubst_argument_deduction_constr, tsubst_exception_constr) (tsubst_parameterized_constraint, tsubst_constraint): New. (tsbust_conjunection): Replace with tsubst_logical_operator and actually generate the right kind of constraint. (tsubst_requirement_body): Reverse the order of substituted arguments so that they appear in the order written (helps diagnostics). (satisfy_check_constraint): New. (satisfy_conjunction): Simplify. (satisfy_disjunction): Same. (satisfy_constraint_1): Handle check constraints. (eval_constr): New (private) global state. (evaluating_constraints_sentinel): New. Manages eval_constr. (satisfy_constraint): Add timing variables. (satisfy_associated_constraints): Add hooks for memoization. (evaluate_function_concept): Build a check constraint instead of normalizing its definition. (evaluate_variable_concept): Same. (evaluate_constraint_expression): Normalize, but in the current declaration processing context. (evaluating_constraints_p): New. (elide_constraint_failure_p): Actually emit constraint_thresh errors. (diagnose_*): Remove artificial indentation. Add a new parameter to each that tracks the current (complete) constraint prior to any substitutions. (diagnose_expression): Removed. (diagnose_call_expression): Same. (diagnose_template_id): Same. (diagnose_template_id): New. (diagnose_logical_constraint): New. (diagnose_expression_constraint): Show the original expression. (diagnose_type_constraint): Show the original type. (diagnose_implicit_conversion_constraint): Be specific about failures, don't re-diagnose a known-to-be-failed substitutions, and manage elisions properly. (diagnose_argument_deduction_constraint): Same. (diagnose_exception_constraint): Same. (diagnose_parameterized_constraint): Same. (constraint_p): Allow EXPR_PACK_EXPANSION. * logic.cc (next_by_distance): Removed. No longer used. (any_p): Renamed from any_of. (term_entry, term_hasher): New. (term_list): Rewrite to include a hash table for quick lookup. Also, make less stateful. (proof_state): Extend to allow goals to be discharged once satisfied. (non_atomic_constraint_p): New. (any_non_atomic_constraints_p): New. (...rest...): Previous implementation completely replaced with an iterative algorithm that opportunistically prunes the search space before committing to using more memory. * parser.c: (cp_parser_type_parameter): Normalize constraints. (cp_parser_explicit_template_declaration): Same. * pt.c: (finish_template_variable): Be less redundant with this error message. (template_args_equal): No longer static. (tsubst_decl): Don't try to find specializations of variables that have already been instantiated. (build_non_dependent_expr): Avoid infinite recursion during concept expansion. (make_constrained_auto): Normalize constraints. (do_auto_deduction): When doing auto deduction from a partial-concept-id, be sure to include the explicit args checking the constraints. (constraint_sat_*): New. Memoize satisfied constraints. (concept_spec_*): New. Memoize expressions associated with a concept specialization. (constraint_memos, concept_memos): New. (lookup_constraint_satisfaction, memoize_constraint_satisfaction): New. (lookup_concept_satisfaction, memoize_concept_satisfaction): New. (get_concept_expansion, save_concept_expansion): New. (hash_subsumption_args): New. (comp_subsumption_args): New. (subsumption_*): New. Memoize parts of the subsumption relation. (lookup_subsumption_result, save_subsumption_result): New. (init_constraint_processing): Initialize memo tables. (get_constraints): Shortcut if !flag_concepts. * decl.c (grokfndecl): Normalize constraints. * error.c (dump_simple_decl): Print "concept" when appropriate. (dump_function_decl): Same. (dump_template_decl): Don't write requirements when we're not printing the header. (dump_expr): Handle fold expressions. * cxx-pretty-print.c (cxx_pretty_printer::expression): Handle fold expressions. (get_fold_operator): New. (pp_cxx_unary_left_fold_expression): New. (pp_cxx_unary_right_fold_expression): New. (pp_cxx_binary_fold_expression): New. (pp_cxx_check_constraint): New. (pp_cxx_*_constraint): Rewrite the grammar of internal constraints to make them easier to read when debugging. * search.c (accessible_p): Don't shortcut when evaluating constraints. * tree.c (cp_tree_equal): Handle CHECK_CONSTR. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r238558
2016-07-21 08:05:24 +02:00
/* Only print the requirements if we're also printing
the template header. */
if (flag_concepts)
if (tree ci = get_constraints (t))
if (check_constraint_info (ci))
if (tree reqs = CI_TEMPLATE_REQS (ci))
{
pp_cxx_requires_clause (pp, reqs);
pp_cxx_whitespace (pp);
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
Add C++ Concepts TS support. gcc/c-family/ * c-common.c (c_common_reswords): Add __is_same_as, concept, requires. * c-common.h (enum rid): Add RID_IS_SAME_AS, RID_CONCEPT, RID_REQUIRES. (D_CXX_CONCEPTS, D_CXX_CONCEPTS_FLAGS): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_concepts. * c-opts.c (set_std_cxx1z): Set flag_concepts. * c.opt (fconcepts): New. gcc/cp/ * constraint.cc, logic.cc: New files. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add constraint.o and logic.o. (c++.tags): Also process .cc files. * call.c (enum rejection_reason_code): Add rr_constraint_failure. (print_z_candidate): Handle it. (constraint_failure): New. (add_function_candidate): Check constraints. (build_new_function_call): Handle evaluating concepts. (joust): Check more_constrained. * class.c (add_method): Check equivalently_constrained. (build_clone): Copy constraints. (currently_open_class): Return tree. (resolve_address_of_overloaded_function): Check constraints. * constexpr.c (cxx_eval_constant_expression): Handle REQUIRES_EXPR. (potential_constant_expression_1): Likewise. * cp-objcp-common.c (cp_tree_size): Handle CONSTRAINT_INFO. (cp_common_init_ts): Handle WILDCARD_DECL and REQUIRES_EXPR. * cp-tree.def: Add CONSTRAINT_INFO, WILDCARD_DECL, REQUIRES_EXPR, SIMPLE_REQ, TYPE_REQ, COMPOUND_REQ, NESTED_REQ, PRED_CONSTR, EXPR_CONSTR, TYPE_CONSTR, ICONV_CONSTR, DEDUCT_CONSTR, EXCEPT_CONSTR, PARM_CONSTR, CONJ_CONSTR, DISJ_CONSTR. * cp-tree.h (struct tree_constraint_info, check_nonnull) (check_constraint_info, CI_TEMPLATE_REQS, CI_DECLARATOR_REQS) (CI_ASSOCIATED_CONSTRAINTS, CI_NORMALIZED_CONSTRAINTS) (CI_ASSUMPTIONS, TEMPLATE_PARMS_CONSTRAINTS) (TEMPLATE_PARM_CONSTRAINTS, COMPOUND_REQ_NOEXCEPT_P) (PLACEHOLDER_TYPE_CONSTRAINTS, PRED_CONSTR_EXPR, EXPR_CONSTR_EXPR) (TYPE_CONSTR_TYPE, ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE) (DEDUCT_CONSTR_EXPR, DEDUCT_CONSTR_PATTERN) (DEDUCT_CONSTR_PLACEHOLDER, EXCEPT_CONSTR_EXPR, PARM_CONSTR_PARMS) (PARM_CONSTR_OPERAND, CONSTRAINT_VAR_P, CONSTRAINED_PARM_CONCEPT) (CONSTRAINED_PARM_EXTRA_ARGS, CONSTRAINED_PARM_PROTOTYPE) (DECL_DECLARED_CONCEPT_P, WILDCARD_PACK_P, struct cp_unevaluated) (struct local_specialization_stack, enum auto_deduction_context) (variable_concept_p, concept_template_p) (struct deferring_access_check_sentinel): New. (enum cp_tree_node_structure_enum): Add TS_CP_CONSTRAINT_INFO. (union lang_tree_node): Add constraint_info field. (struct lang_decl_base): Add concept_p flag. (enum cp_decl_spec): Add ds_concept. (struct cp_declarator): Add requires_clause. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression) (cxx_pretty_printer::expression): Handle REQUIRES_EXPR, TRAIT_EXPR, *_CONSTR. (pp_cxx_parameter_declaration_clause): Accept a chain of PARM_DECLs. (cxx_pretty_printer::declarator): Print requires-clause. (pp_cxx_template_declaration): Likewise. (pp_cxx_trait_expression): Handle CPTK_IS_SAME_AS. (pp_cxx_requires_clause, pp_cxx_requirement) (pp_cxx_requirement_list, pp_cxx_requirement_body) (pp_cxx_requires_expr, pp_cxx_simple_requirement) (pp_cxx_type_requirement, pp_cxx_compound_requirement) (pp_cxx_nested_requirement, pp_cxx_predicate_constraint) (pp_cxx_expression_constraint, pp_cxx_type_constraint) (pp_cxx_implicit_conversion_constraint) (pp_cxx_argument_deduction_constraint) (pp_cxx_exception_constraint, pp_cxx_parameterized_constraint) (pp_cxx_conjunction, pp_cxx_disjunction, pp_cxx_constraint): New. * cxx-pretty-print.h: Declare them. * decl.c (decls_match): Compare constraints. (duplicate_decls): Likewise. Remove constraints before freeing. (cxx_init_decl_processing): Call init_constraint_processing. (cp_finish_decl): Diagnose concept without initializer. (grokfndecl, grokvardecl): Handle concepts and constraints. (grokdeclarator): Handle concept, requires-clause. (grokparms): No longer static. (xref_tag_1): Check constraints. (finish_function): Call check_function_concept. (cp_tree_node_structure): Handle CONSTRAINT_INFO. (check_concept_refinement, is_concept_var, check_concept_fn): New. * decl2.c (check_classfn): Compare constraints. (mark_used): Don't instantiate concepts. * error.c (dump_template_decl): Print constraints. (dump_function_decl): Likewise. (dump_expr): Handle REQUIRES_EXPR, *_REQ, *_CONSTR. * lex.c (init_reswords): Set D_CXX_CONCEPTS. * method.c (implicitly_declare_fn): Copy constraints from inherited ctor. * parser.h (struct cp_parser): Add in_result_type_constraint_p and prevent_constrained_type_specifiers fields. * parser.c (make_call_declarator): Add requires_clause parm. (cp_parser_new): Clear prevent_constrained_type_specifiers. (cp_parser_primary_expression): Handle RID_IS_SAME_AS, RID_REQUIRES. (cp_parser_postfix_expression): Set prevent_constrained_type_specifiers. (cp_parser_trait_expr): Handle RID_IS_SAME_AS. (cp_parser_declaration): Handle concept introduction. (cp_parser_member_declaration): Likewise. (cp_parser_template_parameter): Handle constrained parameter. (cp_parser_type_parameter): Handle constraints. (cp_parser_decl_specifier_seq): Handle RID_CONCEPT. (cp_parser_template_id): Handle partial concept id. (cp_parser_type_name): Add overload that takes typename_keyword_p. Handle constrained parameter. (cp_parser_nonclass_name): Handle concept names. (cp_parser_alias_declaration): Handle constraints. (cp_parser_late_return_type_opt): Also handle requires-clause. (cp_parser_type_id_1): Handle deduction constraint. (cp_parser_parameter_declaration): Handle constrained parameters. (cp_parser_class_specifier_1): Handle constraints. (cp_parser_template_declaration_after_parameters): Split out from cp_parser_template_declaration_after_export. (cp_parser_single_declaration): Handle constraints. (synthesize_implicit_template_parm): Handle constraints. (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_introduction_list, get_id_declarator) (get_unqualified_id, is_constrained_parameter) (cp_parser_check_constrained_type_parm) (cp_parser_constrained_type_template_parm) (cp_parser_constrained_template_template_parm) (constrained_non_type_template_parm, finish_constrained_parameter) (declares_constrained_type_template_parameter) (declares_constrained_template_template_parameter) (check_type_concept, cp_parser_maybe_constrained_type_specifier) (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_requires_clause, cp_parser_requires_clause_opt) (cp_parser_requires_expression) (cp_parser_requirement_parameter_list, cp_parser_requirement_body) (cp_parser_requirement_list, cp_parser_requirement) (cp_parser_simple_requirement, cp_parser_type_requirement) (cp_parser_compound_requirement, cp_parser_nested_requirement) (cp_parser_template_introduction) (cp_parser_explicit_template_declaration) (get_concept_from_constraint): New. * pt.c (local_specialization_stack): Implement. (maybe_new_partial_specialization): New. (maybe_process_partial_specialization): Use it. (retrieve_local_specialization, register_local_specialization) (template_parm_to_arg, build_template_decl, extract_fnparm_pack) (tsubst_expr): No longer static. (spec_hasher::equal): Compare constraints. (determine_specialization): Handle constraints. (check_explicit_specialization): Handle concepts. (process_template_parm): Handle constraints. (end_template_parm_list): Add overload taking no arguments. (process_partial_specialization): Handle concepts and constraints. Register partial specializations of variable templates. (redeclare_class_template): Handle constraints. (convert_template_argument): Handle WILDCARD_DECL. Check is_compatible_template_arg. (coerce_template_parameter_pack): Handle wildcard packs. (coerce_template_parms): DR 1430 also applies to concepts. Add overloads taking fewer parameters. (lookup_template_class_1): Handle constraints. (lookup_template_variable): Concepts are always bool. (finish_template_variable): Handle concepts and constraints. (tsubst_friend_class): Handle constraints. (gen_elem_of_pack_expansion_instantiation): Handle constraints. (tsubst_pack_expansion): Handle local parameters. (tsubst_decl) [FUNCTION_DECL]: Handle constraints. (tsubst) [TEMPLATE_TYPE_PARM]: Handle deduction constraints. (tsubst_copy_and_build): Handle REQUIRES_EXPR. (more_specialized_fn, more_specialized_partial_spec): Check constraints. (more_specialized_inst): Split out from most_specialized_instantiation. (most_specialized_partial_spec): Check constraints. (instantiate_decl): Never instantiate a concept. (value_dependent_expression_p): Handle REQUIRES_EXPR, TYPE_REQ, variable concepts. (type_dependent_expression_p): Handle WILDCARD_DECL, REQUIRES_EXPR. (instantiation_dependent_r): Handle REQUIRES_EXPR and concepts. (do_auto_deduction): Add overload taking tsubst flags and context enum. Handle constraints. (get_template_for_ordering, most_constrained_function) (is_compatible_template_arg, convert_wildcard_argument) (struct constr_entry, struct constr_hasher, decl_constraints) (valid_constraints_p, get_constraints, set_constraints) (remove_constraints, init_constraint_processing): New. * ptree.c (cxx_print_xnode): Handle CONSTRAINT_INFO. * search.c (lookup_member): Do lookup in the open partial instantiation. * semantics.c (finish_template_template_parm): Handle constraints. (fixup_template_type): New. (finish_template_type): Call it. (trait_expr_value, finish_trait_expr): Handle CPTK_IS_SAME_AS. * tree.c (cp_tree_equal): Handle local parameters, CONSTRAINT_INFO. (cp_walk_subtrees): Handle REQUIRES_EXPR. * typeck.c (cp_build_function_call_vec): Check constraints. Co-Authored-By: Braden Obrzut <admin@maniacsvault.net> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r226713
2015-08-07 07:44:49 +02:00
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
if (DECL_CLASS_TEMPLATE_P (t))
dump_type (pp, TREE_TYPE (t),
((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
| (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0)));
else if (DECL_TEMPLATE_RESULT (t)
tree.h (VAR_P): New. * tree.h (VAR_P): New. cp/ * call.c (build_java_interface_fn_ref): Likewise. (make_temporary_var_for_ref_to_temp): Likewise. * class.c (check_field_decls): Likewise. (layout_class_type): Likewise. (finish_struct_1): Likewise. (fixed_type_or_null): Likewise. (get_vtbl_decl_for_binfo): Likewise. * cp-gimplify.c (omp_var_to_track): Likewise. (cp_genericize_r): Likewise. * cp-objcp-common.c (cxx_warn_unused_global_decl): Likewise. * cp-tree.h (LANG_DECL_HAS_MIN): Likewise. (DECL_DISCRIMINATOR_P): Likewise. * decl.c (poplevel): Likewise. (decls_match): Likewise. (duplicate_decls): Likewise. (decl_jump_unsafe): Likewise. (start_decl): Likewise. (check_for_uninitialized_const_var): Likewise. (make_rtl_for_nonlocal_decl): Likewise. (cp_finish_decl): Likewise. (expand_static_init): Likewise. (local_variable_p): Likewise. (maybe_register_incomplete_var): Likewise. * decl2.c (grokfield): Likewise. (comdat_linkage): Likewise. (determine_visibility): Likewise. (import_export_decl): Likewise. (prune_vars_needing_no_initialization): Likewise. (decl_maybe_constant_var_p): Likewise. * error.c (dump_simple_decl): Likewise. (dump_template_decl): Likewise. (cp_printer): Likewise. * except.c (build_throw): Likewise. * init.c (build_vtbl_address): Likewise. (member_init_ok_or_else): Likewise. (build_aggr_init): Likewise. (expand_aggr_init_1): Likewise. (build_offset_ref): Likewise. (constant_value_1): Likewise. * mangle.c (write_mangled_name): Likewise. (write_prefix): Likewise. * name-lookup.c (supplement_binding_1): Likewise. (add_decl_to_level): Likewise. (pushdecl_maybe_friend_1): Likewise. (check_for_out_of_scope_variable): Likewise. (validate_nonmember_using_decl): Likewise. (lookup_name_innermost_nonclass_level_1): Likewise. (lookup_arg_dependent_1): Likewise. * parser.c (cp_parser_lambda_introducer): Likewise. (cp_parser_template_argument): Likewise. (cp_parser_single_declaration): Likewise. * pt.c (convert_nontype_argument): Likewise. (instantiate_class_template_1): Likewise. (tsubst_decl): Likewise. (tsubst_expr): Likewise. (do_decl_instantiation): Likewise. (do_type_instantiation): Likewise. (regenerate_decl_from_template): Likewise. (always_instantiate_p): Likewise. (instantiate_decl): Likewise. (type_dependent_expression_p): Likewise. (build_non_dependent_expr): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_dynamic_cast_1): Likewise. * search.c (shared_member_p): Likewise. * semantics.c (outer_var_p): Likewise. (finish_id_expression): Likewise. (finish_omp_clauses): Likewise. (finish_decltype_type): Likewise. (ensure_literal_type_for_constexpr_object): Likewise. * tree.c (lvalue_kind): Likewise. (bot_replace): Likewise. (cp_tree_equal): Likewise. (handle_init_priority_attribute): Likewise. (decl_storage_duration): Likewise. * typeck.c (cxx_sizeof_expr): Likewise. (cxx_alignof_expr): Likewise. (decay_conversion): Likewise. (build_class_member_access_expr): Likewise. (cp_build_array_ref): Likewise. (cxx_mark_addressable): Likewise. (maybe_warn_about_returning_address_of_local): Likewise. (check_return_expr): Likewise. * typeck2.c (cxx_readonly_error): Likewise. (abstract_virtuals_error_sfinae): Likewise. (cxx_incomplete_type_diagnostic): Likewise. From-SVN: r197240
2013-03-29 17:09:35 +01:00
&& (VAR_P (DECL_TEMPLATE_RESULT (t))
PR c++/45114 - Support C++11 alias-declaration gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-11-07 22:28:50 +01:00
/* Alias template. */
|| DECL_TYPE_TEMPLATE_P (t)))
dump_decl (pp, DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
else
{
call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. * call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. From-SVN: r86778
2004-08-30 17:28:48 +02:00
gcc_assert (TREE_TYPE (t));
switch (NEXT_CODE (t))
{
case METHOD_TYPE:
case FUNCTION_TYPE:
dump_function_decl (pp, t, flags | TFF_TEMPLATE_NAME);
call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. * call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. From-SVN: r86778
2004-08-30 17:28:48 +02:00
break;
default:
/* This case can occur with some invalid code. */
dump_type (pp, TREE_TYPE (t),
call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. * call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. From-SVN: r86778
2004-08-30 17:28:48 +02:00
(flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
| (flags & TFF_DECL_SPECIFIERS
? TFF_CLASS_KEY_OR_ENUM : 0));
}
1994-02-24 02:02:37 +01:00
}
}
/* find_typenames looks through the type of the function template T
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
and returns a vec containing any typedefs, decltypes or TYPENAME_TYPEs
it finds. */
struct find_typenames_t
{
hash_set<tree> *p_set;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *typenames;
};
static tree
find_typenames_r (tree *tp, int *walk_subtrees, void *data)
{
struct find_typenames_t *d = (struct find_typenames_t *)data;
tree mv = NULL_TREE;
if (TYPE_P (*tp) && is_typedef_decl (TYPE_NAME (*tp)))
/* Add the type of the typedef without any additional cv-quals. */
mv = TREE_TYPE (TYPE_NAME (*tp));
else if (TREE_CODE (*tp) == TYPENAME_TYPE
|| TREE_CODE (*tp) == DECLTYPE_TYPE)
/* Add the typename without any cv-qualifiers. */
mv = TYPE_MAIN_VARIANT (*tp);
if (TREE_CODE (*tp) == TYPE_PACK_EXPANSION)
{
/* Don't mess with parameter packs since we don't remember
the pack expansion context for a particular typename. */
*walk_subtrees = false;
return NULL_TREE;
}
if (mv && (mv == *tp || !d->p_set->add (mv)))
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec_safe_push (d->typenames, mv);
/* Search into class template arguments, which cp_walk_subtrees
doesn't do. */
if (CLASS_TYPE_P (*tp) && CLASSTYPE_TEMPLATE_INFO (*tp))
cp_walk_tree (&CLASSTYPE_TI_ARGS (*tp), find_typenames_r,
data, d->p_set);
return NULL_TREE;
}
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
static vec<tree, va_gc> *
find_typenames (tree t)
{
struct find_typenames_t ft;
ft.p_set = new hash_set<tree>;
ft.typenames = NULL;
cp_walk_tree (&TREE_TYPE (DECL_TEMPLATE_RESULT (t)),
find_typenames_r, &ft, ft.p_set);
delete ft.p_set;
return ft.typenames;
}
/* Output the "[with ...]" clause for a template instantiation T iff
TEMPLATE_PARMS, TEMPLATE_ARGS and FLAGS are suitable. T may be NULL if
formatting a deduction/substitution diagnostic rather than an
instantiation. */
static void
dump_substitution (cxx_pretty_printer *pp,
tree t, tree template_parms, tree template_args,
int flags)
{
if (template_parms != NULL_TREE && template_args != NULL_TREE
&& !(flags & TFF_NO_TEMPLATE_BINDINGS))
{
vec<tree, va_gc> *typenames = t ? find_typenames (t) : NULL;
pp_cxx_whitespace (pp);
pp_cxx_left_bracket (pp);
pp->translate_string ("with");
pp_cxx_whitespace (pp);
dump_template_bindings (pp, template_parms, template_args, typenames);
pp_cxx_right_bracket (pp);
}
}
/* Dump the lambda function FN including its 'mutable' qualifier and any
template bindings. */
static void
dump_lambda_function (cxx_pretty_printer *pp,
tree fn, tree template_parms, tree template_args,
int flags)
{
/* A lambda's signature is essentially its "type". */
dump_type (pp, DECL_CONTEXT (fn), flags);
if (!(TYPE_QUALS (class_of_this_parm (TREE_TYPE (fn))) & TYPE_QUAL_CONST))
{
pp->padding = pp_before;
pp_c_ws_string (pp, "mutable");
}
dump_substitution (pp, fn, template_parms, template_args, flags);
}
/* Pretty print a function decl. There are several ways we want to print a
function declaration. The TFF_ bits in FLAGS tells us how to behave.
As error can only apply the '#' flag once to give 0 and 1 for V, there
is %D which doesn't print the throw specs, and %F which does. */
1994-02-24 02:02:37 +01:00
static void
dump_function_decl (cxx_pretty_printer *pp, tree t, int flags)
1994-02-24 02:02:37 +01:00
{
class.c (grow_method): Remove check for redeclaration. * class.c (grow_method): Remove check for redeclaration. Fri Sep 5 01:37:17 1997 Mark Mitchell <mmitchell@usa.net> * cp-tree.h (INNERMOST_TEMPLATE_PARMS): New macro. (DECL_INNERMOST_TEMPLATE_PARMS): Likewise. (PRIMARY_TEMPLATE_P): Use it. * call.c (build_overload_call_real): Use it. * class.c (instantiate_type): Likewise. * decl.c (decls_match): Likewise. * method.c (build_overload_identifier): Likewise. * pt.c (push_template_decl): Likewise. (classtype_mangled_name): Likewise. (lookup_template_class): Likewise. * cp-tree.h (DECL_NTPARMS): Change name from DECL_NT_PARMS to DECL_NTPARMS to conform to usage elsewhere. * call.c (add_template_candidate): Likewise. * class.c (instantiate_type): Likewise. * pt.c (instantiate_template): Likewise. (get_bindings): Likewise. * class.c (grow_method): Use DECL_FUNCTION_TEMPLATE_P instead of is_member_template. * pt.c (unify): Undo changes to allow multiple levels of template parameters. (type_unification): Likewise. (fn_type_unification): Likewise. (get_class_bindings): Likewise. * cp-tree.h (Likewise). * decl.c (replace_defarg): Check that the type of the default parameter does not invlove a template type before complaining about the initialization. * error.c (dump_expr): Deal with template constant parameters in member templates correctly. * pt.c (is_member_template): Deal with class specializations correctly. (tsubst): Handle "partial instantiation" of member templates correctly. Wed Sep 3 12:30:24 1997 Mark Mitchell <mmitchell@usa.net> * pt.c (type_unification): Change calling squence to allow for multiple levels of template parameters. (tsubst_expr): Likewise. (tsubst): Likewise. (tsubst_copy): Likewise. (instantiate_template): Likewise. (unify): Likewise. * call.c (build_overload_call_real): Use it. (add_builtin_candidate): Use it. (build_new_method_call): Use it. * class.c (instantiate_type): Use it. * decl.c (grokdeclarator): Use it. * decl2.c (finish_file): Use it. * method.c (build_overload_identifier): Use it. * call.c (add_template_candidate): Add additional parameter for the function return type. Call fn_type_unification istead of type_unification. (build_user_type_conversion_1): Handle member templates. (build_new_function_call): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. * class.c (grow_method): Don't give an error message indicating that two member templates with the same name are ambiguous. (finish_struct): Treat member template functions just like member functions. * cp-tree.h (check_member_template): Add declaration. (begin_member_template_processing): Likewise. (end_member_template_processing): Likewise. (fn_type_unification): Likewise. (is_member_template): Likewise. (tsubst): Change prototype. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (instantiate_template): Likewise. (get_bindings): Likewise. * decl.c (decls_match): Handle multiple levels of template parameters. (pushdecl): Handle template type params just like other type declarations. (push_class_level_binding): Return immediately if the class_binding_level is NULL. (grokfndecl): If check_classfn() returns a member_template, use the result of the template, not the template itself. * decl2.c (check_member_template): New function. Check to see that the entity declared to be a member template can be one. (check_classfn): Allow redeclaration of member template functions with different types; the new functions can be specializations or explicit instantiations. * error.c (dump_decl): Handle multiple levels of template parameters. (dump_function_decl): Update to handle function templates. * lex.c (do_pending_inlines): Set up template parameter context for member templates. (process_next_inline): Likewise. * method. (build_overload_identifier): Adjust for multiple levels of template parameters. * parse.y (fn.def2): Add member templates. (component_decl_1): Likewise. * pt.c (begin_member_template_processing): New function. (end_member_template_processing): Likewise. (is_member_template): Likewise. (fn_type_unification): Likewise. (current_template_parms): Return a vector of all the template parms, not just the innermost level of parms. (push_template_decl): Deal with the possibility of member templates. (lookup_template_class): Likewise. (uses_template_parms): Likewise. (tsubst): Modify processing to TEMPLATE_TYPE_PARM and TEMPLATE_CONST_PARM to deal with multiple levels of template arguments. Add processing of TEMPLATE_DECL to produce new TEMPLATE_DECLs from old ones. (do_decl_instantiation): Handle member templates. * search.c (lookup_fnfields_1): Handle member template conversion operators. * tree.c (cp_tree_equal): Check the levels, as well as the indices, of TEMPLATE_CONST_PARMs. * typeck.c (comptypes): Check the levels, as well as the indices, fo TEMPLATE_TYPE_PARMs. (build_x_function_call): Treat member templates like member functions. Member templates. From-SVN: r15130
1997-09-06 10:10:07 +02:00
tree fntype;
tree parmtypes;
1994-02-24 02:02:37 +01:00
tree cname = NULL_TREE;
tree template_args = NULL_TREE;
tree template_parms = NULL_TREE;
int show_return = flags & TFF_RETURN_TYPE || flags & TFF_DECL_SPECIFIERS;
int do_outer_scope = ! (flags & TFF_UNQUALIFIED_NAME);
tree exceptions;
bool constexpr_p;
tree ret = NULL_TREE;
flags &= ~(TFF_UNQUALIFIED_NAME | TFF_TEMPLATE_NAME);
class.c (grow_method): Remove check for redeclaration. * class.c (grow_method): Remove check for redeclaration. Fri Sep 5 01:37:17 1997 Mark Mitchell <mmitchell@usa.net> * cp-tree.h (INNERMOST_TEMPLATE_PARMS): New macro. (DECL_INNERMOST_TEMPLATE_PARMS): Likewise. (PRIMARY_TEMPLATE_P): Use it. * call.c (build_overload_call_real): Use it. * class.c (instantiate_type): Likewise. * decl.c (decls_match): Likewise. * method.c (build_overload_identifier): Likewise. * pt.c (push_template_decl): Likewise. (classtype_mangled_name): Likewise. (lookup_template_class): Likewise. * cp-tree.h (DECL_NTPARMS): Change name from DECL_NT_PARMS to DECL_NTPARMS to conform to usage elsewhere. * call.c (add_template_candidate): Likewise. * class.c (instantiate_type): Likewise. * pt.c (instantiate_template): Likewise. (get_bindings): Likewise. * class.c (grow_method): Use DECL_FUNCTION_TEMPLATE_P instead of is_member_template. * pt.c (unify): Undo changes to allow multiple levels of template parameters. (type_unification): Likewise. (fn_type_unification): Likewise. (get_class_bindings): Likewise. * cp-tree.h (Likewise). * decl.c (replace_defarg): Check that the type of the default parameter does not invlove a template type before complaining about the initialization. * error.c (dump_expr): Deal with template constant parameters in member templates correctly. * pt.c (is_member_template): Deal with class specializations correctly. (tsubst): Handle "partial instantiation" of member templates correctly. Wed Sep 3 12:30:24 1997 Mark Mitchell <mmitchell@usa.net> * pt.c (type_unification): Change calling squence to allow for multiple levels of template parameters. (tsubst_expr): Likewise. (tsubst): Likewise. (tsubst_copy): Likewise. (instantiate_template): Likewise. (unify): Likewise. * call.c (build_overload_call_real): Use it. (add_builtin_candidate): Use it. (build_new_method_call): Use it. * class.c (instantiate_type): Use it. * decl.c (grokdeclarator): Use it. * decl2.c (finish_file): Use it. * method.c (build_overload_identifier): Use it. * call.c (add_template_candidate): Add additional parameter for the function return type. Call fn_type_unification istead of type_unification. (build_user_type_conversion_1): Handle member templates. (build_new_function_call): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. * class.c (grow_method): Don't give an error message indicating that two member templates with the same name are ambiguous. (finish_struct): Treat member template functions just like member functions. * cp-tree.h (check_member_template): Add declaration. (begin_member_template_processing): Likewise. (end_member_template_processing): Likewise. (fn_type_unification): Likewise. (is_member_template): Likewise. (tsubst): Change prototype. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (instantiate_template): Likewise. (get_bindings): Likewise. * decl.c (decls_match): Handle multiple levels of template parameters. (pushdecl): Handle template type params just like other type declarations. (push_class_level_binding): Return immediately if the class_binding_level is NULL. (grokfndecl): If check_classfn() returns a member_template, use the result of the template, not the template itself. * decl2.c (check_member_template): New function. Check to see that the entity declared to be a member template can be one. (check_classfn): Allow redeclaration of member template functions with different types; the new functions can be specializations or explicit instantiations. * error.c (dump_decl): Handle multiple levels of template parameters. (dump_function_decl): Update to handle function templates. * lex.c (do_pending_inlines): Set up template parameter context for member templates. (process_next_inline): Likewise. * method. (build_overload_identifier): Adjust for multiple levels of template parameters. * parse.y (fn.def2): Add member templates. (component_decl_1): Likewise. * pt.c (begin_member_template_processing): New function. (end_member_template_processing): Likewise. (is_member_template): Likewise. (fn_type_unification): Likewise. (current_template_parms): Return a vector of all the template parms, not just the innermost level of parms. (push_template_decl): Deal with the possibility of member templates. (lookup_template_class): Likewise. (uses_template_parms): Likewise. (tsubst): Modify processing to TEMPLATE_TYPE_PARM and TEMPLATE_CONST_PARM to deal with multiple levels of template arguments. Add processing of TEMPLATE_DECL to produce new TEMPLATE_DECLs from old ones. (do_decl_instantiation): Handle member templates. * search.c (lookup_fnfields_1): Handle member template conversion operators. * tree.c (cp_tree_equal): Check the levels, as well as the indices, of TEMPLATE_CONST_PARMs. * typeck.c (comptypes): Check the levels, as well as the indices, fo TEMPLATE_TYPE_PARMs. (build_x_function_call): Treat member templates like member functions. Member templates. From-SVN: r15130
1997-09-06 10:10:07 +02:00
if (TREE_CODE (t) == TEMPLATE_DECL)
t = DECL_TEMPLATE_RESULT (t);
/* Save the exceptions, in case t is a specialization and we are
emitting an error about incompatible specifications. */
exceptions = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (t));
/* Likewise for the constexpr specifier, in case t is a specialization. */
constexpr_p = DECL_DECLARED_CONSTEXPR_P (t);
/* Pretty print template instantiations only. */
if (DECL_USE_TEMPLATE (t) && DECL_TEMPLATE_INFO (t)
&& !(flags & TFF_NO_TEMPLATE_BINDINGS)
&& flag_pretty_templates)
{
tree tmpl;
template_args = DECL_TI_ARGS (t);
tmpl = most_general_template (t);
if (tmpl && TREE_CODE (tmpl) == TEMPLATE_DECL)
{
template_parms = DECL_TEMPLATE_PARMS (tmpl);
t = tmpl;
}
}
if (DECL_NAME (t) && LAMBDA_FUNCTION_P (t))
return dump_lambda_function (pp, t, template_parms, template_args, flags);
class.c (grow_method): Remove check for redeclaration. * class.c (grow_method): Remove check for redeclaration. Fri Sep 5 01:37:17 1997 Mark Mitchell <mmitchell@usa.net> * cp-tree.h (INNERMOST_TEMPLATE_PARMS): New macro. (DECL_INNERMOST_TEMPLATE_PARMS): Likewise. (PRIMARY_TEMPLATE_P): Use it. * call.c (build_overload_call_real): Use it. * class.c (instantiate_type): Likewise. * decl.c (decls_match): Likewise. * method.c (build_overload_identifier): Likewise. * pt.c (push_template_decl): Likewise. (classtype_mangled_name): Likewise. (lookup_template_class): Likewise. * cp-tree.h (DECL_NTPARMS): Change name from DECL_NT_PARMS to DECL_NTPARMS to conform to usage elsewhere. * call.c (add_template_candidate): Likewise. * class.c (instantiate_type): Likewise. * pt.c (instantiate_template): Likewise. (get_bindings): Likewise. * class.c (grow_method): Use DECL_FUNCTION_TEMPLATE_P instead of is_member_template. * pt.c (unify): Undo changes to allow multiple levels of template parameters. (type_unification): Likewise. (fn_type_unification): Likewise. (get_class_bindings): Likewise. * cp-tree.h (Likewise). * decl.c (replace_defarg): Check that the type of the default parameter does not invlove a template type before complaining about the initialization. * error.c (dump_expr): Deal with template constant parameters in member templates correctly. * pt.c (is_member_template): Deal with class specializations correctly. (tsubst): Handle "partial instantiation" of member templates correctly. Wed Sep 3 12:30:24 1997 Mark Mitchell <mmitchell@usa.net> * pt.c (type_unification): Change calling squence to allow for multiple levels of template parameters. (tsubst_expr): Likewise. (tsubst): Likewise. (tsubst_copy): Likewise. (instantiate_template): Likewise. (unify): Likewise. * call.c (build_overload_call_real): Use it. (add_builtin_candidate): Use it. (build_new_method_call): Use it. * class.c (instantiate_type): Use it. * decl.c (grokdeclarator): Use it. * decl2.c (finish_file): Use it. * method.c (build_overload_identifier): Use it. * call.c (add_template_candidate): Add additional parameter for the function return type. Call fn_type_unification istead of type_unification. (build_user_type_conversion_1): Handle member templates. (build_new_function_call): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. * class.c (grow_method): Don't give an error message indicating that two member templates with the same name are ambiguous. (finish_struct): Treat member template functions just like member functions. * cp-tree.h (check_member_template): Add declaration. (begin_member_template_processing): Likewise. (end_member_template_processing): Likewise. (fn_type_unification): Likewise. (is_member_template): Likewise. (tsubst): Change prototype. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (instantiate_template): Likewise. (get_bindings): Likewise. * decl.c (decls_match): Handle multiple levels of template parameters. (pushdecl): Handle template type params just like other type declarations. (push_class_level_binding): Return immediately if the class_binding_level is NULL. (grokfndecl): If check_classfn() returns a member_template, use the result of the template, not the template itself. * decl2.c (check_member_template): New function. Check to see that the entity declared to be a member template can be one. (check_classfn): Allow redeclaration of member template functions with different types; the new functions can be specializations or explicit instantiations. * error.c (dump_decl): Handle multiple levels of template parameters. (dump_function_decl): Update to handle function templates. * lex.c (do_pending_inlines): Set up template parameter context for member templates. (process_next_inline): Likewise. * method. (build_overload_identifier): Adjust for multiple levels of template parameters. * parse.y (fn.def2): Add member templates. (component_decl_1): Likewise. * pt.c (begin_member_template_processing): New function. (end_member_template_processing): Likewise. (is_member_template): Likewise. (fn_type_unification): Likewise. (current_template_parms): Return a vector of all the template parms, not just the innermost level of parms. (push_template_decl): Deal with the possibility of member templates. (lookup_template_class): Likewise. (uses_template_parms): Likewise. (tsubst): Modify processing to TEMPLATE_TYPE_PARM and TEMPLATE_CONST_PARM to deal with multiple levels of template arguments. Add processing of TEMPLATE_DECL to produce new TEMPLATE_DECLs from old ones. (do_decl_instantiation): Handle member templates. * search.c (lookup_fnfields_1): Handle member template conversion operators. * tree.c (cp_tree_equal): Check the levels, as well as the indices, of TEMPLATE_CONST_PARMs. * typeck.c (comptypes): Check the levels, as well as the indices, fo TEMPLATE_TYPE_PARMs. (build_x_function_call): Treat member templates like member functions. Member templates. From-SVN: r15130
1997-09-06 10:10:07 +02:00
fntype = TREE_TYPE (t);
Do put the VTT parameter in DECL_ARGUMENTS. * cp-tree.h (struct cp_language_function): Add x_vtt_parm. (current_vtt_parm): New macro. (struct lang_decl_flags): Add has_vtt_parm_p, remove vtt_parm. (DECL_HAS_VTT_PARM_P): New macro. (DECL_VTT_PARM): Remove. (FUNCTION_FIRST_USER_PARMTYPE, FUNCTION_FIRST_USER_PARM): New macros. * decl.c (duplicate_decls): Only copy the operator code if appropriate. (start_function): Set current_vtt_parm. (lang_mark_tree): Don't mark vtt_parm. * decl2.c (maybe_retrofit_in_chrg): Do add the VTT parm to DECL_ARGUMENTS. Set DECL_HAS_VTT_PARM_P. * class.c (build_clone): Maybe remove the VTT parm. * optimize.c (maybe_clone_body): Set up the VTT parm. * pt.c (copy_default_args_to_explicit_spec): Preserve the VTT parm. * call.c (build_over_call): Just allow the VTT arg. * method.c (make_thunk): Don't set DECL_VTT_PARM. (do_build_copy_constructor): Use FUNCTION_FIRST_USER_PARM. (synthesize_method): Use FUNCTION_FIRST_USER_PARMTYPE. * decl.c (grokdeclarator, copy_args_p, grok_ctor_properties): Likewise. * error.c (dump_function_decl): Likewise. * call.c (build_user_type_conversion_1, convert_like_real): Abort if we try to call a constructor with in-charge or VTT parms. * method.c (skip_artificial_parms_for): New fn. * call.c (add_function_candidate, build_over_call): Call it. * call.c (build_new_method_call): Use current_vtt_parm. * init.c (expand_virtual_init): Likewise. * class.c (same_signature_p): No longer static. * cp-tree.h: Declare it. * search.c (look_for_overrides_r): Use it. From-SVN: r39841
2001-02-18 20:08:00 +01:00
parmtypes = FUNCTION_FIRST_USER_PARMTYPE (t);
class.c (grow_method): Remove check for redeclaration. * class.c (grow_method): Remove check for redeclaration. Fri Sep 5 01:37:17 1997 Mark Mitchell <mmitchell@usa.net> * cp-tree.h (INNERMOST_TEMPLATE_PARMS): New macro. (DECL_INNERMOST_TEMPLATE_PARMS): Likewise. (PRIMARY_TEMPLATE_P): Use it. * call.c (build_overload_call_real): Use it. * class.c (instantiate_type): Likewise. * decl.c (decls_match): Likewise. * method.c (build_overload_identifier): Likewise. * pt.c (push_template_decl): Likewise. (classtype_mangled_name): Likewise. (lookup_template_class): Likewise. * cp-tree.h (DECL_NTPARMS): Change name from DECL_NT_PARMS to DECL_NTPARMS to conform to usage elsewhere. * call.c (add_template_candidate): Likewise. * class.c (instantiate_type): Likewise. * pt.c (instantiate_template): Likewise. (get_bindings): Likewise. * class.c (grow_method): Use DECL_FUNCTION_TEMPLATE_P instead of is_member_template. * pt.c (unify): Undo changes to allow multiple levels of template parameters. (type_unification): Likewise. (fn_type_unification): Likewise. (get_class_bindings): Likewise. * cp-tree.h (Likewise). * decl.c (replace_defarg): Check that the type of the default parameter does not invlove a template type before complaining about the initialization. * error.c (dump_expr): Deal with template constant parameters in member templates correctly. * pt.c (is_member_template): Deal with class specializations correctly. (tsubst): Handle "partial instantiation" of member templates correctly. Wed Sep 3 12:30:24 1997 Mark Mitchell <mmitchell@usa.net> * pt.c (type_unification): Change calling squence to allow for multiple levels of template parameters. (tsubst_expr): Likewise. (tsubst): Likewise. (tsubst_copy): Likewise. (instantiate_template): Likewise. (unify): Likewise. * call.c (build_overload_call_real): Use it. (add_builtin_candidate): Use it. (build_new_method_call): Use it. * class.c (instantiate_type): Use it. * decl.c (grokdeclarator): Use it. * decl2.c (finish_file): Use it. * method.c (build_overload_identifier): Use it. * call.c (add_template_candidate): Add additional parameter for the function return type. Call fn_type_unification istead of type_unification. (build_user_type_conversion_1): Handle member templates. (build_new_function_call): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. * class.c (grow_method): Don't give an error message indicating that two member templates with the same name are ambiguous. (finish_struct): Treat member template functions just like member functions. * cp-tree.h (check_member_template): Add declaration. (begin_member_template_processing): Likewise. (end_member_template_processing): Likewise. (fn_type_unification): Likewise. (is_member_template): Likewise. (tsubst): Change prototype. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (instantiate_template): Likewise. (get_bindings): Likewise. * decl.c (decls_match): Handle multiple levels of template parameters. (pushdecl): Handle template type params just like other type declarations. (push_class_level_binding): Return immediately if the class_binding_level is NULL. (grokfndecl): If check_classfn() returns a member_template, use the result of the template, not the template itself. * decl2.c (check_member_template): New function. Check to see that the entity declared to be a member template can be one. (check_classfn): Allow redeclaration of member template functions with different types; the new functions can be specializations or explicit instantiations. * error.c (dump_decl): Handle multiple levels of template parameters. (dump_function_decl): Update to handle function templates. * lex.c (do_pending_inlines): Set up template parameter context for member templates. (process_next_inline): Likewise. * method. (build_overload_identifier): Adjust for multiple levels of template parameters. * parse.y (fn.def2): Add member templates. (component_decl_1): Likewise. * pt.c (begin_member_template_processing): New function. (end_member_template_processing): Likewise. (is_member_template): Likewise. (fn_type_unification): Likewise. (current_template_parms): Return a vector of all the template parms, not just the innermost level of parms. (push_template_decl): Deal with the possibility of member templates. (lookup_template_class): Likewise. (uses_template_parms): Likewise. (tsubst): Modify processing to TEMPLATE_TYPE_PARM and TEMPLATE_CONST_PARM to deal with multiple levels of template arguments. Add processing of TEMPLATE_DECL to produce new TEMPLATE_DECLs from old ones. (do_decl_instantiation): Handle member templates. * search.c (lookup_fnfields_1): Handle member template conversion operators. * tree.c (cp_tree_equal): Check the levels, as well as the indices, of TEMPLATE_CONST_PARMs. * typeck.c (comptypes): Check the levels, as well as the indices, fo TEMPLATE_TYPE_PARMs. (build_x_function_call): Treat member templates like member functions. Member templates. From-SVN: r15130
1997-09-06 10:10:07 +02:00
if (DECL_CLASS_SCOPE_P (t))
Make DECL_CONTEXT mean the class in which a member function was declared, even for a virtual function. Make DECL_CONTEXT mean the class in which a member function was declared, even for a virtual function. * cp-tree.h (DECL_CLASS_CONTEXT): Adjust. (DECL_FRIEND_CONTEXT): New macro. (DECL_REAL_CONTEXT): Remove. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Adjust. (DECL_CLASS_SCOPE_P): Use TYPE_P. (add_friends): Remove. (hack_decl_function_context): Likewise. * call.c (build_new_function_call): Replace DECL_REAL_CONTEXT with CP_DECL_CONTEXT. (build_over_call): Fix indentation. Use DECL_CONTEXT instead of DECL_CLASS_CONTEXT. * class.c (dfs_build_vcall_offset_vtbl_entries): Likewise. (add_method): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT. (strictly_overrides): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (build_vtbl_or_vbase_field): Don't set DECL_CLASS_CONTEXT. (build_base_field): Likewise. (finish_struct_1): Likewise. (build_self_reference): Likewise. * decl.c (push_class_binding): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (pushtag): Use decl_function_context, not hack_decl_function_context. (decls_match): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (duplicate_decls): Use DECL_VIRTUAL_CONTEXT. (pushdecl): Remove bogus code. (start_decl): Use DECL_CONTEXT rather than DECL_CLASS_CONTEXT. (cp_finish_decl): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (grokfndecl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. Use decl_function_context, nothack_decl_function_context. (grokvardecl): Don't set DECL_CLASS_CONTEXT. (grokdeclarator): Likewise. Use decl_function_context, not hack_decl_function_context. (copy_args_p): Document. Don't use DECL_CLASS_CONTEXT. (start_function): Use DECL_FRIEND_CONTEXT, not DECL_CLASS_CONTEXT. Use decl_function_context, not hack_decl_function_context. (finish_function): Use decl_function_context, not hack_decl_function_context. (maybe_retrofit_in_chrg): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (grokclassfn): Set DECL_VIRTUAL_CONTEXT, not DECL_CONTEXT. (finish_static_data_member_decl): Don't set DECL_CLASS_CONTEXT. (grokfield): Likewise. (finish_builtin_type): Likewise. (finish_vtable_vardec): Use decl_function_context, not hack_decl_function_context. (import_export_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (start_static_initialization_or_destruction): Likewise. (finish_static_initialization_or_destruction): Likewise. (mark_used): Adjust logic for deciding when to synthesize methods. * dump.c (dequeue_and_dump): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. * error.c (dump_function_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. * friend.c (is_friend): Likewise. (add_friends): Remove. (do_friend): Use SET_DECL_FRIEND_CONTEXT. * lex.c (begin_definition_of_inclass_inline): Use decl_function_context, not hack_decl_function_context. (process_next_inline): Likewise. (do_identifier): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. * method.c (set_mangled_name_for_decl): Use DECL_CONTEXT, not DECL_CLASSS_CONTEXT. (hack_identifier): Likewise. (synthesize_method): Use decl_function_context, not hack_decl_function_context. * pt.c (template_class_depth_real): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (is_member_template): Use decl_function_context, not hack_decl_function_context. Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (build_template_decl): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT. (check_default_tmpl_args): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (push_template_decl_real): Likewise. (instantiate_class_template): Don't call add_friends. (tsubst_default_argument): Use DECL_CONTEXT, not DECL_REAL_CONTEXT. (tsubst_decl): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT. Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (set_meangled_name_for_template_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. * repo.c (repo_inline_used): Likewise. * search.c (current_scope): Adjust for new _CONTEXT macros. (context_for_name_lookup): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (friend_accessible_p): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (lookup_fnfields_here):Likewise. (check_final_overrider): Likewise. (init_vbase_pointers): Likewise. (virtual_context): Likewise. * semantics.c (finish_member_declaration): Just set DECL_CONTEXT. (expand_body): Use decl_function_context, not hack_decl_function_context. * tree.c (hack_decl_function_context): Remove. * typeck.c (build_x_function_call): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. * typeck2.c (error_not_base_type): Likewise. From-SVN: r32018
2000-02-17 00:54:23 +01:00
cname = DECL_CONTEXT (t);
/* This is for partially instantiated template methods. */
1994-02-24 02:02:37 +01:00
else if (TREE_CODE (fntype) == METHOD_TYPE)
cname = TREE_TYPE (TREE_VALUE (parmtypes));
if (flags & TFF_DECL_SPECIFIERS)
{
if (DECL_STATIC_FUNCTION_P (t))
pp_cxx_ws_string (pp, "static");
else if (DECL_VIRTUAL_P (t))
pp_cxx_ws_string (pp, "virtual");
if (constexpr_p)
Improving concepts performance and diagnostics. PR c++/67565 PR c++/67579 PR c++/71843 gcc/ * timevar.def (TV_CONSTRAINT_SAT, TV_CONSTRAINT_SUB): New time vars for constraint satisfaction and subsumption. * timevar.h (auto_timevar): New constructor that matches the push/pop pattern of usage in pt.c. gcc/cp/ * cp-tree.def (CHECK_CONSTR): New. * cp-tree.h (CHECK_CONSTR_CONCEPT): New. (CHECK_CONSTR_ARGS): New. * constraint.cc (make_predicate_constraint): Remove in favor of normalize_expression. (resolve_constraint_check): Actually return error_mark_node when resolution fails. (resolve_variable_concept_check): Perform coercion as if processing a template. Also return errors on resolution failure. (lift_*): Remove all of these functions. Don't unnecessarily inline concepts. (learn_*): Add facilities to memoize implications for subsumption during normalization. (expanding_concept): New. (expand_concept): New. Return the inlined and normalized definition of a concept when needed. (transform_*, xform_*): Rename to normalize_* to better reflect the responsibility of those functions. (normalize_template_id_expression): Check for non-boolean operands when possible. Generate check constraints instead of normal variable references. (normalize_call_expression): Report errors when resolution fails. (check_for_logical_overloads): Rewrite this check to more accurately report the error. (normalize_atom): Check for overloaded calls and invalid types before determining if the expression refers to a concept. (build_constraints): Don't cache normalized constraints or decmposed assumptions. (finish_shorthand_constraint): Return a normalized expression instead of a predicate constraint. (finish_template_introduction): Same. (placeholder_extract_concept_and_args): Rewrite this since we only ever get check constraints here. (equivalent_placeholder_constraints): Rewrite in terms of check constraints, and handle error_mark_nodes correctly. (tsubst_check_constraint, tsubst_expr_constr, tsubst_type_constr) (tsubst_implicit_conversion_constr) (tsubst_argument_deduction_constr, tsubst_exception_constr) (tsubst_parameterized_constraint, tsubst_constraint): New. (tsbust_conjunection): Replace with tsubst_logical_operator and actually generate the right kind of constraint. (tsubst_requirement_body): Reverse the order of substituted arguments so that they appear in the order written (helps diagnostics). (satisfy_check_constraint): New. (satisfy_conjunction): Simplify. (satisfy_disjunction): Same. (satisfy_constraint_1): Handle check constraints. (eval_constr): New (private) global state. (evaluating_constraints_sentinel): New. Manages eval_constr. (satisfy_constraint): Add timing variables. (satisfy_associated_constraints): Add hooks for memoization. (evaluate_function_concept): Build a check constraint instead of normalizing its definition. (evaluate_variable_concept): Same. (evaluate_constraint_expression): Normalize, but in the current declaration processing context. (evaluating_constraints_p): New. (elide_constraint_failure_p): Actually emit constraint_thresh errors. (diagnose_*): Remove artificial indentation. Add a new parameter to each that tracks the current (complete) constraint prior to any substitutions. (diagnose_expression): Removed. (diagnose_call_expression): Same. (diagnose_template_id): Same. (diagnose_template_id): New. (diagnose_logical_constraint): New. (diagnose_expression_constraint): Show the original expression. (diagnose_type_constraint): Show the original type. (diagnose_implicit_conversion_constraint): Be specific about failures, don't re-diagnose a known-to-be-failed substitutions, and manage elisions properly. (diagnose_argument_deduction_constraint): Same. (diagnose_exception_constraint): Same. (diagnose_parameterized_constraint): Same. (constraint_p): Allow EXPR_PACK_EXPANSION. * logic.cc (next_by_distance): Removed. No longer used. (any_p): Renamed from any_of. (term_entry, term_hasher): New. (term_list): Rewrite to include a hash table for quick lookup. Also, make less stateful. (proof_state): Extend to allow goals to be discharged once satisfied. (non_atomic_constraint_p): New. (any_non_atomic_constraints_p): New. (...rest...): Previous implementation completely replaced with an iterative algorithm that opportunistically prunes the search space before committing to using more memory. * parser.c: (cp_parser_type_parameter): Normalize constraints. (cp_parser_explicit_template_declaration): Same. * pt.c: (finish_template_variable): Be less redundant with this error message. (template_args_equal): No longer static. (tsubst_decl): Don't try to find specializations of variables that have already been instantiated. (build_non_dependent_expr): Avoid infinite recursion during concept expansion. (make_constrained_auto): Normalize constraints. (do_auto_deduction): When doing auto deduction from a partial-concept-id, be sure to include the explicit args checking the constraints. (constraint_sat_*): New. Memoize satisfied constraints. (concept_spec_*): New. Memoize expressions associated with a concept specialization. (constraint_memos, concept_memos): New. (lookup_constraint_satisfaction, memoize_constraint_satisfaction): New. (lookup_concept_satisfaction, memoize_concept_satisfaction): New. (get_concept_expansion, save_concept_expansion): New. (hash_subsumption_args): New. (comp_subsumption_args): New. (subsumption_*): New. Memoize parts of the subsumption relation. (lookup_subsumption_result, save_subsumption_result): New. (init_constraint_processing): Initialize memo tables. (get_constraints): Shortcut if !flag_concepts. * decl.c (grokfndecl): Normalize constraints. * error.c (dump_simple_decl): Print "concept" when appropriate. (dump_function_decl): Same. (dump_template_decl): Don't write requirements when we're not printing the header. (dump_expr): Handle fold expressions. * cxx-pretty-print.c (cxx_pretty_printer::expression): Handle fold expressions. (get_fold_operator): New. (pp_cxx_unary_left_fold_expression): New. (pp_cxx_unary_right_fold_expression): New. (pp_cxx_binary_fold_expression): New. (pp_cxx_check_constraint): New. (pp_cxx_*_constraint): Rewrite the grammar of internal constraints to make them easier to read when debugging. * search.c (accessible_p): Don't shortcut when evaluating constraints. * tree.c (cp_tree_equal): Handle CHECK_CONSTR. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r238558
2016-07-21 08:05:24 +02:00
{
if (DECL_DECLARED_CONCEPT_P (t))
pp_cxx_ws_string (pp, "concept");
else
pp_cxx_ws_string (pp, "constexpr");
}
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* Print the return type? */
if (show_return)
show_return = (!DECL_CONV_FN_P (t) && !DECL_CONSTRUCTOR_P (t)
&& !DECL_DESTRUCTOR_P (t) && !deduction_guide_p (t));
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (show_return)
{
ret = fndecl_declared_return_type (t);
dump_type_prefix (pp, ret, flags);
}
1994-02-24 02:02:37 +01:00
/* Print the function name. */
if (!do_outer_scope)
/* Nothing. */;
else if (cname)
1994-02-24 02:02:37 +01:00
{
dump_type (pp, cname, flags);
pp_cxx_colon_colon (pp);
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
else
dump_scope (pp, CP_DECL_CONTEXT (t), flags);
1994-02-24 02:02:37 +01:00
dump_function_name (pp, t, flags);
if (!(flags & TFF_NO_FUNCTION_ARGUMENTS))
{
dump_parameters (pp, parmtypes, flags);
if (TREE_CODE (fntype) == METHOD_TYPE)
{
pp->padding = pp_before;
pp_cxx_cv_qualifier_seq (pp, class_of_this_parm (fntype));
dump_ref_qualifier (pp, fntype, flags);
}
Implement N4514, C++ Extensions for Transactional Memory. 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-10-04 21:17:19 +02:00
if (tx_safe_fn_type_p (fntype))
{
pp->padding = pp_before;
pp_cxx_ws_string (pp, "transaction_safe");
}
if (flags & TFF_EXCEPTION_SPECIFICATION)
{
pp->padding = pp_before;
dump_exception_spec (pp, exceptions, flags);
}
if (show_return)
dump_type_suffix (pp, ret, flags);
else if (deduction_guide_p (t))
{
pp_cxx_ws_string (pp, "->");
dump_type (pp, TREE_TYPE (TREE_TYPE (t)), flags);
}
Add C++ Concepts TS support. gcc/c-family/ * c-common.c (c_common_reswords): Add __is_same_as, concept, requires. * c-common.h (enum rid): Add RID_IS_SAME_AS, RID_CONCEPT, RID_REQUIRES. (D_CXX_CONCEPTS, D_CXX_CONCEPTS_FLAGS): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_concepts. * c-opts.c (set_std_cxx1z): Set flag_concepts. * c.opt (fconcepts): New. gcc/cp/ * constraint.cc, logic.cc: New files. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add constraint.o and logic.o. (c++.tags): Also process .cc files. * call.c (enum rejection_reason_code): Add rr_constraint_failure. (print_z_candidate): Handle it. (constraint_failure): New. (add_function_candidate): Check constraints. (build_new_function_call): Handle evaluating concepts. (joust): Check more_constrained. * class.c (add_method): Check equivalently_constrained. (build_clone): Copy constraints. (currently_open_class): Return tree. (resolve_address_of_overloaded_function): Check constraints. * constexpr.c (cxx_eval_constant_expression): Handle REQUIRES_EXPR. (potential_constant_expression_1): Likewise. * cp-objcp-common.c (cp_tree_size): Handle CONSTRAINT_INFO. (cp_common_init_ts): Handle WILDCARD_DECL and REQUIRES_EXPR. * cp-tree.def: Add CONSTRAINT_INFO, WILDCARD_DECL, REQUIRES_EXPR, SIMPLE_REQ, TYPE_REQ, COMPOUND_REQ, NESTED_REQ, PRED_CONSTR, EXPR_CONSTR, TYPE_CONSTR, ICONV_CONSTR, DEDUCT_CONSTR, EXCEPT_CONSTR, PARM_CONSTR, CONJ_CONSTR, DISJ_CONSTR. * cp-tree.h (struct tree_constraint_info, check_nonnull) (check_constraint_info, CI_TEMPLATE_REQS, CI_DECLARATOR_REQS) (CI_ASSOCIATED_CONSTRAINTS, CI_NORMALIZED_CONSTRAINTS) (CI_ASSUMPTIONS, TEMPLATE_PARMS_CONSTRAINTS) (TEMPLATE_PARM_CONSTRAINTS, COMPOUND_REQ_NOEXCEPT_P) (PLACEHOLDER_TYPE_CONSTRAINTS, PRED_CONSTR_EXPR, EXPR_CONSTR_EXPR) (TYPE_CONSTR_TYPE, ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE) (DEDUCT_CONSTR_EXPR, DEDUCT_CONSTR_PATTERN) (DEDUCT_CONSTR_PLACEHOLDER, EXCEPT_CONSTR_EXPR, PARM_CONSTR_PARMS) (PARM_CONSTR_OPERAND, CONSTRAINT_VAR_P, CONSTRAINED_PARM_CONCEPT) (CONSTRAINED_PARM_EXTRA_ARGS, CONSTRAINED_PARM_PROTOTYPE) (DECL_DECLARED_CONCEPT_P, WILDCARD_PACK_P, struct cp_unevaluated) (struct local_specialization_stack, enum auto_deduction_context) (variable_concept_p, concept_template_p) (struct deferring_access_check_sentinel): New. (enum cp_tree_node_structure_enum): Add TS_CP_CONSTRAINT_INFO. (union lang_tree_node): Add constraint_info field. (struct lang_decl_base): Add concept_p flag. (enum cp_decl_spec): Add ds_concept. (struct cp_declarator): Add requires_clause. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression) (cxx_pretty_printer::expression): Handle REQUIRES_EXPR, TRAIT_EXPR, *_CONSTR. (pp_cxx_parameter_declaration_clause): Accept a chain of PARM_DECLs. (cxx_pretty_printer::declarator): Print requires-clause. (pp_cxx_template_declaration): Likewise. (pp_cxx_trait_expression): Handle CPTK_IS_SAME_AS. (pp_cxx_requires_clause, pp_cxx_requirement) (pp_cxx_requirement_list, pp_cxx_requirement_body) (pp_cxx_requires_expr, pp_cxx_simple_requirement) (pp_cxx_type_requirement, pp_cxx_compound_requirement) (pp_cxx_nested_requirement, pp_cxx_predicate_constraint) (pp_cxx_expression_constraint, pp_cxx_type_constraint) (pp_cxx_implicit_conversion_constraint) (pp_cxx_argument_deduction_constraint) (pp_cxx_exception_constraint, pp_cxx_parameterized_constraint) (pp_cxx_conjunction, pp_cxx_disjunction, pp_cxx_constraint): New. * cxx-pretty-print.h: Declare them. * decl.c (decls_match): Compare constraints. (duplicate_decls): Likewise. Remove constraints before freeing. (cxx_init_decl_processing): Call init_constraint_processing. (cp_finish_decl): Diagnose concept without initializer. (grokfndecl, grokvardecl): Handle concepts and constraints. (grokdeclarator): Handle concept, requires-clause. (grokparms): No longer static. (xref_tag_1): Check constraints. (finish_function): Call check_function_concept. (cp_tree_node_structure): Handle CONSTRAINT_INFO. (check_concept_refinement, is_concept_var, check_concept_fn): New. * decl2.c (check_classfn): Compare constraints. (mark_used): Don't instantiate concepts. * error.c (dump_template_decl): Print constraints. (dump_function_decl): Likewise. (dump_expr): Handle REQUIRES_EXPR, *_REQ, *_CONSTR. * lex.c (init_reswords): Set D_CXX_CONCEPTS. * method.c (implicitly_declare_fn): Copy constraints from inherited ctor. * parser.h (struct cp_parser): Add in_result_type_constraint_p and prevent_constrained_type_specifiers fields. * parser.c (make_call_declarator): Add requires_clause parm. (cp_parser_new): Clear prevent_constrained_type_specifiers. (cp_parser_primary_expression): Handle RID_IS_SAME_AS, RID_REQUIRES. (cp_parser_postfix_expression): Set prevent_constrained_type_specifiers. (cp_parser_trait_expr): Handle RID_IS_SAME_AS. (cp_parser_declaration): Handle concept introduction. (cp_parser_member_declaration): Likewise. (cp_parser_template_parameter): Handle constrained parameter. (cp_parser_type_parameter): Handle constraints. (cp_parser_decl_specifier_seq): Handle RID_CONCEPT. (cp_parser_template_id): Handle partial concept id. (cp_parser_type_name): Add overload that takes typename_keyword_p. Handle constrained parameter. (cp_parser_nonclass_name): Handle concept names. (cp_parser_alias_declaration): Handle constraints. (cp_parser_late_return_type_opt): Also handle requires-clause. (cp_parser_type_id_1): Handle deduction constraint. (cp_parser_parameter_declaration): Handle constrained parameters. (cp_parser_class_specifier_1): Handle constraints. (cp_parser_template_declaration_after_parameters): Split out from cp_parser_template_declaration_after_export. (cp_parser_single_declaration): Handle constraints. (synthesize_implicit_template_parm): Handle constraints. (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_introduction_list, get_id_declarator) (get_unqualified_id, is_constrained_parameter) (cp_parser_check_constrained_type_parm) (cp_parser_constrained_type_template_parm) (cp_parser_constrained_template_template_parm) (constrained_non_type_template_parm, finish_constrained_parameter) (declares_constrained_type_template_parameter) (declares_constrained_template_template_parameter) (check_type_concept, cp_parser_maybe_constrained_type_specifier) (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_requires_clause, cp_parser_requires_clause_opt) (cp_parser_requires_expression) (cp_parser_requirement_parameter_list, cp_parser_requirement_body) (cp_parser_requirement_list, cp_parser_requirement) (cp_parser_simple_requirement, cp_parser_type_requirement) (cp_parser_compound_requirement, cp_parser_nested_requirement) (cp_parser_template_introduction) (cp_parser_explicit_template_declaration) (get_concept_from_constraint): New. * pt.c (local_specialization_stack): Implement. (maybe_new_partial_specialization): New. (maybe_process_partial_specialization): Use it. (retrieve_local_specialization, register_local_specialization) (template_parm_to_arg, build_template_decl, extract_fnparm_pack) (tsubst_expr): No longer static. (spec_hasher::equal): Compare constraints. (determine_specialization): Handle constraints. (check_explicit_specialization): Handle concepts. (process_template_parm): Handle constraints. (end_template_parm_list): Add overload taking no arguments. (process_partial_specialization): Handle concepts and constraints. Register partial specializations of variable templates. (redeclare_class_template): Handle constraints. (convert_template_argument): Handle WILDCARD_DECL. Check is_compatible_template_arg. (coerce_template_parameter_pack): Handle wildcard packs. (coerce_template_parms): DR 1430 also applies to concepts. Add overloads taking fewer parameters. (lookup_template_class_1): Handle constraints. (lookup_template_variable): Concepts are always bool. (finish_template_variable): Handle concepts and constraints. (tsubst_friend_class): Handle constraints. (gen_elem_of_pack_expansion_instantiation): Handle constraints. (tsubst_pack_expansion): Handle local parameters. (tsubst_decl) [FUNCTION_DECL]: Handle constraints. (tsubst) [TEMPLATE_TYPE_PARM]: Handle deduction constraints. (tsubst_copy_and_build): Handle REQUIRES_EXPR. (more_specialized_fn, more_specialized_partial_spec): Check constraints. (more_specialized_inst): Split out from most_specialized_instantiation. (most_specialized_partial_spec): Check constraints. (instantiate_decl): Never instantiate a concept. (value_dependent_expression_p): Handle REQUIRES_EXPR, TYPE_REQ, variable concepts. (type_dependent_expression_p): Handle WILDCARD_DECL, REQUIRES_EXPR. (instantiation_dependent_r): Handle REQUIRES_EXPR and concepts. (do_auto_deduction): Add overload taking tsubst flags and context enum. Handle constraints. (get_template_for_ordering, most_constrained_function) (is_compatible_template_arg, convert_wildcard_argument) (struct constr_entry, struct constr_hasher, decl_constraints) (valid_constraints_p, get_constraints, set_constraints) (remove_constraints, init_constraint_processing): New. * ptree.c (cxx_print_xnode): Handle CONSTRAINT_INFO. * search.c (lookup_member): Do lookup in the open partial instantiation. * semantics.c (finish_template_template_parm): Handle constraints. (fixup_template_type): New. (finish_template_type): Call it. (trait_expr_value, finish_trait_expr): Handle CPTK_IS_SAME_AS. * tree.c (cp_tree_equal): Handle local parameters, CONSTRAINT_INFO. (cp_walk_subtrees): Handle REQUIRES_EXPR. * typeck.c (cp_build_function_call_vec): Check constraints. Co-Authored-By: Braden Obrzut <admin@maniacsvault.net> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r226713
2015-08-07 07:44:49 +02:00
if (flag_concepts)
if (tree ci = get_constraints (t))
if (tree reqs = CI_DECLARATOR_REQS (ci))
pp_cxx_requires_clause (pp, reqs);
dump_substitution (pp, t, template_parms, template_args, flags);
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
if (tree base = DECL_INHERITED_CTOR_BASE (t))
{
pp_cxx_ws_string (pp, "[inherited from");
dump_type (pp, base, TFF_PLAIN_IDENTIFIER);
pp_character (pp, ']');
}
}
else if (template_args)
{
bool need_comma = false;
int i;
pp_cxx_begin_template_argument_list (pp);
template_args = INNERMOST_TEMPLATE_ARGS (template_args);
for (i = 0; i < TREE_VEC_LENGTH (template_args); ++i)
{
tree arg = TREE_VEC_ELT (template_args, i);
if (need_comma)
pp_separate_with_comma (pp);
if (ARGUMENT_PACK_P (arg))
pp_cxx_left_brace (pp);
dump_template_argument (pp, arg, TFF_PLAIN_IDENTIFIER);
if (ARGUMENT_PACK_P (arg))
pp_cxx_right_brace (pp);
need_comma = true;
}
pp_cxx_end_template_argument_list (pp);
}
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* Print a parameter list. If this is for a member function, the
member object ptr (and any other hidden args) should have
already been removed. */
static void
dump_parameters (cxx_pretty_printer *pp, tree parmtypes, int flags)
{
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
int first = 1;
flags &= ~TFF_SCOPE;
pp_cxx_left_paren (pp);
for (first = 1; parmtypes != void_list_node;
parmtypes = TREE_CHAIN (parmtypes))
{
if (!first)
pp_separate_with_comma (pp);
first = 0;
if (!parmtypes)
{
pp_cxx_ws_string (pp, "...");
break;
}
dump_type (pp, TREE_VALUE (parmtypes), flags);
if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && TREE_PURPOSE (parmtypes))
{
pp_cxx_whitespace (pp);
pp_equal (pp);
pp_cxx_whitespace (pp);
dump_expr (pp, TREE_PURPOSE (parmtypes), flags | TFF_EXPR_IN_PARENS);
}
}
pp_cxx_right_paren (pp);
}
Implement N2439 (ref-qualifiers for 'this') Implement N2439 (ref-qualifiers for 'this') * cp-tree.h (FUNCTION_REF_QUALIFIED): New. (FUNCTION_RVALUE_QUALIFIED): New. (FUNCTION_OR_METHOD_TYPE_CHECK): New. (cpp0x_warn_str): Add CPP0X_REF_QUALIFIER. (cp_ref_qualifier): New enum. (cp_declarator): Add ref_qualifier. * parser.c (cp_parser_ref_qualifier_seq_opt): New. (cp_parser_direct_declarator): Use it. (make_call_declarator): Adjust. (cp_parser_lambda_declarator_opt): Adjust. * call.c (add_function_candidate): Handle ref-qualifier overload resolution semantics. (standard_conversion): Adjust. * class.c (add_method, same_signature_p): Compare ref-qualifiers. * decl.c (grokdeclarator): Handle ref-qualifiers. (grokfndecl): Check for invalid ref-qualifiers. (static_fn_type, revert_static_member_fn): Adjust. * decl2.c (build_memfn_type): Handle ref-qualifiers. (check_classfn): Check them. (cp_reconstruct_complex_type): Retain them. * error.c (dump_ref_qualifier): New. (dump_type_suffix, dump_function_decl): Use it. (maybe_warn_cpp0x): Handle CPP0X_REF_QUALIFIER. * pt.c (tsubst, tsubst_function_type): Instantiate ref-quals. (unify): Retain them. * tree.c (cp_check_qualified_type): New. (cp_build_qualified_type_real): Keep exception spec and ref-qual. (build_ref_qualified_type): New. (strip_typedefs, build_exception_variant): Keep ref-qualifier. (cp_build_type_attribute_variant): Keep ref-qualifier. * typeck.c (merge_types): Keep ref-qualifier. (structural_comptypes): Compare ref-qualifier. (type_memfn_rqual): New. (apply_memfn_quals): Take ref-qual argument. * typeck2.c (build_m_component_ref): Check ref-qualifier. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r197315
2013-04-01 21:04:59 +02:00
/* Print ref-qualifier of a FUNCTION_TYPE or METHOD_TYPE. FLAGS are ignored. */
static void
dump_ref_qualifier (cxx_pretty_printer *pp, tree t, int flags ATTRIBUTE_UNUSED)
Implement N2439 (ref-qualifiers for 'this') Implement N2439 (ref-qualifiers for 'this') * cp-tree.h (FUNCTION_REF_QUALIFIED): New. (FUNCTION_RVALUE_QUALIFIED): New. (FUNCTION_OR_METHOD_TYPE_CHECK): New. (cpp0x_warn_str): Add CPP0X_REF_QUALIFIER. (cp_ref_qualifier): New enum. (cp_declarator): Add ref_qualifier. * parser.c (cp_parser_ref_qualifier_seq_opt): New. (cp_parser_direct_declarator): Use it. (make_call_declarator): Adjust. (cp_parser_lambda_declarator_opt): Adjust. * call.c (add_function_candidate): Handle ref-qualifier overload resolution semantics. (standard_conversion): Adjust. * class.c (add_method, same_signature_p): Compare ref-qualifiers. * decl.c (grokdeclarator): Handle ref-qualifiers. (grokfndecl): Check for invalid ref-qualifiers. (static_fn_type, revert_static_member_fn): Adjust. * decl2.c (build_memfn_type): Handle ref-qualifiers. (check_classfn): Check them. (cp_reconstruct_complex_type): Retain them. * error.c (dump_ref_qualifier): New. (dump_type_suffix, dump_function_decl): Use it. (maybe_warn_cpp0x): Handle CPP0X_REF_QUALIFIER. * pt.c (tsubst, tsubst_function_type): Instantiate ref-quals. (unify): Retain them. * tree.c (cp_check_qualified_type): New. (cp_build_qualified_type_real): Keep exception spec and ref-qual. (build_ref_qualified_type): New. (strip_typedefs, build_exception_variant): Keep ref-qualifier. (cp_build_type_attribute_variant): Keep ref-qualifier. * typeck.c (merge_types): Keep ref-qualifier. (structural_comptypes): Compare ref-qualifier. (type_memfn_rqual): New. (apply_memfn_quals): Take ref-qual argument. * typeck2.c (build_m_component_ref): Check ref-qualifier. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r197315
2013-04-01 21:04:59 +02:00
{
if (FUNCTION_REF_QUALIFIED (t))
{
pp->padding = pp_before;
Implement N2439 (ref-qualifiers for 'this') Implement N2439 (ref-qualifiers for 'this') * cp-tree.h (FUNCTION_REF_QUALIFIED): New. (FUNCTION_RVALUE_QUALIFIED): New. (FUNCTION_OR_METHOD_TYPE_CHECK): New. (cpp0x_warn_str): Add CPP0X_REF_QUALIFIER. (cp_ref_qualifier): New enum. (cp_declarator): Add ref_qualifier. * parser.c (cp_parser_ref_qualifier_seq_opt): New. (cp_parser_direct_declarator): Use it. (make_call_declarator): Adjust. (cp_parser_lambda_declarator_opt): Adjust. * call.c (add_function_candidate): Handle ref-qualifier overload resolution semantics. (standard_conversion): Adjust. * class.c (add_method, same_signature_p): Compare ref-qualifiers. * decl.c (grokdeclarator): Handle ref-qualifiers. (grokfndecl): Check for invalid ref-qualifiers. (static_fn_type, revert_static_member_fn): Adjust. * decl2.c (build_memfn_type): Handle ref-qualifiers. (check_classfn): Check them. (cp_reconstruct_complex_type): Retain them. * error.c (dump_ref_qualifier): New. (dump_type_suffix, dump_function_decl): Use it. (maybe_warn_cpp0x): Handle CPP0X_REF_QUALIFIER. * pt.c (tsubst, tsubst_function_type): Instantiate ref-quals. (unify): Retain them. * tree.c (cp_check_qualified_type): New. (cp_build_qualified_type_real): Keep exception spec and ref-qual. (build_ref_qualified_type): New. (strip_typedefs, build_exception_variant): Keep ref-qualifier. (cp_build_type_attribute_variant): Keep ref-qualifier. * typeck.c (merge_types): Keep ref-qualifier. (structural_comptypes): Compare ref-qualifier. (type_memfn_rqual): New. (apply_memfn_quals): Take ref-qual argument. * typeck2.c (build_m_component_ref): Check ref-qualifier. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r197315
2013-04-01 21:04:59 +02:00
if (FUNCTION_RVALUE_QUALIFIED (t))
pp_cxx_ws_string (pp, "&&");
Implement N2439 (ref-qualifiers for 'this') Implement N2439 (ref-qualifiers for 'this') * cp-tree.h (FUNCTION_REF_QUALIFIED): New. (FUNCTION_RVALUE_QUALIFIED): New. (FUNCTION_OR_METHOD_TYPE_CHECK): New. (cpp0x_warn_str): Add CPP0X_REF_QUALIFIER. (cp_ref_qualifier): New enum. (cp_declarator): Add ref_qualifier. * parser.c (cp_parser_ref_qualifier_seq_opt): New. (cp_parser_direct_declarator): Use it. (make_call_declarator): Adjust. (cp_parser_lambda_declarator_opt): Adjust. * call.c (add_function_candidate): Handle ref-qualifier overload resolution semantics. (standard_conversion): Adjust. * class.c (add_method, same_signature_p): Compare ref-qualifiers. * decl.c (grokdeclarator): Handle ref-qualifiers. (grokfndecl): Check for invalid ref-qualifiers. (static_fn_type, revert_static_member_fn): Adjust. * decl2.c (build_memfn_type): Handle ref-qualifiers. (check_classfn): Check them. (cp_reconstruct_complex_type): Retain them. * error.c (dump_ref_qualifier): New. (dump_type_suffix, dump_function_decl): Use it. (maybe_warn_cpp0x): Handle CPP0X_REF_QUALIFIER. * pt.c (tsubst, tsubst_function_type): Instantiate ref-quals. (unify): Retain them. * tree.c (cp_check_qualified_type): New. (cp_build_qualified_type_real): Keep exception spec and ref-qual. (build_ref_qualified_type): New. (strip_typedefs, build_exception_variant): Keep ref-qualifier. (cp_build_type_attribute_variant): Keep ref-qualifier. * typeck.c (merge_types): Keep ref-qualifier. (structural_comptypes): Compare ref-qualifier. (type_memfn_rqual): New. (apply_memfn_quals): Take ref-qual argument. * typeck2.c (build_m_component_ref): Check ref-qualifier. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r197315
2013-04-01 21:04:59 +02:00
else
pp_cxx_ws_string (pp, "&");
Implement N2439 (ref-qualifiers for 'this') Implement N2439 (ref-qualifiers for 'this') * cp-tree.h (FUNCTION_REF_QUALIFIED): New. (FUNCTION_RVALUE_QUALIFIED): New. (FUNCTION_OR_METHOD_TYPE_CHECK): New. (cpp0x_warn_str): Add CPP0X_REF_QUALIFIER. (cp_ref_qualifier): New enum. (cp_declarator): Add ref_qualifier. * parser.c (cp_parser_ref_qualifier_seq_opt): New. (cp_parser_direct_declarator): Use it. (make_call_declarator): Adjust. (cp_parser_lambda_declarator_opt): Adjust. * call.c (add_function_candidate): Handle ref-qualifier overload resolution semantics. (standard_conversion): Adjust. * class.c (add_method, same_signature_p): Compare ref-qualifiers. * decl.c (grokdeclarator): Handle ref-qualifiers. (grokfndecl): Check for invalid ref-qualifiers. (static_fn_type, revert_static_member_fn): Adjust. * decl2.c (build_memfn_type): Handle ref-qualifiers. (check_classfn): Check them. (cp_reconstruct_complex_type): Retain them. * error.c (dump_ref_qualifier): New. (dump_type_suffix, dump_function_decl): Use it. (maybe_warn_cpp0x): Handle CPP0X_REF_QUALIFIER. * pt.c (tsubst, tsubst_function_type): Instantiate ref-quals. (unify): Retain them. * tree.c (cp_check_qualified_type): New. (cp_build_qualified_type_real): Keep exception spec and ref-qual. (build_ref_qualified_type): New. (strip_typedefs, build_exception_variant): Keep ref-qualifier. (cp_build_type_attribute_variant): Keep ref-qualifier. * typeck.c (merge_types): Keep ref-qualifier. (structural_comptypes): Compare ref-qualifier. (type_memfn_rqual): New. (apply_memfn_quals): Take ref-qual argument. * typeck2.c (build_m_component_ref): Check ref-qualifier. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r197315
2013-04-01 21:04:59 +02:00
}
}
/* Print an exception specification. T is the exception specification. */
static void
dump_exception_spec (cxx_pretty_printer *pp, tree t, int flags)
{
if (t && TREE_PURPOSE (t))
{
pp_cxx_ws_string (pp, "noexcept");
if (!integer_onep (TREE_PURPOSE (t)))
{
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
if (DEFERRED_NOEXCEPT_SPEC_P (t))
pp_cxx_ws_string (pp, "<uninstantiated>");
else
dump_expr (pp, TREE_PURPOSE (t), flags);
pp_cxx_right_paren (pp);
}
}
else if (t)
{
pp_cxx_ws_string (pp, "throw");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
if (TREE_VALUE (t) != NULL_TREE)
while (1)
{
dump_type (pp, TREE_VALUE (t), flags);
t = TREE_CHAIN (t);
if (!t)
break;
pp_separate_with_comma (pp);
}
pp_cxx_right_paren (pp);
}
1994-02-24 02:02:37 +01:00
}
/* Handle the function name for a FUNCTION_DECL node, grokking operators
and destructors properly. */
1996-07-11 03:13:25 +02:00
1994-02-24 02:02:37 +01:00
static void
dump_function_name (cxx_pretty_printer *pp, tree t, int flags)
1994-02-24 02:02:37 +01:00
{
tree name = DECL_NAME (t);
/* We can get here with a decl that was synthesized by language-
independent machinery (e.g. coverage.c) in which case it won't
have a lang_specific structure attached and DECL_CONSTRUCTOR_P
will crash. In this case it is safe just to print out the
literal name. */
if (!DECL_LANG_SPECIFIC (t))
{
pp_cxx_tree_identifier (pp, name);
return;
}
if (TREE_CODE (t) == TEMPLATE_DECL)
t = DECL_TEMPLATE_RESULT (t);
/* Don't let the user see __comp_ctor et al. */
if (DECL_CONSTRUCTOR_P (t)
|| DECL_DESTRUCTOR_P (t))
{
if (LAMBDA_TYPE_P (DECL_CONTEXT (t)))
name = get_identifier ("<lambda>");
else if (TYPE_UNNAMED_P (DECL_CONTEXT (t)))
name = get_identifier ("<constructor>");
else
name = constructor_name (DECL_CONTEXT (t));
}
if (DECL_DESTRUCTOR_P (t))
1994-02-24 02:02:37 +01:00
{
pp_cxx_complement (pp);
dump_decl (pp, name, TFF_PLAIN_IDENTIFIER);
1994-02-24 02:02:37 +01:00
}
else if (DECL_CONV_FN_P (t))
1994-02-24 02:02:37 +01:00
{
/* This cannot use the hack that the operator's return
type is stashed off of its name because it may be
used for error reporting. In the case of conflicting
declarations, both will have the same name, yet
the types will be different, hence the TREE_TYPE field
of the first name will be clobbered by the second. */
pp_cxx_ws_string (pp, "operator");
dump_type (pp, TREE_TYPE (TREE_TYPE (t)), flags);
1994-02-24 02:02:37 +01:00
}
else
dump_decl (pp, name, flags);
[multiple changes] Sat Sep 27 16:22:48 1997 Jason Merrill <jason@yorick.cygnus.com> * friend.c (do_friend): Disable injection for all template-derived decls. * decl2.c (lang_decode_option): Handle -fguiding-decls. * parse.y (notype_template_declarator): New nonterminal. (direct_notype_declarator): Use it. (complex_direct_notype_declarator): Likewise. (object_template_id): Accept any kind of identifier after TEMPLATE. (notype_qualified_id): Don't add template declarators here. Sat Sep 27 16:21:58 1997 Mark Mitchell <mmitchell@usa.net> * call.c (add_template_candidate): Add explicit_targs parameter. (build_scoped_method_call): Use it. (build_overload_call_real): Likewise. (build_user_type_conversion_1): Likewise. (build_new_function_call): Likewise. (build_object_call): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. (build_new_function_call): Handle TEMPLATE_ID_EXPR. (build_new_method_call): Likewise. * class.c (finish_struct_methods): Add specialization pass to determine which methods were specializing which other methods. (instantiate_type): Handle TEMPLATE_ID_EXPR. * cp-tree.def (TEMPLATE_ID_EXPR): New tree code. * cp-tree.h (name_mangling_version): New variable. (flag_guiding_decls): Likewise. (build_template_decl_overload): New function. (begin_specialization): Likewise. (reset_specialization): Likewise. (end_specialization): Likewise. (determine_explicit_specialization): Likewise. (check_explicit_specialization): Likewise. (lookup_template_function): Likewise. (fn_type_unification): Add explicit_targs parameter. (type_unification): Likewise. * decl.c (duplicate_decls): Add smarts for explicit specializations. (grokdeclarator): Handle TEMPLATE_ID_EXPR, and function specializations. (grokfndecl): Call check_explicit_specialization. * decl2.c (lang_decode_option): Handle -fname-mangling-version. (build_expr_from_tree): Handle TEMPLATE_ID_EXPR. (check_classfn): Handle specializations. * error.c (dump_function_name): Print specialization arguments. * friend.c (do_friend): Don't call pushdecl for template instantiations. * init.c (build_member_call): Handle TEMPLATE_ID_EXPR. * lang-options.h: Add -fname-mangling-version, -fguiding-decls, and -fno-guiding-decls. * lex.c (identifier_type): Return PFUNCNAME for template function names. * method.c (build_decl_overload_real): New function. (build_template_parm_names): New function. (build_overload_identifier): Use it. (build_underscore_int): New function. (build_overload_int): Use it. Add levels for template parameters. (build_overload_name): Likewise. Also, handle TYPENAME_TYPEs. (build_overload_nested_names): Handle template type parameters. (build_template_decl_overload): New function. * parse.y (YYSTYPE): New ntype member. (nested_name_specifier): Use it. (nested_name_specifier_1): Likewise. (PFUNCNAME): New token. (template_id, object_template_id): New non-terminals. (template_parm_list): Note specializations. (template_def): Likewise. (structsp): Likewise. (fn.def2): Handle member template specializations. (component_decl_1): Likewise. (direct_notype_declarator): Handle template-ids. (component_decl_1): Likewise. (direct_notype_declarator): Handle template-ids. (primary): Handle TEMPLATE_ID_EXPR, and template-ids. * pt.c (processing_specializations): New variable. (template_header_count): Likewise. (type_unification_real): New function. (processing_explicit_specialization): Likewise. (note_template_header): Likewise. (is_member_template): Handle specializations. (end_template_decl): Call reset_specialization. (push_template_decl): Handle member template specializations. (tsubst): Likewise. (tsubst_copy): Handle TEMPLATE_ID_EXPR. (instantiate_template): Handle specializations. (instantiate_decl): Likewise. (fn_type_unification): Handle explicit_targs. (type_unification): Likewise. Allow incomplete unification without an error message, if allow_incomplete. (get_bindings): Use new calling sequence for fn_type_unification. * spew.c (yylex): Handle PFUNCNAME. * tree.c (is_overloaded_fn): Handle TEMPLATE_ID_EXPR. (really_overloaded_fn): Likewise. (get_first_fn): Handle function templates. * typeck.c (build_x_function_call): Use really_overloaded_fn. Handle TEMPLATE_ID_EXPR. (build_x_unary_op): Likewise. (build_unary_op): Likewise. (mark_addressable): Templates whose address is taken are marked as used. From-SVN: r15774
1997-09-28 21:16:59 +02:00
if (DECL_TEMPLATE_INFO (t)
&& !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t)
&& (TREE_CODE (DECL_TI_TEMPLATE (t)) != TEMPLATE_DECL
cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. From-SVN: r21433
1998-07-28 03:03:16 +02:00
|| PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t))))
dump_template_parms (pp, DECL_TEMPLATE_INFO (t), !DECL_USE_TEMPLATE (t),
flags);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
decl.c (start_decl): Don't allow duplicate definitions of static data members. * decl.c (start_decl): Don't allow duplicate definitions of static data members. * call.c (build_user_type_conversion_1): Handle user-defined template conversion operators correctly. * decl2.c (build_expr_from_tree): Issue an error message if the object in a COMPONENT_REF is a TEMPLATE_DECL. * typeck.c (incomplete_type_error): Handle TEMPLATE_TYPE_PARMs. * class.c (is_local_class): New function. * cp-tree.h (is_local_class): Declare it. (last_tree): Likewise. (begin_tree): Likewise. (end_tree): Likewise. (lookup_template_class): Change prototype. * decl.c (cp_finish_decl): Check for NULL where necesary. Consider FUNCTION_DECLS to declare objects with top-level binding, when calling make_decl_rtl. (grokdeclarator): Give members of local classes internal linkage. (start_function): Remove declaration of last_tree. (finish_function): Set flag_keep_inline_functions around call to rest_of_compilation if we are processing a member function in a local class. (start_method): Call push_template_decl for member functions of local classes in template functions. * decl2.c (import_export_decl): Don't give external linkage to instantiations of templates with internal linkage. * parse.y (last_tree): Remove declaration. (template_type): Pass extra parameter to lookup_template_class. (self_template_type): Likewise. (structsp): Move call to reset_specialization into left_curly. (left_curly): Call reset_specialization, and begin_tree. * pt.c (saved_trees): New variable. (mangle_class_name_for_template): Change prototype. Use additional function context to name local classes in templates correctly. (classtype_mangled_name): Pass the context. (push_template_decl): Handle local classes and templates, and member functions for such classes. (convert_nontype_parameter): Fix handling of pointer-to-member constants. (lookup_template_class): Handle local classes in templates. (tsubst): Likewise. Don't assume that template instantiations have external linkage; pay attention to the template declaration. (mark_decl_instantiated): Likewise. (begin_tree): New function. (end_tree): Likewise. * decl.c (xref_basetypes): Don't call complete_type for basetypes that involve template parameters; that can lead to infinite recursion unnecessarily. * pt.c (register_specialization): Do not register specializations that aren't ready to be registered yet. (check_explicit_specialization): Handle explicit specialization of constructors and destructors. (build_template_decl): New function. (push_template_delc): Handle out-of-class specializations of member templates. * pt.c (check_explicit_specialization): Set up the template information before registering the specialization. (coerce_template_parms): Fix thinko. (tsubst): Handle specializations of member templates correctly. * class.c (finish_struct_methods): Remove calls to check_explicit_specialization from here. (finish_struct): And insert them here. * cp-tree.h (perform_qualification_conversions): New function. (perform_array_to_pointer_conversion): Likewise. (begin_explicit_instantiation): Likewise. (end_explicit_instantiation): Likewise. (determine_specialization): Renamed from determine_explicit_specialization. (comp_template_parms): New function. (processing_explicit_instantiation): New variable. * cvt.c (perform_qualification_conversions): New function. (perform_array_to_pointer_conversion): Likewise. * decl.c (duplicate_decls): Don't consider template functions alike unless they have the same parameters. Refine handling of instantiation/specialization mismatches. (start_decl): Don't call pushdecl for template specializations, since they don't affect overloading. (start_function): Likewise (grokfndecl): Call check_explicit_specialization a little later. Don't call duplicate_decls for memberm template specializations. (grokdeclarator): Don't update template_count for classes that are themselves specializations. Remove use of `2' as parameter to grokfndecl since that value isn't used. * lex.c (cons_up_default_function): Save and restore processing_explicit_instantiation around calls to grokfield. * parse.y (finish_member_template_decl): New function. (component_decl_1): Use it. (fn.def2): Likewise. (template_arg_list_opt): New nonterminal. (template_type): Use it. (self_template_type): Likewise. (template_id): Likewise. (object_template_id): Likewise. (notype_template_declarator): Likwise. (begin_explicit_instantiation): Likewise. (end_explicit_instantiation): Likewise. (explicit_instantiation): Use them. * pt.c (coerce_template_parms): Add parameters. (processing_explicit_instantiation): New variable. (convert_nontype_parameter): New function. (determine_overloaded_function): Likewise. (begin_explicit_instantiation): Likewise. (end_explicit_instantiation): Likewise. (retrieve_specialization): Likewise. (register_specialization): Likewise. (processing_explicit_specialization): Removed. (determine_specialization): Handle specializations of member functions of template class instantiations. (check_explicit_specialization): Refine to conform to standard. (comp_template_parms): New function. (coerce_template_parms): Call convert_nontype_parameter. (tsubst): Refine handling of member templates. Use register_specialization. (instantiate_template): Use retrieve_specialization. (do_decl_instantiation): Likewise. (instantiate_decl): Likewise. (type_unification): Improve handling of explict template arguments. * tree.c (mapcar): Return error_mark_node, rather than aborting, on VAR_DECLS, FUNCTION_DECLS, and CONST_DECLS. * typeck.c (build_unary_op): Call determine_specialization, rather than determine_explicit_specialization. From-SVN: r17426
1998-01-19 23:41:40 +01:00
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* Dump the template parameters from the template info INFO under control of
FLAGS. PRIMARY indicates whether this is a primary template decl, or
specialization (partial or complete). For partial specializations we show
the specialized parameter values. For a primary template we show no
decoration. */
static void
dump_template_parms (cxx_pretty_printer *pp, tree info,
int primary, int flags)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
{
tree args = info ? TI_ARGS (info) : NULL_TREE;
if (primary && flags & TFF_TEMPLATE_NAME)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
return;
flags &= ~(TFF_CLASS_KEY_OR_ENUM | TFF_TEMPLATE_NAME);
pp_cxx_begin_template_argument_list (pp);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
/* Be careful only to print things when we have them, so as not
to crash producing error messages. */
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (args && !primary)
{
int len, ix;
len = get_non_default_template_args_count (args, flags);
args = INNERMOST_TEMPLATE_ARGS (args);
for (ix = 0; ix != len; ix++)
{
tree arg = TREE_VEC_ELT (args, ix);
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
/* Only print a comma if we know there is an argument coming. In
the case of an empty template argument pack, no actual
argument will be printed. */
if (ix
&& (!ARGUMENT_PACK_P (arg)
|| TREE_VEC_LENGTH (ARGUMENT_PACK_ARGS (arg)) > 0))
pp_separate_with_comma (pp);
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
if (!arg)
pp_string (pp, M_("<template parameter error>"));
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
else
dump_template_argument (pp, arg, flags);
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
else if (primary)
{
tree tpl = TI_TEMPLATE (info);
tree parms = DECL_TEMPLATE_PARMS (tpl);
int len, ix;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
parms = TREE_CODE (parms) == TREE_LIST ? TREE_VALUE (parms) : NULL_TREE;
len = parms ? TREE_VEC_LENGTH (parms) : 0;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
for (ix = 0; ix != len; ix++)
{
tree parm;
if (TREE_VEC_ELT (parms, ix) == error_mark_node)
{
pp_string (pp, M_("<template parameter error>"));
continue;
}
parm = TREE_VALUE (TREE_VEC_ELT (parms, ix));
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (ix)
pp_separate_with_comma (pp);
dump_decl (pp, parm, flags & ~TFF_DECL_SPECIFIERS);
}
[multiple changes] Sat Sep 27 16:22:48 1997 Jason Merrill <jason@yorick.cygnus.com> * friend.c (do_friend): Disable injection for all template-derived decls. * decl2.c (lang_decode_option): Handle -fguiding-decls. * parse.y (notype_template_declarator): New nonterminal. (direct_notype_declarator): Use it. (complex_direct_notype_declarator): Likewise. (object_template_id): Accept any kind of identifier after TEMPLATE. (notype_qualified_id): Don't add template declarators here. Sat Sep 27 16:21:58 1997 Mark Mitchell <mmitchell@usa.net> * call.c (add_template_candidate): Add explicit_targs parameter. (build_scoped_method_call): Use it. (build_overload_call_real): Likewise. (build_user_type_conversion_1): Likewise. (build_new_function_call): Likewise. (build_object_call): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. (build_new_function_call): Handle TEMPLATE_ID_EXPR. (build_new_method_call): Likewise. * class.c (finish_struct_methods): Add specialization pass to determine which methods were specializing which other methods. (instantiate_type): Handle TEMPLATE_ID_EXPR. * cp-tree.def (TEMPLATE_ID_EXPR): New tree code. * cp-tree.h (name_mangling_version): New variable. (flag_guiding_decls): Likewise. (build_template_decl_overload): New function. (begin_specialization): Likewise. (reset_specialization): Likewise. (end_specialization): Likewise. (determine_explicit_specialization): Likewise. (check_explicit_specialization): Likewise. (lookup_template_function): Likewise. (fn_type_unification): Add explicit_targs parameter. (type_unification): Likewise. * decl.c (duplicate_decls): Add smarts for explicit specializations. (grokdeclarator): Handle TEMPLATE_ID_EXPR, and function specializations. (grokfndecl): Call check_explicit_specialization. * decl2.c (lang_decode_option): Handle -fname-mangling-version. (build_expr_from_tree): Handle TEMPLATE_ID_EXPR. (check_classfn): Handle specializations. * error.c (dump_function_name): Print specialization arguments. * friend.c (do_friend): Don't call pushdecl for template instantiations. * init.c (build_member_call): Handle TEMPLATE_ID_EXPR. * lang-options.h: Add -fname-mangling-version, -fguiding-decls, and -fno-guiding-decls. * lex.c (identifier_type): Return PFUNCNAME for template function names. * method.c (build_decl_overload_real): New function. (build_template_parm_names): New function. (build_overload_identifier): Use it. (build_underscore_int): New function. (build_overload_int): Use it. Add levels for template parameters. (build_overload_name): Likewise. Also, handle TYPENAME_TYPEs. (build_overload_nested_names): Handle template type parameters. (build_template_decl_overload): New function. * parse.y (YYSTYPE): New ntype member. (nested_name_specifier): Use it. (nested_name_specifier_1): Likewise. (PFUNCNAME): New token. (template_id, object_template_id): New non-terminals. (template_parm_list): Note specializations. (template_def): Likewise. (structsp): Likewise. (fn.def2): Handle member template specializations. (component_decl_1): Likewise. (direct_notype_declarator): Handle template-ids. (component_decl_1): Likewise. (direct_notype_declarator): Handle template-ids. (primary): Handle TEMPLATE_ID_EXPR, and template-ids. * pt.c (processing_specializations): New variable. (template_header_count): Likewise. (type_unification_real): New function. (processing_explicit_specialization): Likewise. (note_template_header): Likewise. (is_member_template): Handle specializations. (end_template_decl): Call reset_specialization. (push_template_decl): Handle member template specializations. (tsubst): Likewise. (tsubst_copy): Handle TEMPLATE_ID_EXPR. (instantiate_template): Handle specializations. (instantiate_decl): Likewise. (fn_type_unification): Handle explicit_targs. (type_unification): Likewise. Allow incomplete unification without an error message, if allow_incomplete. (get_bindings): Use new calling sequence for fn_type_unification. * spew.c (yylex): Handle PFUNCNAME. * tree.c (is_overloaded_fn): Handle TEMPLATE_ID_EXPR. (really_overloaded_fn): Likewise. (get_first_fn): Handle function templates. * typeck.c (build_x_function_call): Use really_overloaded_fn. Handle TEMPLATE_ID_EXPR. (build_x_unary_op): Likewise. (build_unary_op): Likewise. (mark_addressable): Templates whose address is taken are marked as used. From-SVN: r15774
1997-09-28 21:16:59 +02:00
}
pp_cxx_end_template_argument_list (pp);
1994-02-24 02:02:37 +01:00
}
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
/* Print out the arguments of CALL_EXPR T as a parenthesized list using
flags FLAGS. Skip over the first argument if SKIPFIRST is true. */
static void
dump_call_expr_args (cxx_pretty_printer *pp, tree t, int flags, bool skipfirst)
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
{
tree arg;
call_expr_arg_iterator iter;
pp_cxx_left_paren (pp);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
FOR_EACH_CALL_EXPR_ARG (arg, iter, t)
{
if (skipfirst)
skipfirst = false;
else
{
dump_expr (pp, arg, flags | TFF_EXPR_IN_PARENS);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (more_call_expr_args_p (&iter))
pp_separate_with_comma (pp);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
}
}
pp_cxx_right_paren (pp);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
}
/* Print out the arguments of AGGR_INIT_EXPR T as a parenthesized list
using flags FLAGS. Skip over the first argument if SKIPFIRST is
true. */
static void
dump_aggr_init_expr_args (cxx_pretty_printer *pp, tree t, int flags,
bool skipfirst)
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
{
tree arg;
aggr_init_expr_arg_iterator iter;
pp_cxx_left_paren (pp);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
FOR_EACH_AGGR_INIT_EXPR_ARG (arg, iter, t)
{
if (skipfirst)
skipfirst = false;
else
{
dump_expr (pp, arg, flags | TFF_EXPR_IN_PARENS);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (more_aggr_init_expr_args_p (&iter))
pp_separate_with_comma (pp);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
}
}
pp_cxx_right_paren (pp);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
}
/* Print out a list of initializers (subr of dump_expr). */
1996-07-11 03:13:25 +02:00
1994-02-24 02:02:37 +01:00
static void
dump_expr_list (cxx_pretty_printer *pp, tree l, int flags)
1994-02-24 02:02:37 +01:00
{
while (l)
{
dump_expr (pp, TREE_VALUE (l), flags | TFF_EXPR_IN_PARENS);
1994-02-24 02:02:37 +01:00
l = TREE_CHAIN (l);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (l)
pp_separate_with_comma (pp);
1994-02-24 02:02:37 +01:00
}
}
Make CONSTRUCTOR use VEC to store initializers. * c-common.c (complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts. (pp_c_constructor_elts): New function. * c-pretty-print.h (pp_c_constructor_elts): Declare. * c-typeck.c (build_function_call, build_c_cast, digest_init, struct constructor_stack, struct initializer_stack, constructor_elements, push_init_level, pop_init_level, add_pending_init, find_init_member, output_init_element): Update to cope with VEC in CONSTRUCTOR_ELTS. * coverage.c (build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * expr.c (categorize_ctor_elements_1, store_constructor, expand_expr_real_1): Likewise. * fold-const.c (fold_ternary): Likewise. * gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl, gimplify_init_constructor, gimplify_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR node. * tree-pretty-print.c (dump_generic_node): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree-sra.c (generate_element_init_1): Likewise. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vect-transform.c (vect_get_vec_def_for_operand): (get_initial_def_for_reduction): Likewise. * tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses value handle in annotations. * tree.c (tree_node_kind, tree_code_size, make_node_stat, tree_node_structure): Add support for constr_kind. (build_vector_from_ctor, build_constructor_single, build_constructor_from_list): New functions. (build_constructor): Update to take a VEC instead of a TREE_LIST. (simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree.def (CONSTRUCTOR): Make it a tcc_exceptional node. * tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT, CONSTRUCTOR_APPEND_ELT): New macros. (struct constructor_elt, struct tree_constructor): New data types. (union tree_node): Add tree_constructor field. * treestruct.def: Define TS_CONSTRUCTOR. * varasm.c (const_hash_1, compare_constant, copy_constant, compute_reloc_for_constant, output_addressed_constants, initializer_constant_valid_p, output_constant, array_size_for_constructor, output_constructor): Update to cope with VEC in CONSTRUCTOR_ELTS. * vec.h (VEC_empty, VEC_copy): New macros. ada/ Make CONSTRUCTOR use VEC to store initializers. * decl.c (gnat_to_gnu_entity): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans.c (extract_values): Likewise. * utils.c (convert, remove_conversions): Likewise. * utils2.c (contains_save_expr_p, build_binary_op, build_unary_op, gnat_build_constructor): Likewise. cp/ Make CONSTRUCTOR use VEC to store initializers. * call.c (convert_default_arg): Update call to digest_init. * class.c (dump_class_hierarchy, dump_array): Update to cope with VEC in CONSTRUCTOR_ELTS. * cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise. (finish_compound_literal, digest_init): Update declaration. * decl.c (struct reshape_iter): New data type. (reshape_init_array): Rename to... (reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS. (reshape_init): Rewrite from scratch. Split parts into... (reshape_init_array, reshape_init_vector, reshape_init_class, reshape_init_r): New functions. (check_initializer): Update call to reshape_init. Remove obsolete code. (initialize_artificial_var, cp_complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * decl2.c (grokfield): Update calls to digest_init. (mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS. * error.c (dump_expr_init_vec): New function. (dump_expr): Use dump_expr_init_vec. * init.c (build_zero_init, build_vec_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (expand_default_init): Update call to digest_init. * parser.c (cp_parser_postfix_expression): Use a VEC for the initializers. (cp_parser_initializer_list): Build a VEC of initializers. * pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC in CONSTRUCTOR_ELTS. * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer, get_pseudo_ti_init): Use build_constructor_from_list instead of build_constructor. * semantics.c (finish_compound_literal): Update call to digest_init. * tree.c (stabilize_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * typeck.c (build_ptrmemfunc1): Likewise. * typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1): Likewise. (store_init_value): Use build_constructor_from_list and update call to digest_init. (digest_init): Rewrite. (process_init_constructor): Rewrite from scratch. Split into... (process_init_constructor_array, picflag_from_initializer, process_init_constructor_record, process_init_constructor_union): New functions. (PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE): New macros. (build_functional_cast): Use build_constructor_from_list instead of build_constructor. fortran/ Make CONSTRUCTOR use VEC to store initializers. * trans-array.c (gfc_build_null_descriptor, gfc_trans_array_constructor_value, gfc_conv_array_initializer): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans-common.c (create_common): Likewise. * trans-expr.c (gfc_conv_structure): Likewise. * trans-stmt.c (gfc_trans_character_select): Use build_constructor_from_list instead of build_constructor. java/ Make CONSTRUCTOR use VEC to store initializers. * check-init.c (check_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * class.c (make_field_value, make_method_value, get_dispatch_table, make_class_data, emit_symbol_table, emit_catch_table, emit_assertion_table): Use build_constructor_from_list instead of build_constructor. * constants.c (build_constants_constructor): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE, PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead of a TREE_LIST. * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in CONSTRUCTOR_ELTS. * parse.y (build_new_array_init): Use build_constructor_from_list instead of build_constructor. (patch_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (array_constructor_check_entry): Likewise. objc/ Make CONSTRUCTOR use VEC to store initializers. * objc-act.c (objc_build_constructor): Use build_constructor_from_list instead of build_constructor. testsuite/ Make CONSTRUCTOR use VEC to store initializers. * g++.dg/ext/complit3.C: Check for specific error messages. * g++.dg/init/brace2.C: Update error message. * g++.dg/warn/Wbraces2.C: Likewise. From-SVN: r102182
2005-07-20 03:19:59 +02:00
/* Print out a vector of initializers (subr of dump_expr). */
static void
dump_expr_init_vec (cxx_pretty_printer *pp, vec<constructor_elt, va_gc> *v,
int flags)
Make CONSTRUCTOR use VEC to store initializers. * c-common.c (complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts. (pp_c_constructor_elts): New function. * c-pretty-print.h (pp_c_constructor_elts): Declare. * c-typeck.c (build_function_call, build_c_cast, digest_init, struct constructor_stack, struct initializer_stack, constructor_elements, push_init_level, pop_init_level, add_pending_init, find_init_member, output_init_element): Update to cope with VEC in CONSTRUCTOR_ELTS. * coverage.c (build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * expr.c (categorize_ctor_elements_1, store_constructor, expand_expr_real_1): Likewise. * fold-const.c (fold_ternary): Likewise. * gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl, gimplify_init_constructor, gimplify_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR node. * tree-pretty-print.c (dump_generic_node): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree-sra.c (generate_element_init_1): Likewise. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vect-transform.c (vect_get_vec_def_for_operand): (get_initial_def_for_reduction): Likewise. * tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses value handle in annotations. * tree.c (tree_node_kind, tree_code_size, make_node_stat, tree_node_structure): Add support for constr_kind. (build_vector_from_ctor, build_constructor_single, build_constructor_from_list): New functions. (build_constructor): Update to take a VEC instead of a TREE_LIST. (simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree.def (CONSTRUCTOR): Make it a tcc_exceptional node. * tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT, CONSTRUCTOR_APPEND_ELT): New macros. (struct constructor_elt, struct tree_constructor): New data types. (union tree_node): Add tree_constructor field. * treestruct.def: Define TS_CONSTRUCTOR. * varasm.c (const_hash_1, compare_constant, copy_constant, compute_reloc_for_constant, output_addressed_constants, initializer_constant_valid_p, output_constant, array_size_for_constructor, output_constructor): Update to cope with VEC in CONSTRUCTOR_ELTS. * vec.h (VEC_empty, VEC_copy): New macros. ada/ Make CONSTRUCTOR use VEC to store initializers. * decl.c (gnat_to_gnu_entity): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans.c (extract_values): Likewise. * utils.c (convert, remove_conversions): Likewise. * utils2.c (contains_save_expr_p, build_binary_op, build_unary_op, gnat_build_constructor): Likewise. cp/ Make CONSTRUCTOR use VEC to store initializers. * call.c (convert_default_arg): Update call to digest_init. * class.c (dump_class_hierarchy, dump_array): Update to cope with VEC in CONSTRUCTOR_ELTS. * cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise. (finish_compound_literal, digest_init): Update declaration. * decl.c (struct reshape_iter): New data type. (reshape_init_array): Rename to... (reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS. (reshape_init): Rewrite from scratch. Split parts into... (reshape_init_array, reshape_init_vector, reshape_init_class, reshape_init_r): New functions. (check_initializer): Update call to reshape_init. Remove obsolete code. (initialize_artificial_var, cp_complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * decl2.c (grokfield): Update calls to digest_init. (mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS. * error.c (dump_expr_init_vec): New function. (dump_expr): Use dump_expr_init_vec. * init.c (build_zero_init, build_vec_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (expand_default_init): Update call to digest_init. * parser.c (cp_parser_postfix_expression): Use a VEC for the initializers. (cp_parser_initializer_list): Build a VEC of initializers. * pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC in CONSTRUCTOR_ELTS. * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer, get_pseudo_ti_init): Use build_constructor_from_list instead of build_constructor. * semantics.c (finish_compound_literal): Update call to digest_init. * tree.c (stabilize_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * typeck.c (build_ptrmemfunc1): Likewise. * typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1): Likewise. (store_init_value): Use build_constructor_from_list and update call to digest_init. (digest_init): Rewrite. (process_init_constructor): Rewrite from scratch. Split into... (process_init_constructor_array, picflag_from_initializer, process_init_constructor_record, process_init_constructor_union): New functions. (PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE): New macros. (build_functional_cast): Use build_constructor_from_list instead of build_constructor. fortran/ Make CONSTRUCTOR use VEC to store initializers. * trans-array.c (gfc_build_null_descriptor, gfc_trans_array_constructor_value, gfc_conv_array_initializer): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans-common.c (create_common): Likewise. * trans-expr.c (gfc_conv_structure): Likewise. * trans-stmt.c (gfc_trans_character_select): Use build_constructor_from_list instead of build_constructor. java/ Make CONSTRUCTOR use VEC to store initializers. * check-init.c (check_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * class.c (make_field_value, make_method_value, get_dispatch_table, make_class_data, emit_symbol_table, emit_catch_table, emit_assertion_table): Use build_constructor_from_list instead of build_constructor. * constants.c (build_constants_constructor): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE, PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead of a TREE_LIST. * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in CONSTRUCTOR_ELTS. * parse.y (build_new_array_init): Use build_constructor_from_list instead of build_constructor. (patch_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (array_constructor_check_entry): Likewise. objc/ Make CONSTRUCTOR use VEC to store initializers. * objc-act.c (objc_build_constructor): Use build_constructor_from_list instead of build_constructor. testsuite/ Make CONSTRUCTOR use VEC to store initializers. * g++.dg/ext/complit3.C: Check for specific error messages. * g++.dg/init/brace2.C: Update error message. * g++.dg/warn/Wbraces2.C: Likewise. From-SVN: r102182
2005-07-20 03:19:59 +02:00
{
unsigned HOST_WIDE_INT idx;
tree value;
FOR_EACH_CONSTRUCTOR_VALUE (v, idx, value)
{
dump_expr (pp, value, flags | TFF_EXPR_IN_PARENS);
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
if (idx != v->length () - 1)
pp_separate_with_comma (pp);
Make CONSTRUCTOR use VEC to store initializers. * c-common.c (complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts. (pp_c_constructor_elts): New function. * c-pretty-print.h (pp_c_constructor_elts): Declare. * c-typeck.c (build_function_call, build_c_cast, digest_init, struct constructor_stack, struct initializer_stack, constructor_elements, push_init_level, pop_init_level, add_pending_init, find_init_member, output_init_element): Update to cope with VEC in CONSTRUCTOR_ELTS. * coverage.c (build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * expr.c (categorize_ctor_elements_1, store_constructor, expand_expr_real_1): Likewise. * fold-const.c (fold_ternary): Likewise. * gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl, gimplify_init_constructor, gimplify_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR node. * tree-pretty-print.c (dump_generic_node): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree-sra.c (generate_element_init_1): Likewise. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vect-transform.c (vect_get_vec_def_for_operand): (get_initial_def_for_reduction): Likewise. * tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses value handle in annotations. * tree.c (tree_node_kind, tree_code_size, make_node_stat, tree_node_structure): Add support for constr_kind. (build_vector_from_ctor, build_constructor_single, build_constructor_from_list): New functions. (build_constructor): Update to take a VEC instead of a TREE_LIST. (simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree.def (CONSTRUCTOR): Make it a tcc_exceptional node. * tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT, CONSTRUCTOR_APPEND_ELT): New macros. (struct constructor_elt, struct tree_constructor): New data types. (union tree_node): Add tree_constructor field. * treestruct.def: Define TS_CONSTRUCTOR. * varasm.c (const_hash_1, compare_constant, copy_constant, compute_reloc_for_constant, output_addressed_constants, initializer_constant_valid_p, output_constant, array_size_for_constructor, output_constructor): Update to cope with VEC in CONSTRUCTOR_ELTS. * vec.h (VEC_empty, VEC_copy): New macros. ada/ Make CONSTRUCTOR use VEC to store initializers. * decl.c (gnat_to_gnu_entity): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans.c (extract_values): Likewise. * utils.c (convert, remove_conversions): Likewise. * utils2.c (contains_save_expr_p, build_binary_op, build_unary_op, gnat_build_constructor): Likewise. cp/ Make CONSTRUCTOR use VEC to store initializers. * call.c (convert_default_arg): Update call to digest_init. * class.c (dump_class_hierarchy, dump_array): Update to cope with VEC in CONSTRUCTOR_ELTS. * cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise. (finish_compound_literal, digest_init): Update declaration. * decl.c (struct reshape_iter): New data type. (reshape_init_array): Rename to... (reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS. (reshape_init): Rewrite from scratch. Split parts into... (reshape_init_array, reshape_init_vector, reshape_init_class, reshape_init_r): New functions. (check_initializer): Update call to reshape_init. Remove obsolete code. (initialize_artificial_var, cp_complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * decl2.c (grokfield): Update calls to digest_init. (mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS. * error.c (dump_expr_init_vec): New function. (dump_expr): Use dump_expr_init_vec. * init.c (build_zero_init, build_vec_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (expand_default_init): Update call to digest_init. * parser.c (cp_parser_postfix_expression): Use a VEC for the initializers. (cp_parser_initializer_list): Build a VEC of initializers. * pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC in CONSTRUCTOR_ELTS. * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer, get_pseudo_ti_init): Use build_constructor_from_list instead of build_constructor. * semantics.c (finish_compound_literal): Update call to digest_init. * tree.c (stabilize_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * typeck.c (build_ptrmemfunc1): Likewise. * typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1): Likewise. (store_init_value): Use build_constructor_from_list and update call to digest_init. (digest_init): Rewrite. (process_init_constructor): Rewrite from scratch. Split into... (process_init_constructor_array, picflag_from_initializer, process_init_constructor_record, process_init_constructor_union): New functions. (PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE): New macros. (build_functional_cast): Use build_constructor_from_list instead of build_constructor. fortran/ Make CONSTRUCTOR use VEC to store initializers. * trans-array.c (gfc_build_null_descriptor, gfc_trans_array_constructor_value, gfc_conv_array_initializer): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans-common.c (create_common): Likewise. * trans-expr.c (gfc_conv_structure): Likewise. * trans-stmt.c (gfc_trans_character_select): Use build_constructor_from_list instead of build_constructor. java/ Make CONSTRUCTOR use VEC to store initializers. * check-init.c (check_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * class.c (make_field_value, make_method_value, get_dispatch_table, make_class_data, emit_symbol_table, emit_catch_table, emit_assertion_table): Use build_constructor_from_list instead of build_constructor. * constants.c (build_constants_constructor): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE, PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead of a TREE_LIST. * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in CONSTRUCTOR_ELTS. * parse.y (build_new_array_init): Use build_constructor_from_list instead of build_constructor. (patch_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (array_constructor_check_entry): Likewise. objc/ Make CONSTRUCTOR use VEC to store initializers. * objc-act.c (objc_build_constructor): Use build_constructor_from_list instead of build_constructor. testsuite/ Make CONSTRUCTOR use VEC to store initializers. * g++.dg/ext/complit3.C: Check for specific error messages. * g++.dg/init/brace2.C: Update error message. * g++.dg/warn/Wbraces2.C: Likewise. From-SVN: r102182
2005-07-20 03:19:59 +02:00
}
}
/* We've gotten an indirect REFERENCE (an OBJ_TYPE_REF) to a virtual
function. Resolve it to a close relative -- in the sense of static
type -- variant being overridden. That is close to what was written in
the source code. Subroutine of dump_expr. */
static tree
resolve_virtual_fun_from_obj_type_ref (tree ref)
{
tree obj_type = TREE_TYPE (OBJ_TYPE_REF_OBJECT (ref));
decl.c, [...]: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ada/ * gcc-interface/decl.c, gcc-interface/utils.c, gcc-interface/utils2.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c-family/ * c-common.c, c-cppbuiltin.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c/ * c-decl.c, c-typeck.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/cp/ * call.c, class.c, decl.c, error.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/objc/ * objc-encoding.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ * alias.c, asan.c, builtins.c, cfgexpand.c, cgraph.c, config/aarch64/aarch64.c, config/alpha/predicates.md, config/arm/arm.c, config/darwin.c, config/epiphany/epiphany.c, config/i386/i386.c, config/iq2000/iq2000.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/mips/mips.c, config/picochip/picochip.c, config/rs6000/rs6000.c, cppbuiltin.c, dbxout.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, fold-const.c, function.c, gimple-fold.c, godump.c, ipa-cp.c, ipa-prop.c, omp-low.c, predict.c, sdbout.c, stor-layout.c, trans-mem.c, tree-object-size.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-forwprop.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-niter.c, tree-ssa-loop-prefetch.c, tree-ssa-strlen.c, tree-stdarg.c, tree-switch-conversion.c, tree-vect-generic.c, tree-vect-loop.c, tree-vect-patterns.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, varasm.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. From-SVN: r204961
2013-11-18 15:52:19 +01:00
HOST_WIDE_INT index = tree_to_uhwi (OBJ_TYPE_REF_TOKEN (ref));
tree fun = BINFO_VIRTUALS (TYPE_BINFO (TREE_TYPE (obj_type)));
while (index)
{
fun = TREE_CHAIN (fun);
index -= (TARGET_VTABLE_USES_DESCRIPTORS
? TARGET_VTABLE_USES_DESCRIPTORS : 1);
}
return BV_FN (fun);
}
/* Print out an expression E under control of FLAGS. */
1996-07-11 03:13:25 +02:00
1994-02-24 02:02:37 +01:00
static void
dump_expr (cxx_pretty_printer *pp, tree t, int flags)
1994-02-24 02:02:37 +01:00
{
tree op;
if (t == 0)
return;
if (STATEMENT_CLASS_P (t))
{
pp_cxx_ws_string (pp, M_("<statement>"));
return;
}
1994-02-24 02:02:37 +01:00
switch (TREE_CODE (t))
{
case VAR_DECL:
case PARM_DECL:
case FIELD_DECL:
case CONST_DECL:
case FUNCTION_DECL:
case TEMPLATE_DECL:
case NAMESPACE_DECL:
case LABEL_DECL:
case OVERLOAD:
case TYPE_DECL:
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
case IDENTIFIER_NODE:
dump_decl (pp, t, ((flags & ~(TFF_DECL_SPECIFIERS|TFF_RETURN_TYPE
|TFF_TEMPLATE_HEADER))
| TFF_NO_TEMPLATE_BINDINGS
| TFF_NO_FUNCTION_ARGUMENTS));
1994-02-24 02:02:37 +01:00
break;
case SSA_NAME:
tree.h (SSA_NAME_VAR): Return NULL_TREE if an IDENTIFIER_NODE is recorded as var. 2012-08-10 Richard Guenther <rguenther@suse.de> * tree.h (SSA_NAME_VAR): Return NULL_TREE if an IDENTIFIER_NODE is recorded as var. (SSA_NAME_IDENTIFIER): Return the IDENTIFIER_NODE of the SSA_NAME or its SSA_NAME_VAR. (SET_SSA_NAME_VAR_OR_IDENTIFIER): New setter. * tree-ssanames.c (make_ssa_name_fn): Handle creating anonymous SSA names by passing a type instead of a variable decl. (release_ssa_name): Use SET_SSA_NAME_VAR_OR_IDENTIFIER. (copy_ssa_name_fn): Handle anonymous SSA names. (replace_ssa_name_symbol): Use SET_SSA_NAME_VAR_OR_IDENTIFIER. * tree-flow-inline.h (make_temp_ssa_name): New inline function. * tree-pretty-print.c (dump_generic_node): Use SSA_NAME_IDENTIFIER, dump SSA names without a name as <anon>. * cfgexpand.c (expand_used_vars): Assing anonymous SSA names we are going to expand a decl. (gimple_expand_cfg): Assign all SSA names of a partition the decl we created for its leader. * tree-ssa.c (target_for_debug_bind): Handle SSA_NAMEs. (verify_ssa_name): Handle anonymous SSA names. (verify_def): Likewise. * tree-predcom.c (eliminate_temp_copies): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-live.c (var_map_base_init): Compute conflicts for anonymous SSA names with the same type. (mark_all_vars_used_1): Handle anonymous SSA names. (verify_live_on_entry): Likewise. * tree-ssa-coalesce.c (abnormal_corrupt): Remove. (create_outofssa_var_map): Adjust with respect to conflicts we compute for anonymous SSA names. Do not restrict abnormal coalescing. (coalesce_partitions): Do not restrict abnormal coalescing. Assert we only ever coalesce variables we computed conflicts for. * tree-ssa-ter.c (process_replaceable): Do not restrict TER of anonymous names. * expr.c (expand_expr_real_1): Handle anonymous SSA names expanded from IVOPTs by creating a raw REG here. * tree-cfg.c (replace_ssa_name): Handle anonymous SSA names. (dump_function_to_file): Dump anonymous SSA names alongside with their types in the variable list. (verify_gimple_return): Guard use of SSA_NAME_VAR. * tree-into-ssa.c (mark_for_renaming): Handle a NULL symbol. (rewrite_into_ssa): Make SSA names anonymous. * tree-ssa-structalias.c (alias_get_name): Rewrite. * tree-ssa-uninit.c (ssa_undefined_value_p): Handle anonymous SSA names. (warn_uninitialized_phi): Likewise. * tree-ssa-loop-ivopts.c (prepare_decl_rtl): Defer expanding anonymous SSA names to the expander. (determine_iv_cost): Anonymous SSA names are artificial. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Handle anonymous SSA names. * lto-streamer-out.c (output_ssa_names): Stream SSA_NAME_VAR or if NULL, the type of the SSA name. * tree-inline.c (remap_ssa_name): Handle anonymous SSA names, remap names as anonymous where appropriate. (insert_init_stmt): Pass SSA names down to insert_init_debug_bind. * tree-ssa-uncprop.c (uncprop_into_successor_phis): Adjust according to what we create conflicts for in out-of-SSA coalescing. * tree-parloops.c (separate_decls_in_region_name): Handle anonymous SSA names. (add_field_for_name): Likewise. * tree.c (get_name): Handle SSA names. * tree-ssa-loop-im.c (gen_lsm_tmp_name): Defer to get_name for SSA_NAMEs. * tree-vect-loop-manip.c (adjust_debug_stmts): Use virtual_operand_p. * tree-sra.c (create_access_replacement): Give up generating a DECL_DEBUG_EXPR for SSA names in the memory reference. (replace_removed_params_ssa_names): Guard use of SSA_NAME_VAR. * tree-complex.c (get_component_ssa_name): Handle anonymous SSA names. (set_component_ssa_name): Likewise. * tree-ssa-sccvn.c (visit_reference_op_load): Likewise. * tree-object-size.c (collect_object_sizes_for): Handle uninitialized SSA names properly. * ipa-inline-analysis.c (eliminated_by_inlining_prob): Guard use of SSA_NAME_VAR. * ipa-split.c (test_nonssa_use): Likewise. (consider_split): Likewise. (mark_nonssa_use): Likewise. c-family/ * c-pretty-print.c (pp_c_expression): Handle anonymous SSA names. cp/ * error.c (dump_expr): Likewise. * g++.dg/plugin/selfassign.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/strlenopt-11.c: Likewise. * gcc.dg/strlenopt-13.c: Likewise. * gcc.dg/no-strict-overflow-4.c: Likewise. * gcc.dg/strict-overflow-4.c: Likewise. * gcc.dg/tree-ssa/alias-11.c: Likewise. * gcc.dg/tree-ssa/alias-6.c: Likewise. * gcc.dg/tree-ssa/asm-3.c: Likewise. * gcc.dg/tree-ssa/pr18908.c: Likewise. * gcc.dg/tree-ssa/pr19431.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-21.c: Likewise. * gcc.dg/tree-ssa/phi-opt-10.c: Likewise. * gcc.dg/tree-ssa/phi-opt-7.c: Likewise. * gcc.dg/tree-ssa/slsr-27.c: Likewise. * gcc.dg/tree-ssa/slsr-28.c: Likewise. * gcc.dg/tree-ssa/slsr-29.c: Likewise. * gcc.dg/pr46309.c: Likewise. * gcc.dg/tree-ssa/loop-5.c: Likewise. From-SVN: r190284
2012-08-10 10:29:29 +02:00
if (SSA_NAME_VAR (t)
&& !DECL_ARTIFICIAL (SSA_NAME_VAR (t)))
dump_expr (pp, SSA_NAME_VAR (t), flags);
else
pp_cxx_ws_string (pp, M_("<unknown>"));
break;
tree.def (VOID_CST): New. gcc/ * tree.def (VOID_CST): New. * tree-core.h (TI_VOID): New. * tree.h (void_node): New. * tree.c (tree_node_structure_for_code, tree_code_size) (iterative_hash_expr): Handle VOID_CST. (build_common_tree_nodes): Initialize void_node. gcc/c-family/ * c-common.h (CTI_VOID_ZERO, void_zero_node): Delete. * c-common.c (c_common_nodes_and_builtins): Don't initialize void_zero_node. * c-pretty-print.c (pp_c_void_constant): New function. (c_pretty_printer::constant, c_pretty_printer::primary_expression) (c_pretty_printer::expression): Handle VOID_CST. * cilk.c (extract_free_variables): Likewise. * c-ubsan.c (ubsan_instrument_division, ubsan_instrument_shift) (ubsan_instrument_vla): Use void_node instead of void_zero_node. gcc/c/ * c-array-notation.c (expand_array_notations): Use void_node instead of void_zero_node. gcc/cp/ * cvt.c (convert_to_void): Use void_node instead of void_zero_node. * cp-array-notation.c (replace_invariant_exprs): Likewise. (expand_array_notation): Handle VOID_CST. * error.c (dump_expr): Likewise. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression) (cxx_pretty_printer::expression): Likewise. (pp_cxx_new_expression): Use void_node instead of void_zero_node. * decl.c (register_dtor_fn): Likewise. * init.c (build_raw_new_expr, build_new_1, build_vec_init) (build_delete, push_base_cleanups): Likewise. * mangle.c (write_expression): Likewise. * semantics.c (finish_break_stmt, empty_expr_stmt_p): Likewise. * pt.c (tsubst_decl, tsubst_copy_and_build): Likewise. (tsubst, tsubst_copy, build_non_dependent_expr): Handle VOID_CST. * tree.c (cp_tree_equal): Likewise. (build_dummy_object, is_dummy_object, stabilize_expr): Use void_node instead of void_zero_node. * typeck.c (check_return_expr): Likewise. * typeck2.c (build_functional_cast): Likewise. From-SVN: r210692
2014-05-21 13:00:35 +02:00
case VOID_CST:
case INTEGER_CST:
1994-02-24 02:02:37 +01:00
case REAL_CST:
case STRING_CST:
case COMPLEX_CST:
c-objc-common.c (c_tree_printer): Tidy. c/ * c-objc-common.c (c_tree_printer): Tidy. c-family/ * c-pretty-print.h (c_pretty_printer::type_id): Now a virtual member function. (c_pretty_printer::storage_class_specifier): Likewise. (c_pretty_printer::initializer): Likewise. (pp_declaration): Remove. (pp_declaration_specifiers): Likewise. (pp_abstract_declarator): Likewise. (pp_declarator): Likewise. (pp_type_id): Likewise. (pp_statement): Likewise. (pp_constant): Likewise. (pp_id_expression): Likewise. (pp_primary_expression): Likewise. (pp_unary_expression): Likewise. (pp_multiplicative_expression): Likewise. (pp_conditional_expression): Likewise. (pp_assignment_expression): Likewise. (pp_expression): Likewise. (pp_c_type_id): Likewise. (pp_c_storage_class_specifier): Likewise. * c-pretty-print.c (pp_c_type_cast): Tidy. (pp_c_pointer): Likewise. (pp_c_type_specifier): Likewise. (pp_c_parameter_type_list): Likewise. (pp_c_function_definition): Likewise. (pp_c_init_declarator): Likewise. (pp_c_initializer_list): Likewise. (pp_c_constructor_elts): Likewise. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::declaration_specifiers): Likewise. (c_pretty_printer::primary_expression): Likewise. (c_pretty_printer::postfix_expression): Likewise. (c_pretty_printer::type_id): Rename from pp_c_type_id. (c_pretty_printer::storage_class_specifier): Rename from pp_c_storage_class_specifier. (c_pretty_printer::initializer): Rename from pp_c_initializer. (c_pretty_printer::c_pretty_printer): Do not assign to type_id, storage_class_specifier, initializer, offset_list, flags. cp/ * cxx-pretty-print.h (cxx_pretty_printer::type_id): Declare as overrider. * cxx-pretty-print.c (pp_cxx_storage_class_specifier): Remove. (pp_cxx_userdef_literal): Tidy. (pp_cxx_template_argument_list): Likewise. (pp_cxx_typeid_expression): Likewise. (pp_cxx_offsetof_expression_1): Likewise. (cxx_pretty_printer::postfix_expression): Likewise. (cxx_pretty_printer::unary_expression): Likewise. (cxx_pretty_printer::statement): Likewise. (cxx_pretty_printer::type_id): Rename from pp_cxx_type_id. (c_pretty_printer::cxx_pretty_printer): Do not assign to type_id. * error.c (dump_decl): Tidy. (dump_expr): Likewise. From-SVN: r202203
2013-09-03 11:52:19 +02:00
pp->constant (t);
1994-02-24 02:02:37 +01:00
break;
Implement C++11 user-defined literals. libcpp/ * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix, cpp_userdef_string_remove_type, cpp_userdef_string_add_type, cpp_userdef_char_remove_type, cpp_userdef_char_add_type, cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New. (cpp_classify_number): Classify unrecognized tokens as user-defined literals. * include/cpplib.h: Add new tokens for user-defined literals. * init.c: Add new preprocessor flag (cxx11). * lex.c: (lex_string, lex_raw_string): Handle user-defined literals including concatenation and promotion with suffixes. c-family/ * c-common.c (build_userdef_literal): New. * c-common.def: New tree code. * c-common.h (tree_userdef_literal): New tree struct and accessors. * c-lex.c (interpret_float): Add suffix parm. (c_lex_with_flags): Build literal tokens. cp/ * cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree. * cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator name tools. New tree code for user-defined literals. * cxx-pretty-print.h: (pp_cxx_userdef_literal) New. * cxx-pretty-print.c: (pp_cxx_userdef_literal) New. (pp_cxx_primary_expression, pp_cxx_expression): Use it. * decl.c: (cp_tree_node_structure): Return new tree code. (duplicate_decls): Check for raw vs. template operator conflicts. (grokfndecl, grokdeclarator): New checks for literal operators. * error.c: (dump_expr): Warn about user-defined literals in C++98 mode. (dump_function_name): Pretty printing. * mangle.c: (write_literal_operator_name): New. (write_unqualified_id, write_unqualified_name): Use it. * parser.c: (cp_parser_operator): Handle operator"". (cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal, cp_parser_userdef_string_literal): New. (cp_parser_primary_expression): Handle new user-defined literal tokens with new functions. * semantics.c: (potential_constant_expression_1): Add user-defined literals. * typeck.c (check_raw_literal_operator, check_literal_operator_args): New. From-SVN: r180536
2011-10-26 21:30:59 +02:00
case USERDEF_LITERAL:
pp_cxx_userdef_literal (pp, t);
Implement C++11 user-defined literals. libcpp/ * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix, cpp_userdef_string_remove_type, cpp_userdef_string_add_type, cpp_userdef_char_remove_type, cpp_userdef_char_add_type, cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New. (cpp_classify_number): Classify unrecognized tokens as user-defined literals. * include/cpplib.h: Add new tokens for user-defined literals. * init.c: Add new preprocessor flag (cxx11). * lex.c: (lex_string, lex_raw_string): Handle user-defined literals including concatenation and promotion with suffixes. c-family/ * c-common.c (build_userdef_literal): New. * c-common.def: New tree code. * c-common.h (tree_userdef_literal): New tree struct and accessors. * c-lex.c (interpret_float): Add suffix parm. (c_lex_with_flags): Build literal tokens. cp/ * cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree. * cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator name tools. New tree code for user-defined literals. * cxx-pretty-print.h: (pp_cxx_userdef_literal) New. * cxx-pretty-print.c: (pp_cxx_userdef_literal) New. (pp_cxx_primary_expression, pp_cxx_expression): Use it. * decl.c: (cp_tree_node_structure): Return new tree code. (duplicate_decls): Check for raw vs. template operator conflicts. (grokfndecl, grokdeclarator): New checks for literal operators. * error.c: (dump_expr): Warn about user-defined literals in C++98 mode. (dump_function_name): Pretty printing. * mangle.c: (write_literal_operator_name): New. (write_unqualified_id, write_unqualified_name): Use it. * parser.c: (cp_parser_operator): Handle operator"". (cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal, cp_parser_userdef_string_literal): New. (cp_parser_primary_expression): Handle new user-defined literal tokens with new functions. * semantics.c: (potential_constant_expression_1): Add user-defined literals. * typeck.c (check_raw_literal_operator, check_literal_operator_args): New. From-SVN: r180536
2011-10-26 21:30:59 +02:00
break;
case THROW_EXPR:
/* While waiting for caret diagnostics, avoid printing
__cxa_allocate_exception, __cxa_throw, and the like. */
pp_cxx_ws_string (pp, M_("<throw-expression>"));
break;
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
case PTRMEM_CST:
pp_ampersand (pp);
dump_type (pp, PTRMEM_CST_CLASS (t), flags);
pp_cxx_colon_colon (pp);
pp_cxx_tree_identifier (pp, DECL_NAME (PTRMEM_CST_MEMBER (t)));
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
break;
1994-02-24 02:02:37 +01:00
case COMPOUND_EXPR:
pp_cxx_left_paren (pp);
dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_separate_with_comma (pp);
dump_expr (pp, TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (pp);
1994-02-24 02:02:37 +01:00
break;
case COND_EXPR:
case VEC_COND_EXPR:
pp_cxx_left_paren (pp);
dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_string (pp, " ? ");
dump_expr (pp, TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
pp_string (pp, " : ");
dump_expr (pp, TREE_OPERAND (t, 2), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (pp);
1994-02-24 02:02:37 +01:00
break;
case SAVE_EXPR:
if (TREE_HAS_CONSTRUCTOR (t))
{
pp_cxx_ws_string (pp, "new");
pp_cxx_whitespace (pp);
dump_type (pp, TREE_TYPE (TREE_TYPE (t)), flags);
1994-02-24 02:02:37 +01:00
}
else
dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
1994-02-24 02:02:37 +01:00
break;
case AGGR_INIT_EXPR:
{
tree fn = NULL_TREE;
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (TREE_CODE (AGGR_INIT_EXPR_FN (t)) == ADDR_EXPR)
fn = TREE_OPERAND (AGGR_INIT_EXPR_FN (t), 0);
if (fn && TREE_CODE (fn) == FUNCTION_DECL)
{
if (DECL_CONSTRUCTOR_P (fn))
dump_type (pp, DECL_CONTEXT (fn), flags);
else
dump_decl (pp, fn, 0);
}
else
dump_expr (pp, AGGR_INIT_EXPR_FN (t), 0);
}
dump_aggr_init_expr_args (pp, t, flags, true);
1994-02-24 02:02:37 +01:00
break;
case CALL_EXPR:
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree fn = CALL_EXPR_FN (t);
bool skipfirst = false;
/* Deal with internal functions. */
if (fn == NULL_TREE)
{
pp_string (pp, internal_fn_name (CALL_EXPR_IFN (t)));
dump_call_expr_args (pp, t, flags, skipfirst);
break;
}
1994-02-24 02:02:37 +01:00
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);
2006-06-06 13:44:09 +02:00
/* Nobody is interested in seeing the guts of vcalls. */
if (TREE_CODE (fn) == OBJ_TYPE_REF)
fn = resolve_virtual_fun_from_obj_type_ref (fn);
if (TREE_TYPE (fn) != NULL_TREE
&& NEXT_CODE (fn) == METHOD_TYPE
&& call_expr_nargs (t))
1994-02-24 02:02:37 +01:00
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree ob = CALL_EXPR_ARG (t, 0);
1994-02-24 02:02:37 +01:00
if (TREE_CODE (ob) == ADDR_EXPR)
{
dump_expr (pp, TREE_OPERAND (ob, 0),
flags | TFF_EXPR_IN_PARENS);
pp_cxx_dot (pp);
1994-02-24 02:02:37 +01:00
}
else if (TREE_CODE (ob) != PARM_DECL
|| strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
{
dump_expr (pp, ob, flags | TFF_EXPR_IN_PARENS);
pp_cxx_arrow (pp);
1994-02-24 02:02:37 +01:00
}
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
skipfirst = true;
1994-02-24 02:02:37 +01:00
}
if (flag_sanitize & SANITIZE_UNDEFINED
&& is_ubsan_builtin_p (fn))
{
pp_string (cxx_pp, M_("<ubsan routine call>"));
break;
}
dump_expr (pp, fn, flags | TFF_EXPR_IN_PARENS);
dump_call_expr_args (pp, t, flags, skipfirst);
1994-02-24 02:02:37 +01:00
}
break;
case TARGET_EXPR:
/* Note that this only works for G++ target exprs. If somebody
builds a general TARGET_EXPR, there's no way to represent that
it initializes anything other that the parameter slot for the
default argument. Note we may have cleared out the first
operand in expand_expr, so don't go killing ourselves. */
if (TREE_OPERAND (t, 1))
dump_expr (pp, TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
1994-02-24 02:02:37 +01:00
break;
case POINTER_PLUS_EXPR:
dump_binary_op (pp, "+", t, flags);
break;
case INIT_EXPR:
1994-02-24 02:02:37 +01:00
case MODIFY_EXPR:
dump_binary_op (pp, assignment_operator_name_info[NOP_EXPR].name,
t, flags);
break;
1994-02-24 02:02:37 +01:00
case PLUS_EXPR:
case MINUS_EXPR:
case MULT_EXPR:
case TRUNC_DIV_EXPR:
case TRUNC_MOD_EXPR:
case MIN_EXPR:
case MAX_EXPR:
case LSHIFT_EXPR:
case RSHIFT_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case BIT_AND_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
case LT_EXPR:
case LE_EXPR:
case GT_EXPR:
case GE_EXPR:
case EQ_EXPR:
case NE_EXPR:
case EXACT_DIV_EXPR:
dump_binary_op (pp, operator_name_info[TREE_CODE (t)].name, t, flags);
1994-02-24 02:02:37 +01:00
break;
case CEIL_DIV_EXPR:
case FLOOR_DIV_EXPR:
case ROUND_DIV_EXPR:
case RDIV_EXPR:
dump_binary_op (pp, "/", t, flags);
1994-02-24 02:02:37 +01:00
break;
case CEIL_MOD_EXPR:
case FLOOR_MOD_EXPR:
case ROUND_MOD_EXPR:
dump_binary_op (pp, "%", t, flags);
1994-02-24 02:02:37 +01:00
break;
case COMPONENT_REF:
{
tree ob = TREE_OPERAND (t, 0);
if (INDIRECT_REF_P (ob))
1994-02-24 02:02:37 +01:00
{
ob = TREE_OPERAND (ob, 0);
if (TREE_CODE (ob) != PARM_DECL
|| (DECL_NAME (ob)
&& strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this")))
1994-02-24 02:02:37 +01:00
{
dump_expr (pp, ob, flags | TFF_EXPR_IN_PARENS);
if (TREE_CODE (TREE_TYPE (ob)) == REFERENCE_TYPE)
pp_cxx_dot (pp);
else
pp_cxx_arrow (pp);
1994-02-24 02:02:37 +01:00
}
}
else
{
dump_expr (pp, ob, flags | TFF_EXPR_IN_PARENS);
if (TREE_CODE (ob) != ARROW_EXPR)
pp_cxx_dot (pp);
1994-02-24 02:02:37 +01:00
}
dump_expr (pp, TREE_OPERAND (t, 1), flags & ~TFF_EXPR_IN_PARENS);
1994-02-24 02:02:37 +01:00
}
break;
case ARRAY_REF:
dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_cxx_left_bracket (pp);
dump_expr (pp, TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_bracket (pp);
Implemented Cilk Plus Array Notation for C++ Implemented Cilk Plus Array Notation for C++ gcc/c-family/ChangeLog 2013-06-21 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-common.h (struct cilkplus_an_parts): New structure. (struct cilkplus_an_loop_parts): Likewise. (cilkplus_extract_an_triplets): New prototype. (fix_sec_implicit_args): Likewise. * array-notation-common.c (cilkplus_extract_an_triplets): New function. (fix_sec_implicit_args): Likewise. gcc/cp/ChangeLog 2013-06-21 Balaji V. Iyer <balaji.v.iyer@intel.com> * call.c (convert_like_real): Added a check if array notation is present in expression. If so, then no conversion of arguments is necessary. (build_over_call): Likewise. * typeck.c (cp_build_function_call_vec): Likewise. (convert_for_assignment): Likewise. (cp_build_array_ref): Reject array notations with a rank greater than 1 as an array's index. (cp_build_binary_op): If array notations are preent in op, then call find_correct_array_notation_type. (cp_build_addr_expr_1): Handle ARRAY_NOTATION_REF similar to ARRAY_REF. * cp-array-notation.c: New file. * cp-objcp-common.c (cp_common_init_ts): Marked ARRAY_NOTATION_REF tree as typed. * cp-tree.h (fix_array_notation_exprs): New prototype. * semantics.c (finish_return_stmt): Reject array notations as return value. (cxx_eval_constant_expression): Added ARRAY_NOTATION_REF case. (potential_constant_expression_1): Likewise. * tree.c (lvalue_kind): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Likewise. * pt.c (ARRAY_NOTATION_REF): Likewise. (type_unification_real): Do not unify any arguments if array notations are found in arg. (instantiate_decl): Added a check for array notaitons inside the function body. If so, then expand them. * parser.c (cp_parser_array_notation): New function. (cp_parser_postfix_open_square_expression): Added a check for colons inside square braces. If found, then handle the array access as an array notation access. Also, disable auto-correction from a single colon to scope when Cilk Plus is enabled. (cp_parser_compound_statement): Added a check for array notations inside the statement. If found, then expand them. (cp_parser_ctor_initializer_opt_and_function_body): Likewise. (cp_parser_function_definition_after_declarator): Likewise. (cp_parser_selection_statement): Searched for array notations inside condition. If so, then emit an error. (cp_parser_iteration_statement): Likewise. (cp_parser_direct_declarator): Reject array notations inside a variable or array declaration. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Added cp/cp-array-notation.o. gcc/testsuite/ChangeLog 2013-06-21 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-c++-common/cilk-plus/AN/array_test1.c: Make this an execution test. Also changed the returns from error as distinct values so that debugging can get easier. * c-c++-common/cilk-plus/AN/if_test_errors.c (main): Made certain errors specific to C, if necessary. Also added new error hooks for C++. * c-c++-common/cilk-plus/AN/misc.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors2.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors3.c (main): Likewise. * c-c++-common/cilk-plus/AN/pr57541.c (main): Likewise. * c-c++-common/cilk-plus/AN/parser_errors4.c (main): In addition to the same changes as parser_errors3.c, spaces were added between colons to not confuse C++ compiler with 2 colons as scope. * c-c++-common/cilk-plus/AN/vla.c: Make this test C specific. * g++.dg/cilk-plus/AN/array_test1_tplt.cc: New test. * g++.dg/cilk-plus/AN/array_test2_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/array_test_ND_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/braced_list.cc: Likewise. * g++.dg/cilk-plus/AN/builtin_fn_custom_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc: Likewise. * g++.dg/cilk-plus/AN/fp_triplet_values_tplt.c: Likewise. * g++.dg/cilk-plus/AN/preincr_test.cc: Likewise. * g++.dg/cilk-plus/AN/postincr_test.cc: Likewise. * g++.dg/cilk-plus/cilk-plus.exp: New script. * gcc/testsuite/g++.dg/dg.exp: Included Cilk Plus C++ tests in the list. From-SVN: r200319
2013-06-21 21:36:47 +02:00
break;
case ARRAY_NOTATION_REF:
dump_expr (pp, ARRAY_NOTATION_ARRAY (t), flags | TFF_EXPR_IN_PARENS);
pp_cxx_left_bracket (pp);
dump_expr (pp, ARRAY_NOTATION_START (t), flags | TFF_EXPR_IN_PARENS);
pp_colon (pp);
dump_expr (pp, ARRAY_NOTATION_LENGTH (t), flags | TFF_EXPR_IN_PARENS);
pp_colon (pp);
dump_expr (pp, ARRAY_NOTATION_STRIDE (t), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_bracket (pp);
break;
case UNARY_PLUS_EXPR:
dump_unary_op (pp, "+", t, flags);
1994-02-24 02:02:37 +01:00
break;
case ADDR_EXPR:
if (TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL
cp-tree.h (struct language_function): Remove x_base_init_list and x_member_init_list. * cp-tree.h (struct language_function): Remove x_base_init_list and x_member_init_list. (current_base_init_list): Remove. (current_member_init_list): Likewise. (setup_vtbl_ptr): Change prototype. (emit_base_init): Likewise. (expand_member_init): Likewise. (reinit_parse_for_function): Remove. * decl.c (save_function_data): Don't clear x_base_init_list and x_member_init_list. (mark_language_function): Don't mark them. * init.c (perform_member_init): Tweak comment. (sort_member_init): Take the list of initializers as an argument. (sort_base_init): Likewise. (emit_base_init): Likewise. (expand_member_init): Return the initializer. Don't use global variables. * lex.c (reinit_parse_for_function): Remove. * method.c (build_template_parm_names): Correct substitution. (do_build_copy_constructor): Don't use current_member_init_list and current_base_init_list. (synthesize_method): Likewise. * parse.y (base_init): Split mem-initializers into base-initializers and field-initializers. (member_init_list): Build up the list here. (member_init): Return the initializer. (fn.depfn): Don't use reinit_parse_for_function. * parse.c: Regenerated. * pt.c (convert_nontype_argument): Don't make an ADDR_EXPR of the ERROR_MARK. (tsubst_expr): Don't use current_member_init_list and current_base_init_list. (tsubst_expr_values): Rename to ... (tsubst_initializer_list): ... this. Use convert_from_reference. * semantics.c (setup_vtbl_ptr): Don't use current_member_init_list and current_base_init_list. (begin_function_definition): Don't call reinit_parse_for_function. * dump.c (dequeue_and_dump): Use TREE_VEC_LENGTH with vectors. * error.c (dump_expr): Handle ADDR_EXPRs with REFERENCE_TYPE correctly. From-SVN: r34571
2000-06-16 09:34:51 +02:00
|| TREE_CODE (TREE_OPERAND (t, 0)) == STRING_CST
/* An ADDR_EXPR can have reference type. In that case, we
shouldn't print the `&' doing so indicates to the user
that the expression has pointer type. */
|| (TREE_TYPE (t)
cp-tree.h (struct language_function): Remove x_base_init_list and x_member_init_list. * cp-tree.h (struct language_function): Remove x_base_init_list and x_member_init_list. (current_base_init_list): Remove. (current_member_init_list): Likewise. (setup_vtbl_ptr): Change prototype. (emit_base_init): Likewise. (expand_member_init): Likewise. (reinit_parse_for_function): Remove. * decl.c (save_function_data): Don't clear x_base_init_list and x_member_init_list. (mark_language_function): Don't mark them. * init.c (perform_member_init): Tweak comment. (sort_member_init): Take the list of initializers as an argument. (sort_base_init): Likewise. (emit_base_init): Likewise. (expand_member_init): Return the initializer. Don't use global variables. * lex.c (reinit_parse_for_function): Remove. * method.c (build_template_parm_names): Correct substitution. (do_build_copy_constructor): Don't use current_member_init_list and current_base_init_list. (synthesize_method): Likewise. * parse.y (base_init): Split mem-initializers into base-initializers and field-initializers. (member_init_list): Build up the list here. (member_init): Return the initializer. (fn.depfn): Don't use reinit_parse_for_function. * parse.c: Regenerated. * pt.c (convert_nontype_argument): Don't make an ADDR_EXPR of the ERROR_MARK. (tsubst_expr): Don't use current_member_init_list and current_base_init_list. (tsubst_expr_values): Rename to ... (tsubst_initializer_list): ... this. Use convert_from_reference. * semantics.c (setup_vtbl_ptr): Don't use current_member_init_list and current_base_init_list. (begin_function_definition): Don't call reinit_parse_for_function. * dump.c (dequeue_and_dump): Use TREE_VEC_LENGTH with vectors. * error.c (dump_expr): Handle ADDR_EXPRs with REFERENCE_TYPE correctly. From-SVN: r34571
2000-06-16 09:34:51 +02:00
&& TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE))
dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
else if (TREE_CODE (TREE_OPERAND (t, 0)) == LABEL_DECL)
dump_unary_op (pp, "&&", t, flags);
1994-02-24 02:02:37 +01:00
else
dump_unary_op (pp, "&", t, flags);
1994-02-24 02:02:37 +01:00
break;
case INDIRECT_REF:
if (TREE_HAS_CONSTRUCTOR (t))
{
t = TREE_OPERAND (t, 0);
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (TREE_CODE (t) == CALL_EXPR);
dump_expr (pp, CALL_EXPR_FN (t), flags | TFF_EXPR_IN_PARENS);
dump_call_expr_args (pp, t, flags, true);
1994-02-24 02:02:37 +01:00
}
else
{
if (TREE_OPERAND (t,0) != NULL_TREE
&& TREE_TYPE (TREE_OPERAND (t, 0))
&& NEXT_CODE (TREE_OPERAND (t, 0)) == REFERENCE_TYPE)
dump_expr (pp, TREE_OPERAND (t, 0), flags);
1994-02-24 02:02:37 +01:00
else
dump_unary_op (pp, "*", t, flags);
1994-02-24 02:02:37 +01:00
}
break;
case MEM_REF:
if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR
&& integer_zerop (TREE_OPERAND (t, 1)))
dump_expr (pp, TREE_OPERAND (TREE_OPERAND (t, 0), 0), flags);
else
{
pp_cxx_star (pp);
if (!integer_zerop (TREE_OPERAND (t, 1)))
{
pp_cxx_left_paren (pp);
if (!integer_onep (TYPE_SIZE_UNIT
(TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0))))))
{
pp_cxx_left_paren (pp);
dump_type (pp, ptr_type_node, flags);
pp_cxx_right_paren (pp);
}
}
dump_expr (pp, TREE_OPERAND (t, 0), flags);
if (!integer_zerop (TREE_OPERAND (t, 1)))
{
pp_cxx_ws_string (pp, "+");
dump_expr (pp, fold_convert (ssizetype, TREE_OPERAND (t, 1)),
flags);
pp_cxx_right_paren (pp);
}
}
break;
1994-02-24 02:02:37 +01:00
case NEGATE_EXPR:
case BIT_NOT_EXPR:
case TRUTH_NOT_EXPR:
case PREDECREMENT_EXPR:
case PREINCREMENT_EXPR:
dump_unary_op (pp, operator_name_info [TREE_CODE (t)].name, t, flags);
1994-02-24 02:02:37 +01:00
break;
case POSTDECREMENT_EXPR:
case POSTINCREMENT_EXPR:
pp_cxx_left_paren (pp);
dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_cxx_ws_string (pp, operator_name_info[TREE_CODE (t)].name);
pp_cxx_right_paren (pp);
1994-02-24 02:02:37 +01:00
break;
case NON_LVALUE_EXPR:
/* FIXME: This is a KLUDGE workaround for a parsing problem. There
should be another level of INDIRECT_REF so that I don't have to do
this. */
if (TREE_TYPE (t) != NULL_TREE && NEXT_CODE (t) == POINTER_TYPE)
1994-02-24 02:02:37 +01:00
{
tree next = TREE_TYPE (TREE_TYPE (t));
call.c (add_builtin_candidate): Use TYPE_PTR_P and VOID_TYPE_P. 2013-03-29 Paolo Carlini <paolo.carlini@oracle.com> * call.c (add_builtin_candidate): Use TYPE_PTR_P and VOID_TYPE_P. (build_op_call_1): Likewise. (build_over_call): Likewise. (compare_ics): Likewise. * class.c (build_base_path): Likewise. (resolve_address_of_overloaded_function): Likewise. * cp-tree.h: Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_reference): Likewise. (ocp_convert): Likewise. (convert_force): Likewise, tidy. * cxx-pretty-print.c (pp_cxx_postfix_expression): Likewise. (pp_cxx_ptr_operator): Likewise. * decl.c (duplicate_decls): Likewise. (start_decl): Likewise. (grok_op_properties): Likewise. (start_preparsed_function): Likewise. (store_parm_decls): Likewise. (finish_function): Likewise. * decl2.c (delete_sanity): Likewise. (acceptable_java_type): Likewise. (grokbitfield): Likewise. (cp_reconstruct_complex_type): Likewise. * error.c (dump_type_prefix): Likewise. (dump_expr): Likewise. * except.c (push_eh_cleanup): Likewise. (complete_ptr_ref_or_void_ptr_p): Likewise. (can_convert_eh): Likewise. * init.c (build_new_1): Likewise. (build_delete): Likewise. (build_vec_delete): Likewise. * mangle.c (write_type): Likewise. * parser.c (lookup_literal_operator): Likewise. * pt.c (convert_nontype_argument_function): Likewise. (convert_nontype_argument): Likewise. (tsubst): Likewise. (unify): Likewise. (dependent_type_p_r): Likewise. * rtti.c (build_headof): Likewise. (build_typeid): Likewise. (build_dynamic_cast_1): Likewise. (target_incomplete_p): Likewise. (typeinfo_in_lib_p): Likewise. * semantics.c (finish_omp_for): Likewise. (cxx_eval_call_expression): Likewise. (maybe_resolve_dummy): Likewise. * tree.c (build_target_expr): Likewise. (cp_build_qualified_type_real): Likewise. * typeck.c (composite_pointer_type_r): Likewise. (composite_pointer_type): Likewise. (comp_except_types): Likewise. (cxx_sizeof_nowarn): Likewise. (string_conv_p): Likewise. (cp_build_array_ref): Likewise. (cp_build_function_call_vec): Likewise, also use TYPE_PTRFN_P. (pointer_diff): Likewise. (cp_build_addr_expr_1): Likewise. (cp_build_unary_op): Likewise. (build_static_cast_1): Likewise. (cp_build_c_cast): Likewise. (comp_ptr_ttypes_real): Likewise. (ptr_reasonably_similar): Likewise. (comp_ptr_ttypes_const): Likewise. (casts_away_constness): Likewise. (check_literal_operator_args): Likewise. * typeck2.c (build_x_arrow): Likewise. (add_exception_specifier): Likewise. From-SVN: r197249
2013-03-29 21:29:26 +01:00
while (TYPE_PTR_P (next))
1994-02-24 02:02:37 +01:00
next = TREE_TYPE (next);
1994-02-24 02:02:37 +01:00
if (TREE_CODE (next) == FUNCTION_TYPE)
{
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_left_paren (pp);
pp_cxx_star (pp);
dump_expr (pp, TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_right_paren (pp);
1994-02-24 02:02:37 +01:00
break;
}
/* Else fall through. */
1994-02-24 02:02:37 +01:00
}
dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
1994-02-24 02:02:37 +01:00
break;
CASE_CONVERT:
case IMPLICIT_CONV_EXPR:
case VIEW_CONVERT_EXPR:
{
tree op = TREE_OPERAND (t, 0);
tree ttype = TREE_TYPE (t);
tree optype = TREE_TYPE (op);
if (TREE_CODE (ttype) != TREE_CODE (optype)
&& POINTER_TYPE_P (ttype)
&& POINTER_TYPE_P (optype)
&& same_type_p (TREE_TYPE (optype),
TREE_TYPE (ttype)))
{
if (TREE_CODE (ttype) == REFERENCE_TYPE)
{
STRIP_NOPS (op);
if (TREE_CODE (op) == ADDR_EXPR)
dump_expr (pp, TREE_OPERAND (op, 0), flags);
else
dump_unary_op (pp, "*", t, flags);
}
else
dump_unary_op (pp, "&", t, flags);
}
else if (!same_type_p (TREE_TYPE (op), TREE_TYPE (t)))
{
/* It is a cast, but we cannot tell whether it is a
reinterpret or static cast. Use the C style notation. */
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_left_paren (pp);
pp_cxx_left_paren (pp);
dump_type (pp, TREE_TYPE (t), flags);
pp_cxx_right_paren (pp);
dump_expr (pp, op, flags | TFF_EXPR_IN_PARENS);
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_right_paren (pp);
}
else
dump_expr (pp, op, flags);
break;
}
1994-02-24 02:02:37 +01:00
case CONSTRUCTOR:
if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
{
Rework build_component_ref. * call.c (build_vfield_ref): Do not go through build_component_ref. (build_field_call): Use build_class_member_access_expr. (build_user_type_conversion_1): Use BASELINK_FUNCTIONS. (build_object_call): Likewise. * class.c (convert_to_base): New function. (type_requires_array_cookie): Use BASELINK_FUNCTIONS. (instantiate_type): Handle BASELINKs. * cp-tree.def (BASELINK): New tree code. * cp-tree.h (BASELINK_P): Reimplement. (SET_BASELINK_P): Remove. (BASELINK_BINFO): Reimplement. (BASELINK_FUNCTIONS): Likewise. (BASELINK_ACCESS_BINFO): Likewise. (BASELINK_OPTYPE): Likewise. (convert_to_base): New function. (name_p): Likewise. (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_component_ref): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. * decl.c (grokdeclarator): Handle BASELINKs. * decl2. (build_expr_from_tree): Handle COMPONENT_REFs by using finish_class_member_access_expr. (arg_assoc): Handle BASELINKs. (do_class_using_decl): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Use build_ptrmemfunc_access_expr. * except.c (dtor_nothrow): Use CLASSTYPE_DESTRUCTORS to find destructors. (build_throw): Use BASELINK_FUNCTIONS. * init.c (perform_member_init): Use build_class_member_access_expr. (build_offset_ref): Handle BASELINKs. Use build_class_member_access_expr. * method.c (hack_identifier): Likewise. * parse.y (do_id): Use BASELINK, not TREE_LIST. (primary): Remove uses of build_object_ref. * pt.c (lookup_template_function): Handle BASELINKs. (resolve_overloaded_unification): Likewise. * search.c (build_baselink): Build a BASELINK, not a TREE_LIST. (lookup_field): Use BASELINK, not TREE_LIST. (lookup_fnfiels): Likewise. (setup_class_bindings): Likewise. * semantics.c (finish_object_call_expr): Do not use build_method_call when we already know what function is being called. * spew.c (identifier_type): Use BASELINK, not TREE_LIST. * tree.c (really_overloaded_fn): Use OVL_CHAIN for OVERLOADs, not TREE_CHAIN. (name_p): New function. * typeck.c (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. (get_member_function_from_ptrfunc): Use build_ptrmemfunc_access_expr. (build_binary_op): Likewise. (build_unary_op): Likewise. (build_ptrmemfunc): Likewise. (pfn_from_ptrmemfunc): Likewise. * typeck2.c (build_m_component_ref): Adjust comment. * g++.dg/abi/offsetof.C: Tweak error messages. * g++.old-deja/g++.mike/p10769a.C: Likewise. From-SVN: r56117
2002-08-08 07:48:39 +02:00
tree idx = build_ptrmemfunc_access_expr (t, pfn_identifier);
tm.texi: Remove DEFAULT_VTABLE_THUNKS. gcc: * doc/tm.texi: Remove DEFAULT_VTABLE_THUNKS. * config/freebsd.h: Likewise. * config/linux.h: Likewise. * config/openbsd.h: Likewise. * config/alpha/linux-elf.h: Likewise. * config/arm/linux-elf.h: Likewise. * config/d30v/d30v.h: Likewise. * config/fr30/fr30.h: Likewise. * config/ia64/aix.h: Likewise. * config/ia64/ia64.h: Likewise. * config/mips/linux.h: Likewise. * config/pj/pj.h: Likewise. * config/rs6000/linux.h: Likewise. * config/sparc/linux.h: Likewise. * config/sparc/linux64.h: Likewise. cp: Remove flag_vtable_thunk. It is always on for the 3.0 ABI. * cp-tree.h (CPTI_DELTA2_IDENTIFIER): Remove. (CPTI_INDEX_IDENTIFIER): Remove. (CPT_PFN_OR_DELTA2_IDENTIFIER): Remove. (delta2_identifier): Remove. (index_identifier): Remove. (pfn_or_delta2_identifier): Remove. (flag_vtable_thunks): Remove. (VTABLE_DELTA2_NAME): Remove. (VTABLE_INDEX_NAME): Remove. (FNADDR_FROM_VTABLE_ENTRY): Adjust. (vfunc_ptr_type_node): Adjust. (VTABLE_NAME_PREFIX): Adjust. (build_vfn_ref): Lose first parameter. (fixup_all_virtual_upcast_offsets): Remove. * decl.c (initialize_predefined_identifiers): Remove delta2_identifier, index_identifier, pfn_or_delta2_identifier. (init_decl_processing): Remove no-vtable-thunk code. * decl2.c (flag_vtable_thunks): Remove. (mark_vtable_entries): Remove no-vtable-thunk code. * error.c (dump_decl): Remove no-vtable-thunk code. (dump_expr): Adjust ptr to member function code. * init.c (initialize_vtable_ptrs): Remove no-vtable-thunk code. * rtti.c (build_headof): Remove no-vtable-thunk code. (get_tinfo_decl_dynamic): Adjust build_vfn_ref call. * search.c (get_base_distance): Remove expand_upcast_fixups case. (virtual_context) Remove. (expand_upcast_fixups): Remove. (fixup_virtual_upcast_offsets): Remove. (fixup_all_virtual_upcast_offsets): Remove. * typeck.c (get_member_function_from_ptrfunc): Remove no-vtable-thunk code. * call.c (build_over_call): Adjust call to build_vfn_ref. * class.c (build_vfn_ref): Lose first parameter. Remove no-vtable-thunk code. (build_rtti_vtbl_entries): Remove no-vtable-thunk code. (build_vtable_entry): Remove no-vtable-thunk code. From-SVN: r44227
2001-07-21 11:42:21 +02:00
if (integer_zerop (idx))
{
/* A NULL pointer-to-member constant. */
pp_cxx_left_paren (pp);
pp_cxx_left_paren (pp);
dump_type (pp, TREE_TYPE (t), flags);
pp_cxx_right_paren (pp);
pp_character (pp, '0');
pp_cxx_right_paren (pp);
break;
}
cuintp.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/ada/ * gcc-interface/cuintp.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/c-family/ * c-ada-spec.c, c-common.c, c-format.c, c-pretty-print.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/c/ * c-parser.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/cp/ * error.c, init.c, parser.c, semantics.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/go/ * gofrontend/expressions.cc: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/java/ * class.c, expr.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. gcc/ * builtins.c, config/alpha/alpha.c, config/c6x/predicates.md, config/ia64/predicates.md, config/iq2000/iq2000.c, config/mips/mips.c, config/s390/s390.c, dbxout.c, dwarf2out.c, except.c, explow.c, expr.c, expr.h, fold-const.c, gimple-fold.c, gimple-ssa-strength-reduction.c, gimple.c, godump.c, graphite-scop-detection.c, graphite-sese-to-poly.c, omp-low.c, predict.c, rtlanal.c, sdbout.c, simplify-rtx.c, stor-layout.c, tree-data-ref.c, tree-dfa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-alias.c, tree-ssa-forwprop.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c, tree-ssa-math-opts.c, tree-ssa-phiopt.c, tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-vect-data-refs.c, tree-vect-patterns.c, tree-vectorizer.h, tree.c, var-tracking.c, varasm.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. From-SVN: r204955
2013-11-18 15:51:10 +01:00
else if (tree_fits_shwi_p (idx))
{
tree virtuals;
unsigned HOST_WIDE_INT n;
t = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t)));
t = TYPE_METHOD_BASETYPE (t);
tree.h (TYPE_BINFO_OFFSET, [...]): Remove. * tree.h (TYPE_BINFO_OFFSET, TYPE_BINFO_VTABLE, TYPE_BINFO_VIRTUALS, TYPE_BINFO_BASETYPES, TYPE_BINFO_BASETYPE): Remove. (BINFO_BASETYPES, BINFO_N_BASETYPES, BINFO_BASETYPE): Rename to ... (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): ... here. (BINFO_BASEACCESSES, BINFO_BASEACCESS): Rename to ... (BINFO_BASE_ACCESSES, BINFO_BASE_ACCESS): ... here. (BINFO_INHERITANCE_CHAIN): Redocument as it is actually used. (struct tree_binfo): Rename base_types to base_binfos. * alias.c (record_component_aliases): Adjust BINFO macros. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * cp/cp-tree.h (CLASSTYPE_N_BASECLASSES): Remove. * cp/class.c (build_primary_vtable, check_bases, determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, dfs_find_final_overrider_q, get_basefndecls, warn_hidden, walk_subobject_offsets, build_base_fields, create_vtable_ptr, propagate_binfo_offsets, layout_virtual_bases, end_of_class, warn_about_ambiguous_bases, finish_struct_1, get_vfield_name, contains_empty_class_p, dump_class_hierarchy_r, finish_vtbls, build_vtt_inits, dfs_ctor_vtable_bases_queue_p, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r, cp_fold_obj_type_ref): Adjust BINFO macros. * cp/decl.c (xref_basetypes): Likewise. * cp/dump.c (cp_dump_tree): Likewise. * cp/error.c (dump_expr): Likewise. * cp/init.c (sort_mem_initializers, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor, do_build_assign_reg, synthesize_exception_spec): Likewise. * cp/name-lookup.c (arg_assoc_class): * cp/pt.c (instantiate_class_template, tsubst, get_template_base_recursive): * cp/ptree.c (cxx_print_type): * cp/rtti.c (get_psuedo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, access_in_type, lookup_field_queue_p, bfs_walk, dfs_walk_real, look_for_overrides, markedp, unmarkedp, marked_pushdecls_p, unmarked_pushdecls_p, dfs_debug_markedp, dfs_debug_unmarkedp, dfs_check_overlap, dfs_no_overlap_yet, binfo_for_vtable, copied_binfo, original_binfo): Likewise * cp/tree.c (copy_base_binfos, make_binfo): Likewise. * cp/typeck.c (commmon_base_type): Likewise * cp/typeck2.c (process_init_constructor): Likewise * java/java-tree.h (CLASSTYPE_SPUER): Adjust BINFO macros. (TYPE_NVIRTUALS, TYPE_VTABLE): Likewise. * java/class.c (set_super_info, class_depth, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO macros. * java/expr.c (can_widen_reference_to, lookup_field): Likewise. * java/jcf-write.c (generate_classfile): Likewise. * java/parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Likewise. * java/typeck.c (find_method_in_interface): Likewise. * java/verify.c (merge_types): Likewise. From-SVN: r84198
2004-07-07 12:21:04 +02:00
virtuals = BINFO_VIRTUALS (TYPE_BINFO (TYPE_MAIN_VARIANT (t)));
n = tree_to_shwi (idx);
/* Map vtable index back one, to allow for the null pointer to
member. */
--n;
while (n > 0 && virtuals)
{
--n;
virtuals = TREE_CHAIN (virtuals);
}
if (virtuals)
{
dump_expr (pp, BV_FN (virtuals),
flags | TFF_EXPR_IN_PARENS);
break;
}
}
}
if (TREE_TYPE (t) && LAMBDA_TYPE_P (TREE_TYPE (t)))
pp_string (pp, "<lambda closure object>");
Make CONSTRUCTOR use VEC to store initializers. * c-common.c (complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts. (pp_c_constructor_elts): New function. * c-pretty-print.h (pp_c_constructor_elts): Declare. * c-typeck.c (build_function_call, build_c_cast, digest_init, struct constructor_stack, struct initializer_stack, constructor_elements, push_init_level, pop_init_level, add_pending_init, find_init_member, output_init_element): Update to cope with VEC in CONSTRUCTOR_ELTS. * coverage.c (build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * expr.c (categorize_ctor_elements_1, store_constructor, expand_expr_real_1): Likewise. * fold-const.c (fold_ternary): Likewise. * gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl, gimplify_init_constructor, gimplify_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR node. * tree-pretty-print.c (dump_generic_node): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree-sra.c (generate_element_init_1): Likewise. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vect-transform.c (vect_get_vec_def_for_operand): (get_initial_def_for_reduction): Likewise. * tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses value handle in annotations. * tree.c (tree_node_kind, tree_code_size, make_node_stat, tree_node_structure): Add support for constr_kind. (build_vector_from_ctor, build_constructor_single, build_constructor_from_list): New functions. (build_constructor): Update to take a VEC instead of a TREE_LIST. (simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree.def (CONSTRUCTOR): Make it a tcc_exceptional node. * tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT, CONSTRUCTOR_APPEND_ELT): New macros. (struct constructor_elt, struct tree_constructor): New data types. (union tree_node): Add tree_constructor field. * treestruct.def: Define TS_CONSTRUCTOR. * varasm.c (const_hash_1, compare_constant, copy_constant, compute_reloc_for_constant, output_addressed_constants, initializer_constant_valid_p, output_constant, array_size_for_constructor, output_constructor): Update to cope with VEC in CONSTRUCTOR_ELTS. * vec.h (VEC_empty, VEC_copy): New macros. ada/ Make CONSTRUCTOR use VEC to store initializers. * decl.c (gnat_to_gnu_entity): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans.c (extract_values): Likewise. * utils.c (convert, remove_conversions): Likewise. * utils2.c (contains_save_expr_p, build_binary_op, build_unary_op, gnat_build_constructor): Likewise. cp/ Make CONSTRUCTOR use VEC to store initializers. * call.c (convert_default_arg): Update call to digest_init. * class.c (dump_class_hierarchy, dump_array): Update to cope with VEC in CONSTRUCTOR_ELTS. * cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise. (finish_compound_literal, digest_init): Update declaration. * decl.c (struct reshape_iter): New data type. (reshape_init_array): Rename to... (reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS. (reshape_init): Rewrite from scratch. Split parts into... (reshape_init_array, reshape_init_vector, reshape_init_class, reshape_init_r): New functions. (check_initializer): Update call to reshape_init. Remove obsolete code. (initialize_artificial_var, cp_complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * decl2.c (grokfield): Update calls to digest_init. (mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS. * error.c (dump_expr_init_vec): New function. (dump_expr): Use dump_expr_init_vec. * init.c (build_zero_init, build_vec_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (expand_default_init): Update call to digest_init. * parser.c (cp_parser_postfix_expression): Use a VEC for the initializers. (cp_parser_initializer_list): Build a VEC of initializers. * pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC in CONSTRUCTOR_ELTS. * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer, get_pseudo_ti_init): Use build_constructor_from_list instead of build_constructor. * semantics.c (finish_compound_literal): Update call to digest_init. * tree.c (stabilize_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * typeck.c (build_ptrmemfunc1): Likewise. * typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1): Likewise. (store_init_value): Use build_constructor_from_list and update call to digest_init. (digest_init): Rewrite. (process_init_constructor): Rewrite from scratch. Split into... (process_init_constructor_array, picflag_from_initializer, process_init_constructor_record, process_init_constructor_union): New functions. (PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE): New macros. (build_functional_cast): Use build_constructor_from_list instead of build_constructor. fortran/ Make CONSTRUCTOR use VEC to store initializers. * trans-array.c (gfc_build_null_descriptor, gfc_trans_array_constructor_value, gfc_conv_array_initializer): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans-common.c (create_common): Likewise. * trans-expr.c (gfc_conv_structure): Likewise. * trans-stmt.c (gfc_trans_character_select): Use build_constructor_from_list instead of build_constructor. java/ Make CONSTRUCTOR use VEC to store initializers. * check-init.c (check_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * class.c (make_field_value, make_method_value, get_dispatch_table, make_class_data, emit_symbol_table, emit_catch_table, emit_assertion_table): Use build_constructor_from_list instead of build_constructor. * constants.c (build_constants_constructor): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE, PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead of a TREE_LIST. * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in CONSTRUCTOR_ELTS. * parse.y (build_new_array_init): Use build_constructor_from_list instead of build_constructor. (patch_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (array_constructor_check_entry): Likewise. objc/ Make CONSTRUCTOR use VEC to store initializers. * objc-act.c (objc_build_constructor): Use build_constructor_from_list instead of build_constructor. testsuite/ Make CONSTRUCTOR use VEC to store initializers. * g++.dg/ext/complit3.C: Check for specific error messages. * g++.dg/init/brace2.C: Update error message. * g++.dg/warn/Wbraces2.C: Likewise. From-SVN: r102182
2005-07-20 03:19:59 +02:00
if (TREE_TYPE (t) && EMPTY_CONSTRUCTOR_P (t))
{
dump_type (pp, TREE_TYPE (t), 0);
pp_cxx_left_paren (pp);
pp_cxx_right_paren (pp);
}
else
{
if (!BRACE_ENCLOSED_INITIALIZER_P (t))
dump_type (pp, TREE_TYPE (t), 0);
pp_cxx_left_brace (pp);
dump_expr_init_vec (pp, CONSTRUCTOR_ELTS (t), flags);
pp_cxx_right_brace (pp);
}
1994-02-24 02:02:37 +01:00
break;
case OFFSET_REF:
{
tree ob = TREE_OPERAND (t, 0);
if (is_dummy_object (ob))
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
{
t = TREE_OPERAND (t, 1);
if (TREE_CODE (t) == FUNCTION_DECL)
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
/* A::f */
dump_expr (pp, t, flags | TFF_EXPR_IN_PARENS);
else if (BASELINK_P (t))
dump_expr (pp, OVL_CURRENT (BASELINK_FUNCTIONS (t)),
flags | TFF_EXPR_IN_PARENS);
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
else
dump_decl (pp, t, flags);
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
}
else
{
if (INDIRECT_REF_P (ob))
{
dump_expr (pp, TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
pp_cxx_arrow (pp);
pp_cxx_star (pp);
}
else
{
dump_expr (pp, ob, flags | TFF_EXPR_IN_PARENS);
pp_cxx_dot (pp);
pp_cxx_star (pp);
}
dump_expr (pp, TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
}
break;
}
Support for friend templates. * typeck.c (build_x_function_call): Handle static member function templates like non-templates. Handle friend templates like normal function templates. * pt.c (tsubst, *_PARM): Don't use orig_level. (get_bindings): Don't call add_to_template_args. (instantiate_template): Likewise. (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate. * ptree.c (print_lang_type): Print index/level for template parms. * Make-lang.in (cc1plus): Note that cc1plus depends on cp/cp-tree.h and cp/cp-tree.def. * cp-tree.def (TEMPLATE_CONST_PARM): Remove. (TEMPLATE_PARM_INDEX): New tree code, used to indicate a position in a template parameter list. * cp-tree.h (template_parm_index): New structure, used as the tree structure for a TEMPLATE_PARM_INDEX. (TEMPLATE_PARM_IDX): New macro. (TEMPLATE_PARM_LEVEL): Likewise. (TEMPLATE_PARM_DESCENDANTS): Likewise. (TEMPLATE_PARM_ORIG_LEVEL): Likewise. (TEMPLATE_PARM_DECL): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (TEMPLATE_TYPE_ORIG_LEVEL): Likewise. (TEMPLATE_TYPE_DECL): Likewise. (TEMPLATE_CONST_IDX): Remove. (TEMPLATE_CONST_LEVEL): Likewise. (TEMPLATE_CONST_SET_INFO): Likewise. (TEMPLATE_TYPE_SET_INFO): Likewise. (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX node. (TEMPLATE_TYPE_LEVEL): Likewise. * decl.c (decls_match): Call comp_template_parms, rather than expanding it inline. (duplicate_decls): If two template declarations are being merged, then their TEMPLATE_INFOs should be merged as well. (grokfndecl): Save template-id information when declaring a friend with explicit template arguments. Pass arguments to check_explicit_specialization via correct convention; at some point check_explicit_specialization changed, but these call-sites did not. (grokdeclarator): Tidy up slightly. * decl2.c (check_classfn): Tidy up slightly. Don't assume that two template functions with the same DECL_ASSEMBLER_NAME the same, since the names are not yet mangled. * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the decl for a non-type parameter, rather than printing `<tparm ...>'. * friend.c (is_friend): Handle TEMPLATE_DECL friends. (do_friend): Deal with template friends. * lex.c (do_pending_inlines): Call maybe_begin_member_template_processing, rather than conditionally calling begin_member_template_processing. (process_next_inline): Likewise. Call maybe_end_member_template_processing, rather than conditionally calling end_member_template_processing. (do_pending_defargs): Likewise. (do_identifier): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. * method.c (build_mangled_template_parm_index): New function. (build_overload_value): Use it. (build_overload_name): Likewise. * pt.c (finish_member_template_decl): Allow friend declarations. (template_class_depth): New function. (is_member_template): Rename, and modify, to become... (is_member_or_friend_template): New function. (end_member_template_processing): Rename, and modify, to become... (maybe_end_member_template_processing). (build_template_parm_index): New function. (reduce_template_parm_level): New function. (process_template_parm): Modify to use build_template_parm_index. (current_template_args): Change name to current_template_parms. (push_template_decl): Deal with friend templates. (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (tsubst_friend_function): New function. (instantiate_class_template): Generate the DECL_FRIENDLIST for a new instantiation by using tsubst_friend_function rather than just tsubst. (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the appropriate new macros. Use reduce_template_parm_level to generate lower-level template parameters. Handle tsubst'ing into TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created templates. Similarly for the template parameters for a new template. (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them. (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (get_bindings): Call add_to_template_args if necessary. (instantiate_decl): Handle instantiations of friend templates. * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a TEMPLATE_TYPE_PARM as a list of fields; it's not! * spew.c (yylex): Do a little manual constant propogation to clarify the code. From-SVN: r18198
1998-02-23 04:17:44 +01:00
case TEMPLATE_PARM_INDEX:
dump_decl (pp, TEMPLATE_PARM_DECL (t), flags & ~TFF_DECL_SPECIFIERS);
break;
case CAST_EXPR:
if (TREE_OPERAND (t, 0) == NULL_TREE
|| TREE_CHAIN (TREE_OPERAND (t, 0)))
{
dump_type (pp, TREE_TYPE (t), flags);
pp_cxx_left_paren (pp);
dump_expr_list (pp, TREE_OPERAND (t, 0), flags);
pp_cxx_right_paren (pp);
}
else
{
pp_cxx_left_paren (pp);
dump_type (pp, TREE_TYPE (t), flags);
pp_cxx_right_paren (pp);
pp_cxx_left_paren (pp);
dump_expr_list (pp, TREE_OPERAND (t, 0), flags);
pp_cxx_right_paren (pp);
}
break;
case STATIC_CAST_EXPR:
pp_cxx_ws_string (pp, "static_cast");
goto cast;
case REINTERPRET_CAST_EXPR:
pp_cxx_ws_string (pp, "reinterpret_cast");
goto cast;
case CONST_CAST_EXPR:
pp_cxx_ws_string (pp, "const_cast");
goto cast;
case DYNAMIC_CAST_EXPR:
pp_cxx_ws_string (pp, "dynamic_cast");
cast:
pp_cxx_begin_template_argument_list (pp);
dump_type (pp, TREE_TYPE (t), flags);
pp_cxx_end_template_argument_list (pp);
pp_cxx_left_paren (pp);
dump_expr (pp, TREE_OPERAND (t, 0), flags);
pp_cxx_right_paren (pp);
break;
case ARROW_EXPR:
dump_expr (pp, TREE_OPERAND (t, 0), flags);
pp_cxx_arrow (pp);
break;
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
if (TREE_CODE (t) == SIZEOF_EXPR)
pp_cxx_ws_string (pp, "sizeof");
else
{
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (TREE_CODE (t) == ALIGNOF_EXPR);
pp_cxx_ws_string (pp, "__alignof__");
}
op = TREE_OPERAND (t, 0);
if (PACK_EXPANSION_P (op))
{
pp_string (pp, "...");
op = PACK_EXPANSION_PATTERN (op);
}
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
cp-tree.h (SIZEOF_EXPR_TYPE_P): Define. cp/ * cp-tree.h (SIZEOF_EXPR_TYPE_P): Define. * tree.c (cp_tree_equal): Handle SIZEOF_EXPR with SIZEOF_EXPR_TYPE_P. * mangle.c (write_expression): Likewise. * cxx-pretty-print.c (pp_cxx_unary_expression): Likewise. * error.c (dump_expr): Likewise. * parser.c (cp_parser_unary_expression): For sizeof call cxx_sizeof_or_alignof_{type,expr} just for diagnostics and return SIZEOF_EXPR with the operand. * pt.c (tsubst_copy, tsubst_copy_and_build): For SIZEOF_EXPR, call cxx_sizeof_or_alignof_{type,expr} for diagnostics, but return SIZEOF_EXPR with tsubsted operand. (value_dependent_expression_p): Handle SIZEOF_EXPR with SIZEOF_EXPR_TYPE_P. (instantiation_dependent_r): Likewise. * call.c (null_ptr_cst_p): Call maybe_constant_value for C++98. * semantics.c (finish_call_expr): Call sizeof_pointer_memaccess_warning if needed. (cxx_eval_constant_expression): Handle SIZEOF_EXPR. (potential_constant_expression_1): Remove early exit for C++98. Handle PROPERTY_REF. * decl.c (duplicate_decls): When redeclaring a builtin function, keep the merged decl builtin also if newdecl is a gnu_inline inline definition. (fold_sizeof_expr_r): New function. (compute_array_index_type): Fold SIZEOF_EXPRs in itype. * cp-gimplify.c (cp_genericize_r): Fold SIZEOF_EXPR. * typeck.c (cp_build_binary_op): For warn_for_sign_compare try harder using maybe_constant_value to get INTEGER_CSTs. * decl.c (stabilize_vla_size): Call pointer_set_destroy at the end. testsuite/ * g++.dg/torture/Wsizeof-pointer-memaccess1.C: New test. * g++.dg/torture/Wsizeof-pointer-memaccess2.C: New test. * g++.dg/warn/Wsign-compare-5.C: New test. * g++.dg/warn/Wsizeof-pointer-memaccess-1.C: New test. * g++.dg/warn/Wnull-conversion-1.C: For c++11 add dg-error. * g++.dg/ext/builtin30.C: New test. * g++.dg/ext/vla12.C: New test. * gcc.dg/builtins-85.c: New test. libstdc++-v3/ * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers. From-SVN: r192141
2012-10-05 21:30:39 +02:00
if (TREE_CODE (t) == SIZEOF_EXPR && SIZEOF_EXPR_TYPE_P (t))
dump_type (pp, TREE_TYPE (op), flags);
cp-tree.h (SIZEOF_EXPR_TYPE_P): Define. cp/ * cp-tree.h (SIZEOF_EXPR_TYPE_P): Define. * tree.c (cp_tree_equal): Handle SIZEOF_EXPR with SIZEOF_EXPR_TYPE_P. * mangle.c (write_expression): Likewise. * cxx-pretty-print.c (pp_cxx_unary_expression): Likewise. * error.c (dump_expr): Likewise. * parser.c (cp_parser_unary_expression): For sizeof call cxx_sizeof_or_alignof_{type,expr} just for diagnostics and return SIZEOF_EXPR with the operand. * pt.c (tsubst_copy, tsubst_copy_and_build): For SIZEOF_EXPR, call cxx_sizeof_or_alignof_{type,expr} for diagnostics, but return SIZEOF_EXPR with tsubsted operand. (value_dependent_expression_p): Handle SIZEOF_EXPR with SIZEOF_EXPR_TYPE_P. (instantiation_dependent_r): Likewise. * call.c (null_ptr_cst_p): Call maybe_constant_value for C++98. * semantics.c (finish_call_expr): Call sizeof_pointer_memaccess_warning if needed. (cxx_eval_constant_expression): Handle SIZEOF_EXPR. (potential_constant_expression_1): Remove early exit for C++98. Handle PROPERTY_REF. * decl.c (duplicate_decls): When redeclaring a builtin function, keep the merged decl builtin also if newdecl is a gnu_inline inline definition. (fold_sizeof_expr_r): New function. (compute_array_index_type): Fold SIZEOF_EXPRs in itype. * cp-gimplify.c (cp_genericize_r): Fold SIZEOF_EXPR. * typeck.c (cp_build_binary_op): For warn_for_sign_compare try harder using maybe_constant_value to get INTEGER_CSTs. * decl.c (stabilize_vla_size): Call pointer_set_destroy at the end. testsuite/ * g++.dg/torture/Wsizeof-pointer-memaccess1.C: New test. * g++.dg/torture/Wsizeof-pointer-memaccess2.C: New test. * g++.dg/warn/Wsign-compare-5.C: New test. * g++.dg/warn/Wsizeof-pointer-memaccess-1.C: New test. * g++.dg/warn/Wnull-conversion-1.C: For c++11 add dg-error. * g++.dg/ext/builtin30.C: New test. * g++.dg/ext/vla12.C: New test. * gcc.dg/builtins-85.c: New test. libstdc++-v3/ * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers. From-SVN: r192141
2012-10-05 21:30:39 +02:00
else if (TYPE_P (TREE_OPERAND (t, 0)))
dump_type (pp, op, flags);
else
dump_expr (pp, op, flags);
pp_cxx_right_paren (pp);
break;
case AT_ENCODE_EXPR:
pp_cxx_ws_string (pp, "@encode");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
dump_type (pp, TREE_OPERAND (t, 0), flags);
pp_cxx_right_paren (pp);
break;
case NOEXCEPT_EXPR:
pp_cxx_ws_string (pp, "noexcept");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
dump_expr (pp, TREE_OPERAND (t, 0), flags);
pp_cxx_right_paren (pp);
break;
case REALPART_EXPR:
case IMAGPART_EXPR:
pp_cxx_ws_string (pp, operator_name_info[TREE_CODE (t)].name);
pp_cxx_whitespace (pp);
dump_expr (pp, TREE_OPERAND (t, 0), flags);
break;
1997-08-20 00:37:19 +02:00
case DEFAULT_ARG:
pp_string (pp, M_("<unparsed>"));
1997-08-20 00:37:19 +02:00
break;
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case CLEANUP_POINT_EXPR:
dump_expr (pp, TREE_OPERAND (t, 0), flags);
break;
case PSEUDO_DTOR_EXPR:
dump_expr (pp, TREE_OPERAND (t, 0), flags);
pp_cxx_dot (pp);
if (TREE_OPERAND (t, 1))
{
dump_type (pp, TREE_OPERAND (t, 1), flags);
pp_cxx_colon_colon (pp);
}
pp_cxx_complement (pp);
dump_type (pp, TREE_OPERAND (t, 2), flags);
break;
case TEMPLATE_ID_EXPR:
dump_decl (pp, t, flags);
break;
case BIND_EXPR:
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
case STMT_EXPR:
case EXPR_STMT:
case STATEMENT_LIST:
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
/* We don't yet have a way of dumping statements in a
human-readable format. */
pp_string (pp, "({...})");
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
break;
case LOOP_EXPR:
pp_string (pp, "while (1) { ");
dump_expr (pp, TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
pp_cxx_right_brace (pp);
break;
case EXIT_EXPR:
pp_string (pp, "if (");
dump_expr (pp, TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
pp_string (pp, ") break; ");
break;
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
case BASELINK:
dump_expr (pp, BASELINK_FUNCTIONS (t), flags & ~TFF_EXPR_IN_PARENS);
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
break;
case EMPTY_CLASS_EXPR:
dump_type (pp, TREE_TYPE (t), flags);
pp_cxx_left_paren (pp);
pp_cxx_right_paren (pp);
break;
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
case NON_DEPENDENT_EXPR:
dump_expr (pp, TREE_OPERAND (t, 0), flags);
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
break;
1994-08-18 22:50:43 +02:00
case ARGUMENT_PACK_SELECT:
dump_template_argument (pp, ARGUMENT_PACK_SELECT_FROM_PACK (t), flags);
break;
case RECORD_TYPE:
case UNION_TYPE:
case ENUMERAL_TYPE:
case REAL_TYPE:
case VOID_TYPE:
case BOOLEAN_TYPE:
case INTEGER_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
pp_type_specifier_seq (pp, t);
break;
case TYPENAME_TYPE:
/* We get here when we want to print a dependent type as an
id-expression, without any disambiguator decoration. */
c-objc-common.c (c_tree_printer): Tidy. c/ * c-objc-common.c (c_tree_printer): Tidy. c-family/ * c-pretty-print.h (c_pretty_printer::type_id): Now a virtual member function. (c_pretty_printer::storage_class_specifier): Likewise. (c_pretty_printer::initializer): Likewise. (pp_declaration): Remove. (pp_declaration_specifiers): Likewise. (pp_abstract_declarator): Likewise. (pp_declarator): Likewise. (pp_type_id): Likewise. (pp_statement): Likewise. (pp_constant): Likewise. (pp_id_expression): Likewise. (pp_primary_expression): Likewise. (pp_unary_expression): Likewise. (pp_multiplicative_expression): Likewise. (pp_conditional_expression): Likewise. (pp_assignment_expression): Likewise. (pp_expression): Likewise. (pp_c_type_id): Likewise. (pp_c_storage_class_specifier): Likewise. * c-pretty-print.c (pp_c_type_cast): Tidy. (pp_c_pointer): Likewise. (pp_c_type_specifier): Likewise. (pp_c_parameter_type_list): Likewise. (pp_c_function_definition): Likewise. (pp_c_init_declarator): Likewise. (pp_c_initializer_list): Likewise. (pp_c_constructor_elts): Likewise. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::declaration_specifiers): Likewise. (c_pretty_printer::primary_expression): Likewise. (c_pretty_printer::postfix_expression): Likewise. (c_pretty_printer::type_id): Rename from pp_c_type_id. (c_pretty_printer::storage_class_specifier): Rename from pp_c_storage_class_specifier. (c_pretty_printer::initializer): Rename from pp_c_initializer. (c_pretty_printer::c_pretty_printer): Do not assign to type_id, storage_class_specifier, initializer, offset_list, flags. cp/ * cxx-pretty-print.h (cxx_pretty_printer::type_id): Declare as overrider. * cxx-pretty-print.c (pp_cxx_storage_class_specifier): Remove. (pp_cxx_userdef_literal): Tidy. (pp_cxx_template_argument_list): Likewise. (pp_cxx_typeid_expression): Likewise. (pp_cxx_offsetof_expression_1): Likewise. (cxx_pretty_printer::postfix_expression): Likewise. (cxx_pretty_printer::unary_expression): Likewise. (cxx_pretty_printer::statement): Likewise. (cxx_pretty_printer::type_id): Rename from pp_cxx_type_id. (c_pretty_printer::cxx_pretty_printer): Do not assign to type_id. * error.c (dump_decl): Tidy. (dump_expr): Likewise. From-SVN: r202203
2013-09-03 11:52:19 +02:00
pp->id_expression (t);
break;
case TEMPLATE_TYPE_PARM:
case TEMPLATE_TEMPLATE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
dump_type (pp, t, flags);
break;
case TRAIT_EXPR:
pp_cxx_trait_expression (pp, t);
break;
case VA_ARG_EXPR:
pp_cxx_va_arg_expression (pp, t);
break;
case OFFSETOF_EXPR:
pp_cxx_offsetof_expression (pp, t);
break;
case ADDRESSOF_EXPR:
pp_cxx_addressof_expression (pp, t);
break;
case SCOPE_REF:
dump_decl (pp, t, flags);
break;
case EXPR_PACK_EXPANSION:
Improving concepts performance and diagnostics. PR c++/67565 PR c++/67579 PR c++/71843 gcc/ * timevar.def (TV_CONSTRAINT_SAT, TV_CONSTRAINT_SUB): New time vars for constraint satisfaction and subsumption. * timevar.h (auto_timevar): New constructor that matches the push/pop pattern of usage in pt.c. gcc/cp/ * cp-tree.def (CHECK_CONSTR): New. * cp-tree.h (CHECK_CONSTR_CONCEPT): New. (CHECK_CONSTR_ARGS): New. * constraint.cc (make_predicate_constraint): Remove in favor of normalize_expression. (resolve_constraint_check): Actually return error_mark_node when resolution fails. (resolve_variable_concept_check): Perform coercion as if processing a template. Also return errors on resolution failure. (lift_*): Remove all of these functions. Don't unnecessarily inline concepts. (learn_*): Add facilities to memoize implications for subsumption during normalization. (expanding_concept): New. (expand_concept): New. Return the inlined and normalized definition of a concept when needed. (transform_*, xform_*): Rename to normalize_* to better reflect the responsibility of those functions. (normalize_template_id_expression): Check for non-boolean operands when possible. Generate check constraints instead of normal variable references. (normalize_call_expression): Report errors when resolution fails. (check_for_logical_overloads): Rewrite this check to more accurately report the error. (normalize_atom): Check for overloaded calls and invalid types before determining if the expression refers to a concept. (build_constraints): Don't cache normalized constraints or decmposed assumptions. (finish_shorthand_constraint): Return a normalized expression instead of a predicate constraint. (finish_template_introduction): Same. (placeholder_extract_concept_and_args): Rewrite this since we only ever get check constraints here. (equivalent_placeholder_constraints): Rewrite in terms of check constraints, and handle error_mark_nodes correctly. (tsubst_check_constraint, tsubst_expr_constr, tsubst_type_constr) (tsubst_implicit_conversion_constr) (tsubst_argument_deduction_constr, tsubst_exception_constr) (tsubst_parameterized_constraint, tsubst_constraint): New. (tsbust_conjunection): Replace with tsubst_logical_operator and actually generate the right kind of constraint. (tsubst_requirement_body): Reverse the order of substituted arguments so that they appear in the order written (helps diagnostics). (satisfy_check_constraint): New. (satisfy_conjunction): Simplify. (satisfy_disjunction): Same. (satisfy_constraint_1): Handle check constraints. (eval_constr): New (private) global state. (evaluating_constraints_sentinel): New. Manages eval_constr. (satisfy_constraint): Add timing variables. (satisfy_associated_constraints): Add hooks for memoization. (evaluate_function_concept): Build a check constraint instead of normalizing its definition. (evaluate_variable_concept): Same. (evaluate_constraint_expression): Normalize, but in the current declaration processing context. (evaluating_constraints_p): New. (elide_constraint_failure_p): Actually emit constraint_thresh errors. (diagnose_*): Remove artificial indentation. Add a new parameter to each that tracks the current (complete) constraint prior to any substitutions. (diagnose_expression): Removed. (diagnose_call_expression): Same. (diagnose_template_id): Same. (diagnose_template_id): New. (diagnose_logical_constraint): New. (diagnose_expression_constraint): Show the original expression. (diagnose_type_constraint): Show the original type. (diagnose_implicit_conversion_constraint): Be specific about failures, don't re-diagnose a known-to-be-failed substitutions, and manage elisions properly. (diagnose_argument_deduction_constraint): Same. (diagnose_exception_constraint): Same. (diagnose_parameterized_constraint): Same. (constraint_p): Allow EXPR_PACK_EXPANSION. * logic.cc (next_by_distance): Removed. No longer used. (any_p): Renamed from any_of. (term_entry, term_hasher): New. (term_list): Rewrite to include a hash table for quick lookup. Also, make less stateful. (proof_state): Extend to allow goals to be discharged once satisfied. (non_atomic_constraint_p): New. (any_non_atomic_constraints_p): New. (...rest...): Previous implementation completely replaced with an iterative algorithm that opportunistically prunes the search space before committing to using more memory. * parser.c: (cp_parser_type_parameter): Normalize constraints. (cp_parser_explicit_template_declaration): Same. * pt.c: (finish_template_variable): Be less redundant with this error message. (template_args_equal): No longer static. (tsubst_decl): Don't try to find specializations of variables that have already been instantiated. (build_non_dependent_expr): Avoid infinite recursion during concept expansion. (make_constrained_auto): Normalize constraints. (do_auto_deduction): When doing auto deduction from a partial-concept-id, be sure to include the explicit args checking the constraints. (constraint_sat_*): New. Memoize satisfied constraints. (concept_spec_*): New. Memoize expressions associated with a concept specialization. (constraint_memos, concept_memos): New. (lookup_constraint_satisfaction, memoize_constraint_satisfaction): New. (lookup_concept_satisfaction, memoize_concept_satisfaction): New. (get_concept_expansion, save_concept_expansion): New. (hash_subsumption_args): New. (comp_subsumption_args): New. (subsumption_*): New. Memoize parts of the subsumption relation. (lookup_subsumption_result, save_subsumption_result): New. (init_constraint_processing): Initialize memo tables. (get_constraints): Shortcut if !flag_concepts. * decl.c (grokfndecl): Normalize constraints. * error.c (dump_simple_decl): Print "concept" when appropriate. (dump_function_decl): Same. (dump_template_decl): Don't write requirements when we're not printing the header. (dump_expr): Handle fold expressions. * cxx-pretty-print.c (cxx_pretty_printer::expression): Handle fold expressions. (get_fold_operator): New. (pp_cxx_unary_left_fold_expression): New. (pp_cxx_unary_right_fold_expression): New. (pp_cxx_binary_fold_expression): New. (pp_cxx_check_constraint): New. (pp_cxx_*_constraint): Rewrite the grammar of internal constraints to make them easier to read when debugging. * search.c (accessible_p): Don't shortcut when evaluating constraints. * tree.c (cp_tree_equal): Handle CHECK_CONSTR. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r238558
2016-07-21 08:05:24 +02:00
case UNARY_LEFT_FOLD_EXPR:
case UNARY_RIGHT_FOLD_EXPR:
case BINARY_LEFT_FOLD_EXPR:
case BINARY_RIGHT_FOLD_EXPR:
case TYPEID_EXPR:
case MEMBER_REF:
case DOTSTAR_EXPR:
case NEW_EXPR:
case VEC_NEW_EXPR:
case DELETE_EXPR:
case VEC_DELETE_EXPR:
case MODOP_EXPR:
case ABS_EXPR:
case CONJ_EXPR:
case VECTOR_CST:
case FIXED_CST:
case UNORDERED_EXPR:
case ORDERED_EXPR:
case UNLT_EXPR:
case UNLE_EXPR:
case UNGT_EXPR:
case UNGE_EXPR:
case UNEQ_EXPR:
case LTGT_EXPR:
case COMPLEX_EXPR:
case BIT_FIELD_REF:
case FIX_TRUNC_EXPR:
case FLOAT_EXPR:
c-objc-common.c (c_tree_printer): Tidy. c/ * c-objc-common.c (c_tree_printer): Tidy. c-family/ * c-pretty-print.h (c_pretty_printer::type_id): Now a virtual member function. (c_pretty_printer::storage_class_specifier): Likewise. (c_pretty_printer::initializer): Likewise. (pp_declaration): Remove. (pp_declaration_specifiers): Likewise. (pp_abstract_declarator): Likewise. (pp_declarator): Likewise. (pp_type_id): Likewise. (pp_statement): Likewise. (pp_constant): Likewise. (pp_id_expression): Likewise. (pp_primary_expression): Likewise. (pp_unary_expression): Likewise. (pp_multiplicative_expression): Likewise. (pp_conditional_expression): Likewise. (pp_assignment_expression): Likewise. (pp_expression): Likewise. (pp_c_type_id): Likewise. (pp_c_storage_class_specifier): Likewise. * c-pretty-print.c (pp_c_type_cast): Tidy. (pp_c_pointer): Likewise. (pp_c_type_specifier): Likewise. (pp_c_parameter_type_list): Likewise. (pp_c_function_definition): Likewise. (pp_c_init_declarator): Likewise. (pp_c_initializer_list): Likewise. (pp_c_constructor_elts): Likewise. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::declaration_specifiers): Likewise. (c_pretty_printer::primary_expression): Likewise. (c_pretty_printer::postfix_expression): Likewise. (c_pretty_printer::type_id): Rename from pp_c_type_id. (c_pretty_printer::storage_class_specifier): Rename from pp_c_storage_class_specifier. (c_pretty_printer::initializer): Rename from pp_c_initializer. (c_pretty_printer::c_pretty_printer): Do not assign to type_id, storage_class_specifier, initializer, offset_list, flags. cp/ * cxx-pretty-print.h (cxx_pretty_printer::type_id): Declare as overrider. * cxx-pretty-print.c (pp_cxx_storage_class_specifier): Remove. (pp_cxx_userdef_literal): Tidy. (pp_cxx_template_argument_list): Likewise. (pp_cxx_typeid_expression): Likewise. (pp_cxx_offsetof_expression_1): Likewise. (cxx_pretty_printer::postfix_expression): Likewise. (cxx_pretty_printer::unary_expression): Likewise. (cxx_pretty_printer::statement): Likewise. (cxx_pretty_printer::type_id): Rename from pp_cxx_type_id. (c_pretty_printer::cxx_pretty_printer): Do not assign to type_id. * error.c (dump_decl): Tidy. (dump_expr): Likewise. From-SVN: r202203
2013-09-03 11:52:19 +02:00
pp->expression (t);
break;
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
case TRUTH_XOR_EXPR:
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_left_paren (pp);
c-objc-common.c (c_tree_printer): Tidy. c/ * c-objc-common.c (c_tree_printer): Tidy. c-family/ * c-pretty-print.h (c_pretty_printer::type_id): Now a virtual member function. (c_pretty_printer::storage_class_specifier): Likewise. (c_pretty_printer::initializer): Likewise. (pp_declaration): Remove. (pp_declaration_specifiers): Likewise. (pp_abstract_declarator): Likewise. (pp_declarator): Likewise. (pp_type_id): Likewise. (pp_statement): Likewise. (pp_constant): Likewise. (pp_id_expression): Likewise. (pp_primary_expression): Likewise. (pp_unary_expression): Likewise. (pp_multiplicative_expression): Likewise. (pp_conditional_expression): Likewise. (pp_assignment_expression): Likewise. (pp_expression): Likewise. (pp_c_type_id): Likewise. (pp_c_storage_class_specifier): Likewise. * c-pretty-print.c (pp_c_type_cast): Tidy. (pp_c_pointer): Likewise. (pp_c_type_specifier): Likewise. (pp_c_parameter_type_list): Likewise. (pp_c_function_definition): Likewise. (pp_c_init_declarator): Likewise. (pp_c_initializer_list): Likewise. (pp_c_constructor_elts): Likewise. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::declaration_specifiers): Likewise. (c_pretty_printer::primary_expression): Likewise. (c_pretty_printer::postfix_expression): Likewise. (c_pretty_printer::type_id): Rename from pp_c_type_id. (c_pretty_printer::storage_class_specifier): Rename from pp_c_storage_class_specifier. (c_pretty_printer::initializer): Rename from pp_c_initializer. (c_pretty_printer::c_pretty_printer): Do not assign to type_id, storage_class_specifier, initializer, offset_list, flags. cp/ * cxx-pretty-print.h (cxx_pretty_printer::type_id): Declare as overrider. * cxx-pretty-print.c (pp_cxx_storage_class_specifier): Remove. (pp_cxx_userdef_literal): Tidy. (pp_cxx_template_argument_list): Likewise. (pp_cxx_typeid_expression): Likewise. (pp_cxx_offsetof_expression_1): Likewise. (cxx_pretty_printer::postfix_expression): Likewise. (cxx_pretty_printer::unary_expression): Likewise. (cxx_pretty_printer::statement): Likewise. (cxx_pretty_printer::type_id): Rename from pp_cxx_type_id. (c_pretty_printer::cxx_pretty_printer): Do not assign to type_id. * error.c (dump_decl): Tidy. (dump_expr): Likewise. From-SVN: r202203
2013-09-03 11:52:19 +02:00
pp->expression (t);
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_right_paren (pp);
break;
case OBJ_TYPE_REF:
dump_expr (pp, resolve_virtual_fun_from_obj_type_ref (t), flags);
break;
case LAMBDA_EXPR:
pp_string (pp, M_("<lambda>"));
break;
case PAREN_EXPR:
pp_cxx_left_paren (pp);
dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (pp);
break;
Add C++ Concepts TS support. gcc/c-family/ * c-common.c (c_common_reswords): Add __is_same_as, concept, requires. * c-common.h (enum rid): Add RID_IS_SAME_AS, RID_CONCEPT, RID_REQUIRES. (D_CXX_CONCEPTS, D_CXX_CONCEPTS_FLAGS): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_concepts. * c-opts.c (set_std_cxx1z): Set flag_concepts. * c.opt (fconcepts): New. gcc/cp/ * constraint.cc, logic.cc: New files. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add constraint.o and logic.o. (c++.tags): Also process .cc files. * call.c (enum rejection_reason_code): Add rr_constraint_failure. (print_z_candidate): Handle it. (constraint_failure): New. (add_function_candidate): Check constraints. (build_new_function_call): Handle evaluating concepts. (joust): Check more_constrained. * class.c (add_method): Check equivalently_constrained. (build_clone): Copy constraints. (currently_open_class): Return tree. (resolve_address_of_overloaded_function): Check constraints. * constexpr.c (cxx_eval_constant_expression): Handle REQUIRES_EXPR. (potential_constant_expression_1): Likewise. * cp-objcp-common.c (cp_tree_size): Handle CONSTRAINT_INFO. (cp_common_init_ts): Handle WILDCARD_DECL and REQUIRES_EXPR. * cp-tree.def: Add CONSTRAINT_INFO, WILDCARD_DECL, REQUIRES_EXPR, SIMPLE_REQ, TYPE_REQ, COMPOUND_REQ, NESTED_REQ, PRED_CONSTR, EXPR_CONSTR, TYPE_CONSTR, ICONV_CONSTR, DEDUCT_CONSTR, EXCEPT_CONSTR, PARM_CONSTR, CONJ_CONSTR, DISJ_CONSTR. * cp-tree.h (struct tree_constraint_info, check_nonnull) (check_constraint_info, CI_TEMPLATE_REQS, CI_DECLARATOR_REQS) (CI_ASSOCIATED_CONSTRAINTS, CI_NORMALIZED_CONSTRAINTS) (CI_ASSUMPTIONS, TEMPLATE_PARMS_CONSTRAINTS) (TEMPLATE_PARM_CONSTRAINTS, COMPOUND_REQ_NOEXCEPT_P) (PLACEHOLDER_TYPE_CONSTRAINTS, PRED_CONSTR_EXPR, EXPR_CONSTR_EXPR) (TYPE_CONSTR_TYPE, ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE) (DEDUCT_CONSTR_EXPR, DEDUCT_CONSTR_PATTERN) (DEDUCT_CONSTR_PLACEHOLDER, EXCEPT_CONSTR_EXPR, PARM_CONSTR_PARMS) (PARM_CONSTR_OPERAND, CONSTRAINT_VAR_P, CONSTRAINED_PARM_CONCEPT) (CONSTRAINED_PARM_EXTRA_ARGS, CONSTRAINED_PARM_PROTOTYPE) (DECL_DECLARED_CONCEPT_P, WILDCARD_PACK_P, struct cp_unevaluated) (struct local_specialization_stack, enum auto_deduction_context) (variable_concept_p, concept_template_p) (struct deferring_access_check_sentinel): New. (enum cp_tree_node_structure_enum): Add TS_CP_CONSTRAINT_INFO. (union lang_tree_node): Add constraint_info field. (struct lang_decl_base): Add concept_p flag. (enum cp_decl_spec): Add ds_concept. (struct cp_declarator): Add requires_clause. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression) (cxx_pretty_printer::expression): Handle REQUIRES_EXPR, TRAIT_EXPR, *_CONSTR. (pp_cxx_parameter_declaration_clause): Accept a chain of PARM_DECLs. (cxx_pretty_printer::declarator): Print requires-clause. (pp_cxx_template_declaration): Likewise. (pp_cxx_trait_expression): Handle CPTK_IS_SAME_AS. (pp_cxx_requires_clause, pp_cxx_requirement) (pp_cxx_requirement_list, pp_cxx_requirement_body) (pp_cxx_requires_expr, pp_cxx_simple_requirement) (pp_cxx_type_requirement, pp_cxx_compound_requirement) (pp_cxx_nested_requirement, pp_cxx_predicate_constraint) (pp_cxx_expression_constraint, pp_cxx_type_constraint) (pp_cxx_implicit_conversion_constraint) (pp_cxx_argument_deduction_constraint) (pp_cxx_exception_constraint, pp_cxx_parameterized_constraint) (pp_cxx_conjunction, pp_cxx_disjunction, pp_cxx_constraint): New. * cxx-pretty-print.h: Declare them. * decl.c (decls_match): Compare constraints. (duplicate_decls): Likewise. Remove constraints before freeing. (cxx_init_decl_processing): Call init_constraint_processing. (cp_finish_decl): Diagnose concept without initializer. (grokfndecl, grokvardecl): Handle concepts and constraints. (grokdeclarator): Handle concept, requires-clause. (grokparms): No longer static. (xref_tag_1): Check constraints. (finish_function): Call check_function_concept. (cp_tree_node_structure): Handle CONSTRAINT_INFO. (check_concept_refinement, is_concept_var, check_concept_fn): New. * decl2.c (check_classfn): Compare constraints. (mark_used): Don't instantiate concepts. * error.c (dump_template_decl): Print constraints. (dump_function_decl): Likewise. (dump_expr): Handle REQUIRES_EXPR, *_REQ, *_CONSTR. * lex.c (init_reswords): Set D_CXX_CONCEPTS. * method.c (implicitly_declare_fn): Copy constraints from inherited ctor. * parser.h (struct cp_parser): Add in_result_type_constraint_p and prevent_constrained_type_specifiers fields. * parser.c (make_call_declarator): Add requires_clause parm. (cp_parser_new): Clear prevent_constrained_type_specifiers. (cp_parser_primary_expression): Handle RID_IS_SAME_AS, RID_REQUIRES. (cp_parser_postfix_expression): Set prevent_constrained_type_specifiers. (cp_parser_trait_expr): Handle RID_IS_SAME_AS. (cp_parser_declaration): Handle concept introduction. (cp_parser_member_declaration): Likewise. (cp_parser_template_parameter): Handle constrained parameter. (cp_parser_type_parameter): Handle constraints. (cp_parser_decl_specifier_seq): Handle RID_CONCEPT. (cp_parser_template_id): Handle partial concept id. (cp_parser_type_name): Add overload that takes typename_keyword_p. Handle constrained parameter. (cp_parser_nonclass_name): Handle concept names. (cp_parser_alias_declaration): Handle constraints. (cp_parser_late_return_type_opt): Also handle requires-clause. (cp_parser_type_id_1): Handle deduction constraint. (cp_parser_parameter_declaration): Handle constrained parameters. (cp_parser_class_specifier_1): Handle constraints. (cp_parser_template_declaration_after_parameters): Split out from cp_parser_template_declaration_after_export. (cp_parser_single_declaration): Handle constraints. (synthesize_implicit_template_parm): Handle constraints. (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_introduction_list, get_id_declarator) (get_unqualified_id, is_constrained_parameter) (cp_parser_check_constrained_type_parm) (cp_parser_constrained_type_template_parm) (cp_parser_constrained_template_template_parm) (constrained_non_type_template_parm, finish_constrained_parameter) (declares_constrained_type_template_parameter) (declares_constrained_template_template_parameter) (check_type_concept, cp_parser_maybe_constrained_type_specifier) (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_requires_clause, cp_parser_requires_clause_opt) (cp_parser_requires_expression) (cp_parser_requirement_parameter_list, cp_parser_requirement_body) (cp_parser_requirement_list, cp_parser_requirement) (cp_parser_simple_requirement, cp_parser_type_requirement) (cp_parser_compound_requirement, cp_parser_nested_requirement) (cp_parser_template_introduction) (cp_parser_explicit_template_declaration) (get_concept_from_constraint): New. * pt.c (local_specialization_stack): Implement. (maybe_new_partial_specialization): New. (maybe_process_partial_specialization): Use it. (retrieve_local_specialization, register_local_specialization) (template_parm_to_arg, build_template_decl, extract_fnparm_pack) (tsubst_expr): No longer static. (spec_hasher::equal): Compare constraints. (determine_specialization): Handle constraints. (check_explicit_specialization): Handle concepts. (process_template_parm): Handle constraints. (end_template_parm_list): Add overload taking no arguments. (process_partial_specialization): Handle concepts and constraints. Register partial specializations of variable templates. (redeclare_class_template): Handle constraints. (convert_template_argument): Handle WILDCARD_DECL. Check is_compatible_template_arg. (coerce_template_parameter_pack): Handle wildcard packs. (coerce_template_parms): DR 1430 also applies to concepts. Add overloads taking fewer parameters. (lookup_template_class_1): Handle constraints. (lookup_template_variable): Concepts are always bool. (finish_template_variable): Handle concepts and constraints. (tsubst_friend_class): Handle constraints. (gen_elem_of_pack_expansion_instantiation): Handle constraints. (tsubst_pack_expansion): Handle local parameters. (tsubst_decl) [FUNCTION_DECL]: Handle constraints. (tsubst) [TEMPLATE_TYPE_PARM]: Handle deduction constraints. (tsubst_copy_and_build): Handle REQUIRES_EXPR. (more_specialized_fn, more_specialized_partial_spec): Check constraints. (more_specialized_inst): Split out from most_specialized_instantiation. (most_specialized_partial_spec): Check constraints. (instantiate_decl): Never instantiate a concept. (value_dependent_expression_p): Handle REQUIRES_EXPR, TYPE_REQ, variable concepts. (type_dependent_expression_p): Handle WILDCARD_DECL, REQUIRES_EXPR. (instantiation_dependent_r): Handle REQUIRES_EXPR and concepts. (do_auto_deduction): Add overload taking tsubst flags and context enum. Handle constraints. (get_template_for_ordering, most_constrained_function) (is_compatible_template_arg, convert_wildcard_argument) (struct constr_entry, struct constr_hasher, decl_constraints) (valid_constraints_p, get_constraints, set_constraints) (remove_constraints, init_constraint_processing): New. * ptree.c (cxx_print_xnode): Handle CONSTRAINT_INFO. * search.c (lookup_member): Do lookup in the open partial instantiation. * semantics.c (finish_template_template_parm): Handle constraints. (fixup_template_type): New. (finish_template_type): Call it. (trait_expr_value, finish_trait_expr): Handle CPTK_IS_SAME_AS. * tree.c (cp_tree_equal): Handle local parameters, CONSTRAINT_INFO. (cp_walk_subtrees): Handle REQUIRES_EXPR. * typeck.c (cp_build_function_call_vec): Check constraints. Co-Authored-By: Braden Obrzut <admin@maniacsvault.net> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r226713
2015-08-07 07:44:49 +02:00
case REQUIRES_EXPR:
pp_cxx_requires_expr (cxx_pp, t);
break;
case SIMPLE_REQ:
pp_cxx_simple_requirement (cxx_pp, t);
break;
case TYPE_REQ:
pp_cxx_type_requirement (cxx_pp, t);
break;
case COMPOUND_REQ:
pp_cxx_compound_requirement (cxx_pp, t);
break;
case NESTED_REQ:
pp_cxx_nested_requirement (cxx_pp, t);
break;
case PRED_CONSTR:
Improving concepts performance and diagnostics. PR c++/67565 PR c++/67579 PR c++/71843 gcc/ * timevar.def (TV_CONSTRAINT_SAT, TV_CONSTRAINT_SUB): New time vars for constraint satisfaction and subsumption. * timevar.h (auto_timevar): New constructor that matches the push/pop pattern of usage in pt.c. gcc/cp/ * cp-tree.def (CHECK_CONSTR): New. * cp-tree.h (CHECK_CONSTR_CONCEPT): New. (CHECK_CONSTR_ARGS): New. * constraint.cc (make_predicate_constraint): Remove in favor of normalize_expression. (resolve_constraint_check): Actually return error_mark_node when resolution fails. (resolve_variable_concept_check): Perform coercion as if processing a template. Also return errors on resolution failure. (lift_*): Remove all of these functions. Don't unnecessarily inline concepts. (learn_*): Add facilities to memoize implications for subsumption during normalization. (expanding_concept): New. (expand_concept): New. Return the inlined and normalized definition of a concept when needed. (transform_*, xform_*): Rename to normalize_* to better reflect the responsibility of those functions. (normalize_template_id_expression): Check for non-boolean operands when possible. Generate check constraints instead of normal variable references. (normalize_call_expression): Report errors when resolution fails. (check_for_logical_overloads): Rewrite this check to more accurately report the error. (normalize_atom): Check for overloaded calls and invalid types before determining if the expression refers to a concept. (build_constraints): Don't cache normalized constraints or decmposed assumptions. (finish_shorthand_constraint): Return a normalized expression instead of a predicate constraint. (finish_template_introduction): Same. (placeholder_extract_concept_and_args): Rewrite this since we only ever get check constraints here. (equivalent_placeholder_constraints): Rewrite in terms of check constraints, and handle error_mark_nodes correctly. (tsubst_check_constraint, tsubst_expr_constr, tsubst_type_constr) (tsubst_implicit_conversion_constr) (tsubst_argument_deduction_constr, tsubst_exception_constr) (tsubst_parameterized_constraint, tsubst_constraint): New. (tsbust_conjunection): Replace with tsubst_logical_operator and actually generate the right kind of constraint. (tsubst_requirement_body): Reverse the order of substituted arguments so that they appear in the order written (helps diagnostics). (satisfy_check_constraint): New. (satisfy_conjunction): Simplify. (satisfy_disjunction): Same. (satisfy_constraint_1): Handle check constraints. (eval_constr): New (private) global state. (evaluating_constraints_sentinel): New. Manages eval_constr. (satisfy_constraint): Add timing variables. (satisfy_associated_constraints): Add hooks for memoization. (evaluate_function_concept): Build a check constraint instead of normalizing its definition. (evaluate_variable_concept): Same. (evaluate_constraint_expression): Normalize, but in the current declaration processing context. (evaluating_constraints_p): New. (elide_constraint_failure_p): Actually emit constraint_thresh errors. (diagnose_*): Remove artificial indentation. Add a new parameter to each that tracks the current (complete) constraint prior to any substitutions. (diagnose_expression): Removed. (diagnose_call_expression): Same. (diagnose_template_id): Same. (diagnose_template_id): New. (diagnose_logical_constraint): New. (diagnose_expression_constraint): Show the original expression. (diagnose_type_constraint): Show the original type. (diagnose_implicit_conversion_constraint): Be specific about failures, don't re-diagnose a known-to-be-failed substitutions, and manage elisions properly. (diagnose_argument_deduction_constraint): Same. (diagnose_exception_constraint): Same. (diagnose_parameterized_constraint): Same. (constraint_p): Allow EXPR_PACK_EXPANSION. * logic.cc (next_by_distance): Removed. No longer used. (any_p): Renamed from any_of. (term_entry, term_hasher): New. (term_list): Rewrite to include a hash table for quick lookup. Also, make less stateful. (proof_state): Extend to allow goals to be discharged once satisfied. (non_atomic_constraint_p): New. (any_non_atomic_constraints_p): New. (...rest...): Previous implementation completely replaced with an iterative algorithm that opportunistically prunes the search space before committing to using more memory. * parser.c: (cp_parser_type_parameter): Normalize constraints. (cp_parser_explicit_template_declaration): Same. * pt.c: (finish_template_variable): Be less redundant with this error message. (template_args_equal): No longer static. (tsubst_decl): Don't try to find specializations of variables that have already been instantiated. (build_non_dependent_expr): Avoid infinite recursion during concept expansion. (make_constrained_auto): Normalize constraints. (do_auto_deduction): When doing auto deduction from a partial-concept-id, be sure to include the explicit args checking the constraints. (constraint_sat_*): New. Memoize satisfied constraints. (concept_spec_*): New. Memoize expressions associated with a concept specialization. (constraint_memos, concept_memos): New. (lookup_constraint_satisfaction, memoize_constraint_satisfaction): New. (lookup_concept_satisfaction, memoize_concept_satisfaction): New. (get_concept_expansion, save_concept_expansion): New. (hash_subsumption_args): New. (comp_subsumption_args): New. (subsumption_*): New. Memoize parts of the subsumption relation. (lookup_subsumption_result, save_subsumption_result): New. (init_constraint_processing): Initialize memo tables. (get_constraints): Shortcut if !flag_concepts. * decl.c (grokfndecl): Normalize constraints. * error.c (dump_simple_decl): Print "concept" when appropriate. (dump_function_decl): Same. (dump_template_decl): Don't write requirements when we're not printing the header. (dump_expr): Handle fold expressions. * cxx-pretty-print.c (cxx_pretty_printer::expression): Handle fold expressions. (get_fold_operator): New. (pp_cxx_unary_left_fold_expression): New. (pp_cxx_unary_right_fold_expression): New. (pp_cxx_binary_fold_expression): New. (pp_cxx_check_constraint): New. (pp_cxx_*_constraint): Rewrite the grammar of internal constraints to make them easier to read when debugging. * search.c (accessible_p): Don't shortcut when evaluating constraints. * tree.c (cp_tree_equal): Handle CHECK_CONSTR. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r238558
2016-07-21 08:05:24 +02:00
case CHECK_CONSTR:
Add C++ Concepts TS support. gcc/c-family/ * c-common.c (c_common_reswords): Add __is_same_as, concept, requires. * c-common.h (enum rid): Add RID_IS_SAME_AS, RID_CONCEPT, RID_REQUIRES. (D_CXX_CONCEPTS, D_CXX_CONCEPTS_FLAGS): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_concepts. * c-opts.c (set_std_cxx1z): Set flag_concepts. * c.opt (fconcepts): New. gcc/cp/ * constraint.cc, logic.cc: New files. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add constraint.o and logic.o. (c++.tags): Also process .cc files. * call.c (enum rejection_reason_code): Add rr_constraint_failure. (print_z_candidate): Handle it. (constraint_failure): New. (add_function_candidate): Check constraints. (build_new_function_call): Handle evaluating concepts. (joust): Check more_constrained. * class.c (add_method): Check equivalently_constrained. (build_clone): Copy constraints. (currently_open_class): Return tree. (resolve_address_of_overloaded_function): Check constraints. * constexpr.c (cxx_eval_constant_expression): Handle REQUIRES_EXPR. (potential_constant_expression_1): Likewise. * cp-objcp-common.c (cp_tree_size): Handle CONSTRAINT_INFO. (cp_common_init_ts): Handle WILDCARD_DECL and REQUIRES_EXPR. * cp-tree.def: Add CONSTRAINT_INFO, WILDCARD_DECL, REQUIRES_EXPR, SIMPLE_REQ, TYPE_REQ, COMPOUND_REQ, NESTED_REQ, PRED_CONSTR, EXPR_CONSTR, TYPE_CONSTR, ICONV_CONSTR, DEDUCT_CONSTR, EXCEPT_CONSTR, PARM_CONSTR, CONJ_CONSTR, DISJ_CONSTR. * cp-tree.h (struct tree_constraint_info, check_nonnull) (check_constraint_info, CI_TEMPLATE_REQS, CI_DECLARATOR_REQS) (CI_ASSOCIATED_CONSTRAINTS, CI_NORMALIZED_CONSTRAINTS) (CI_ASSUMPTIONS, TEMPLATE_PARMS_CONSTRAINTS) (TEMPLATE_PARM_CONSTRAINTS, COMPOUND_REQ_NOEXCEPT_P) (PLACEHOLDER_TYPE_CONSTRAINTS, PRED_CONSTR_EXPR, EXPR_CONSTR_EXPR) (TYPE_CONSTR_TYPE, ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE) (DEDUCT_CONSTR_EXPR, DEDUCT_CONSTR_PATTERN) (DEDUCT_CONSTR_PLACEHOLDER, EXCEPT_CONSTR_EXPR, PARM_CONSTR_PARMS) (PARM_CONSTR_OPERAND, CONSTRAINT_VAR_P, CONSTRAINED_PARM_CONCEPT) (CONSTRAINED_PARM_EXTRA_ARGS, CONSTRAINED_PARM_PROTOTYPE) (DECL_DECLARED_CONCEPT_P, WILDCARD_PACK_P, struct cp_unevaluated) (struct local_specialization_stack, enum auto_deduction_context) (variable_concept_p, concept_template_p) (struct deferring_access_check_sentinel): New. (enum cp_tree_node_structure_enum): Add TS_CP_CONSTRAINT_INFO. (union lang_tree_node): Add constraint_info field. (struct lang_decl_base): Add concept_p flag. (enum cp_decl_spec): Add ds_concept. (struct cp_declarator): Add requires_clause. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression) (cxx_pretty_printer::expression): Handle REQUIRES_EXPR, TRAIT_EXPR, *_CONSTR. (pp_cxx_parameter_declaration_clause): Accept a chain of PARM_DECLs. (cxx_pretty_printer::declarator): Print requires-clause. (pp_cxx_template_declaration): Likewise. (pp_cxx_trait_expression): Handle CPTK_IS_SAME_AS. (pp_cxx_requires_clause, pp_cxx_requirement) (pp_cxx_requirement_list, pp_cxx_requirement_body) (pp_cxx_requires_expr, pp_cxx_simple_requirement) (pp_cxx_type_requirement, pp_cxx_compound_requirement) (pp_cxx_nested_requirement, pp_cxx_predicate_constraint) (pp_cxx_expression_constraint, pp_cxx_type_constraint) (pp_cxx_implicit_conversion_constraint) (pp_cxx_argument_deduction_constraint) (pp_cxx_exception_constraint, pp_cxx_parameterized_constraint) (pp_cxx_conjunction, pp_cxx_disjunction, pp_cxx_constraint): New. * cxx-pretty-print.h: Declare them. * decl.c (decls_match): Compare constraints. (duplicate_decls): Likewise. Remove constraints before freeing. (cxx_init_decl_processing): Call init_constraint_processing. (cp_finish_decl): Diagnose concept without initializer. (grokfndecl, grokvardecl): Handle concepts and constraints. (grokdeclarator): Handle concept, requires-clause. (grokparms): No longer static. (xref_tag_1): Check constraints. (finish_function): Call check_function_concept. (cp_tree_node_structure): Handle CONSTRAINT_INFO. (check_concept_refinement, is_concept_var, check_concept_fn): New. * decl2.c (check_classfn): Compare constraints. (mark_used): Don't instantiate concepts. * error.c (dump_template_decl): Print constraints. (dump_function_decl): Likewise. (dump_expr): Handle REQUIRES_EXPR, *_REQ, *_CONSTR. * lex.c (init_reswords): Set D_CXX_CONCEPTS. * method.c (implicitly_declare_fn): Copy constraints from inherited ctor. * parser.h (struct cp_parser): Add in_result_type_constraint_p and prevent_constrained_type_specifiers fields. * parser.c (make_call_declarator): Add requires_clause parm. (cp_parser_new): Clear prevent_constrained_type_specifiers. (cp_parser_primary_expression): Handle RID_IS_SAME_AS, RID_REQUIRES. (cp_parser_postfix_expression): Set prevent_constrained_type_specifiers. (cp_parser_trait_expr): Handle RID_IS_SAME_AS. (cp_parser_declaration): Handle concept introduction. (cp_parser_member_declaration): Likewise. (cp_parser_template_parameter): Handle constrained parameter. (cp_parser_type_parameter): Handle constraints. (cp_parser_decl_specifier_seq): Handle RID_CONCEPT. (cp_parser_template_id): Handle partial concept id. (cp_parser_type_name): Add overload that takes typename_keyword_p. Handle constrained parameter. (cp_parser_nonclass_name): Handle concept names. (cp_parser_alias_declaration): Handle constraints. (cp_parser_late_return_type_opt): Also handle requires-clause. (cp_parser_type_id_1): Handle deduction constraint. (cp_parser_parameter_declaration): Handle constrained parameters. (cp_parser_class_specifier_1): Handle constraints. (cp_parser_template_declaration_after_parameters): Split out from cp_parser_template_declaration_after_export. (cp_parser_single_declaration): Handle constraints. (synthesize_implicit_template_parm): Handle constraints. (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_introduction_list, get_id_declarator) (get_unqualified_id, is_constrained_parameter) (cp_parser_check_constrained_type_parm) (cp_parser_constrained_type_template_parm) (cp_parser_constrained_template_template_parm) (constrained_non_type_template_parm, finish_constrained_parameter) (declares_constrained_type_template_parameter) (declares_constrained_template_template_parameter) (check_type_concept, cp_parser_maybe_constrained_type_specifier) (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_requires_clause, cp_parser_requires_clause_opt) (cp_parser_requires_expression) (cp_parser_requirement_parameter_list, cp_parser_requirement_body) (cp_parser_requirement_list, cp_parser_requirement) (cp_parser_simple_requirement, cp_parser_type_requirement) (cp_parser_compound_requirement, cp_parser_nested_requirement) (cp_parser_template_introduction) (cp_parser_explicit_template_declaration) (get_concept_from_constraint): New. * pt.c (local_specialization_stack): Implement. (maybe_new_partial_specialization): New. (maybe_process_partial_specialization): Use it. (retrieve_local_specialization, register_local_specialization) (template_parm_to_arg, build_template_decl, extract_fnparm_pack) (tsubst_expr): No longer static. (spec_hasher::equal): Compare constraints. (determine_specialization): Handle constraints. (check_explicit_specialization): Handle concepts. (process_template_parm): Handle constraints. (end_template_parm_list): Add overload taking no arguments. (process_partial_specialization): Handle concepts and constraints. Register partial specializations of variable templates. (redeclare_class_template): Handle constraints. (convert_template_argument): Handle WILDCARD_DECL. Check is_compatible_template_arg. (coerce_template_parameter_pack): Handle wildcard packs. (coerce_template_parms): DR 1430 also applies to concepts. Add overloads taking fewer parameters. (lookup_template_class_1): Handle constraints. (lookup_template_variable): Concepts are always bool. (finish_template_variable): Handle concepts and constraints. (tsubst_friend_class): Handle constraints. (gen_elem_of_pack_expansion_instantiation): Handle constraints. (tsubst_pack_expansion): Handle local parameters. (tsubst_decl) [FUNCTION_DECL]: Handle constraints. (tsubst) [TEMPLATE_TYPE_PARM]: Handle deduction constraints. (tsubst_copy_and_build): Handle REQUIRES_EXPR. (more_specialized_fn, more_specialized_partial_spec): Check constraints. (more_specialized_inst): Split out from most_specialized_instantiation. (most_specialized_partial_spec): Check constraints. (instantiate_decl): Never instantiate a concept. (value_dependent_expression_p): Handle REQUIRES_EXPR, TYPE_REQ, variable concepts. (type_dependent_expression_p): Handle WILDCARD_DECL, REQUIRES_EXPR. (instantiation_dependent_r): Handle REQUIRES_EXPR and concepts. (do_auto_deduction): Add overload taking tsubst flags and context enum. Handle constraints. (get_template_for_ordering, most_constrained_function) (is_compatible_template_arg, convert_wildcard_argument) (struct constr_entry, struct constr_hasher, decl_constraints) (valid_constraints_p, get_constraints, set_constraints) (remove_constraints, init_constraint_processing): New. * ptree.c (cxx_print_xnode): Handle CONSTRAINT_INFO. * search.c (lookup_member): Do lookup in the open partial instantiation. * semantics.c (finish_template_template_parm): Handle constraints. (fixup_template_type): New. (finish_template_type): Call it. (trait_expr_value, finish_trait_expr): Handle CPTK_IS_SAME_AS. * tree.c (cp_tree_equal): Handle local parameters, CONSTRAINT_INFO. (cp_walk_subtrees): Handle REQUIRES_EXPR. * typeck.c (cp_build_function_call_vec): Check constraints. Co-Authored-By: Braden Obrzut <admin@maniacsvault.net> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r226713
2015-08-07 07:44:49 +02:00
case EXPR_CONSTR:
case TYPE_CONSTR:
case ICONV_CONSTR:
case DEDUCT_CONSTR:
case EXCEPT_CONSTR:
case PARM_CONSTR:
case CONJ_CONSTR:
case DISJ_CONSTR:
pp_cxx_constraint (cxx_pp, t);
break;
case PLACEHOLDER_EXPR:
pp_string (pp, M_("*this"));
break;
case TREE_LIST:
dump_expr_list (pp, t, flags);
break;
1994-02-24 02:02:37 +01:00
/* This list is incomplete, but should suffice for now.
It is very important that `sorry' does not call
`report_error_function'. That could cause an infinite loop. */
default:
pp_unsupported_tree (pp, t);
/* Fall through. */
1994-02-24 02:02:37 +01:00
case ERROR_MARK:
pp_string (pp, M_("<expression error>"));
1994-02-24 02:02:37 +01:00
break;
}
}
static void
dump_binary_op (cxx_pretty_printer *pp, const char *opstring, tree t,
int flags)
1994-02-24 02:02:37 +01:00
{
pp_cxx_left_paren (pp);
dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_cxx_whitespace (pp);
if (opstring)
pp_cxx_ws_string (pp, opstring);
else
pp_string (pp, M_("<unknown operator>"));
pp_cxx_whitespace (pp);
dump_expr (pp, TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (pp);
1994-02-24 02:02:37 +01:00
}
static void
dump_unary_op (cxx_pretty_printer *pp, const char *opstring, tree t, int flags)
1994-02-24 02:02:37 +01:00
{
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_left_paren (pp);
pp_cxx_ws_string (pp, opstring);
dump_expr (pp, TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_right_paren (pp);
1994-02-24 02:02:37 +01:00
}
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
static void
reinit_cxx_pp (void)
{
pp_clear_output_area (cxx_pp);
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
cxx_pp->padding = pp_none;
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
pp_indentation (cxx_pp) = 0;
pp_needs_newline (cxx_pp) = false;
cxx_pp->enclosing_scope = current_function_decl;
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
}
/* Same as pp_formatted_text, except the return string is a separate
copy and has a GGC storage duration, e.g. an indefinite lifetime. */
inline const char *
pp_ggc_formatted_text (pretty_printer *pp)
{
return ggc_strdup (pp_formatted_text (pp));
}
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
/* Exported interface to stringifying types, exprs and decls under TFF_*
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
control. */
const char *
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
type_as_string (tree typ, int flags)
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
{
reinit_cxx_pp ();
pp_translate_identifiers (cxx_pp) = false;
dump_type (cxx_pp, typ, flags);
return pp_ggc_formatted_text (cxx_pp);
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
}
const char *
type_as_string_translate (tree typ, int flags)
1994-02-24 02:02:37 +01:00
{
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
dump_type (cxx_pp, typ, flags);
return pp_ggc_formatted_text (cxx_pp);
1994-02-24 02:02:37 +01:00
}
const char *
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
expr_as_string (tree decl, int flags)
1994-02-24 02:02:37 +01:00
{
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
pp_translate_identifiers (cxx_pp) = false;
dump_expr (cxx_pp, decl, flags);
return pp_ggc_formatted_text (cxx_pp);
1994-02-24 02:02:37 +01:00
}
/* Wrap decl_as_string with options appropriate for dwarf. */
const char *
decl_as_dwarf_string (tree decl, int flags)
{
const char *name;
/* Curiously, reinit_cxx_pp doesn't reset the flags field, so setting the flag
cgraph.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * cgraph.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * target.def: Likewise. * sel-sched.c: Likewise. * config/mips/mips.c: Likewise. * config/arc/arc.md: Likewise. * config/arm/cortex-a57.md: Likewise. * config/arm/arm.c: Likewise. * config/arm/neon.md: Likewise. * config/arm/arm-c.c: Likewise. * config/vms/vms-c.c: Likewise. * config/s390/s390.c: Likewise. * config/i386/znver1.md: Likewise. * config/i386/i386.c: Likewise. * config/ia64/hpux-unix2003.h: Likewise. * config/msp430/msp430.md: Likewise. * config/rx/rx.c: Likewise. * config/rx/rx.md: Likewise. * config/aarch64/aarch64-simd.md: Likewise. * config/aarch64/aarch64.c: Likewise. * config/nvptx/nvptx.c: Likewise. * config/bfin/bfin.c: Likewise. * config/cris/cris.opt: Likewise. * config/rs6000/rs6000.c: Likewise. * target.h: Likewise. * spellcheck.c: Likewise. * ira-build.c: Likewise. * tree-inline.c: Likewise. * builtins.c: Likewise. * lra-constraints.c: Likewise. * explow.c: Likewise. * hwint.h: Likewise. * targhooks.c: Likewise. * tree-vect-data-refs.c: Likewise. * expr.c: Likewise. * doc/tm.texi: Likewise. * doc/extend.texi: Likewise. * doc/install.texi: Likewise. * doc/md.texi: Likewise. * tree-ssa-tail-merge.c: Likewise. * sched-int.h: Likewise. * match.pd: Likewise. * sched-ebb.c: Likewise. * target.def (omit_struct_return_reg): Likewise. * gimple-ssa-isolate-paths.c: Likewise. (find_implicit_erroneous_behaviour): Renamed to... (find_implicit_erroneous_behavior): ... this. (find_explicit_erroneous_behaviour): Renamed to... (find_explicit_erroneous_behavior): ... this. (gimple_ssa_isolate_erroneous_paths): Adjust caller. gcc/cp/ * error.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * decl.c: Likewise. * typeck.c (cp_build_binary_op): Fix up behavior spelling in diagnostics. * init.c (build_delete): Likewise. gcc/objc/ * objc-act.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * objc-map.h: Likewise. gcc/go/ * gofrontend/lex.cc: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * gccgo.texi: Likewise. gcc/ada/ * prj-tree.ads: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * prep.adb: Likewise. * prj.ads: Likewise. * prepcomp.adb: Likewise. * g-socket.ads: Likewise. * s-imgrea.adb: Likewise. * a-calend.adb: Likewise. * exp_disp.adb: Likewise. * doc/gnat_ugn/gnat_utility_programs.rst: Likewise. * g-socket.adb: Likewise. * sem_ch12.adb: Likewise. * terminals.c: Likewise. gcc/testsuite/ * objc.dg/gnu-api-2-method.m: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * objc.dg/attributes/method-nonnull-1.m: Likewise. * objc.dg/gnu-api-2-class-meta.m: Likewise. * c-c++-common/Wvarargs.c: Likewise. * c-c++-common/goacc/host_data-5.c: Likewise. * obj-c++.dg/gnu-api-2-class-meta.mm: Likewise. * obj-c++.dg/attributes/method-nonnull-1.mm: Likewise. * obj-c++.dg/gnu-api-2-method.mm: Likewise. * gcc.target/aarch64/pr60697.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vldX_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vshuffle.inc: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vrshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vldX_dup.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vldX.c: Likewise. * gcc.target/aarch64/aapcs64/ice_2.c: Likewise. * gcc.target/aarch64/aapcs64/test_23.c: Likewise. * gcc.target/aarch64/vrnd_f64_1.c: Likewise. * g++.dg/warn/Wconversion-real-integer-3.C: Likewise. * g++.dg/lookup/koenig5.C: Likewise. * g++.dg/ext/no-asm-2.C: Likewise. * gfortran.dg/bounds_check_array_ctor_3.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_7.f90: Likewise. * gfortran.dg/used_types_16.f90: Likewise. * gfortran.dg/assumed_rank_bounds_1.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_1.f90: Likewise. * gfortran.dg/assumed_rank_bounds_2.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_4.f90: Likewise. * gfortran.dg/abstract_type_6.f03: Likewise. * gfortran.dg/bounds_check_array_ctor_5.f90: Likewise. * gfortran.dg/used_types_15.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_8.f90: Likewise. * gfortran.dg/exit_3.f08: Likewise. * gfortran.dg/open_status_2.f90: Likewise. * gfortran.dg/derived_pointer_recursion_2.f90: Likewise. * gfortran.dg/intrinsic_std_1.f90: Likewise. * gfortran.dg/associate_1.f03: Likewise. * gfortran.dg/bounds_check_array_ctor_2.f90: Likewise. * gfortran.dg/intrinsic_std_6.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_6.f90: Likewise. * gcc.dg/builtin-object-size-1.c: Likewise. * gcc.dg/noreturn-6.c: Likewise. * gcc.dg/builtin-stringop-chk-1.c: Likewise. * gcc.dg/globalalias.c: Likewise. * gcc.dg/builtins-config.h: Likewise. * gcc.dg/pr30457.c: Likewise. * gcc.c-torture/compile/volatile-1.c: Likewise. * gcc.c-torture/execute/20101011-1.c: Likewise. * c-c++-common/Waddress-1.c: Likewise. From-SVN: r233358
2016-02-12 00:53:54 +01:00
here will be adequate to get the desired behavior. */
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
cxx_pp->flags |= pp_c_flag_gnu_v3;
name = decl_as_string (decl, flags);
/* Subsequent calls to the pretty printer shouldn't use this style. */
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
cxx_pp->flags &= ~pp_c_flag_gnu_v3;
return name;
}
const char *
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
decl_as_string (tree decl, int flags)
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
{
reinit_cxx_pp ();
pp_translate_identifiers (cxx_pp) = false;
dump_decl (cxx_pp, decl, flags);
return pp_ggc_formatted_text (cxx_pp);
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
}
const char *
decl_as_string_translate (tree decl, int flags)
1994-02-24 02:02:37 +01:00
{
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
dump_decl (cxx_pp, decl, flags);
return pp_ggc_formatted_text (cxx_pp);
1994-02-24 02:02:37 +01:00
}
/* Wrap lang_decl_name with options appropriate for dwarf. */
const char *
lang_decl_dwarf_name (tree decl, int v, bool translate)
{
const char *name;
/* Curiously, reinit_cxx_pp doesn't reset the flags field, so setting the flag
cgraph.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * cgraph.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * target.def: Likewise. * sel-sched.c: Likewise. * config/mips/mips.c: Likewise. * config/arc/arc.md: Likewise. * config/arm/cortex-a57.md: Likewise. * config/arm/arm.c: Likewise. * config/arm/neon.md: Likewise. * config/arm/arm-c.c: Likewise. * config/vms/vms-c.c: Likewise. * config/s390/s390.c: Likewise. * config/i386/znver1.md: Likewise. * config/i386/i386.c: Likewise. * config/ia64/hpux-unix2003.h: Likewise. * config/msp430/msp430.md: Likewise. * config/rx/rx.c: Likewise. * config/rx/rx.md: Likewise. * config/aarch64/aarch64-simd.md: Likewise. * config/aarch64/aarch64.c: Likewise. * config/nvptx/nvptx.c: Likewise. * config/bfin/bfin.c: Likewise. * config/cris/cris.opt: Likewise. * config/rs6000/rs6000.c: Likewise. * target.h: Likewise. * spellcheck.c: Likewise. * ira-build.c: Likewise. * tree-inline.c: Likewise. * builtins.c: Likewise. * lra-constraints.c: Likewise. * explow.c: Likewise. * hwint.h: Likewise. * targhooks.c: Likewise. * tree-vect-data-refs.c: Likewise. * expr.c: Likewise. * doc/tm.texi: Likewise. * doc/extend.texi: Likewise. * doc/install.texi: Likewise. * doc/md.texi: Likewise. * tree-ssa-tail-merge.c: Likewise. * sched-int.h: Likewise. * match.pd: Likewise. * sched-ebb.c: Likewise. * target.def (omit_struct_return_reg): Likewise. * gimple-ssa-isolate-paths.c: Likewise. (find_implicit_erroneous_behaviour): Renamed to... (find_implicit_erroneous_behavior): ... this. (find_explicit_erroneous_behaviour): Renamed to... (find_explicit_erroneous_behavior): ... this. (gimple_ssa_isolate_erroneous_paths): Adjust caller. gcc/cp/ * error.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * decl.c: Likewise. * typeck.c (cp_build_binary_op): Fix up behavior spelling in diagnostics. * init.c (build_delete): Likewise. gcc/objc/ * objc-act.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * objc-map.h: Likewise. gcc/go/ * gofrontend/lex.cc: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * gccgo.texi: Likewise. gcc/ada/ * prj-tree.ads: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * prep.adb: Likewise. * prj.ads: Likewise. * prepcomp.adb: Likewise. * g-socket.ads: Likewise. * s-imgrea.adb: Likewise. * a-calend.adb: Likewise. * exp_disp.adb: Likewise. * doc/gnat_ugn/gnat_utility_programs.rst: Likewise. * g-socket.adb: Likewise. * sem_ch12.adb: Likewise. * terminals.c: Likewise. gcc/testsuite/ * objc.dg/gnu-api-2-method.m: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * objc.dg/attributes/method-nonnull-1.m: Likewise. * objc.dg/gnu-api-2-class-meta.m: Likewise. * c-c++-common/Wvarargs.c: Likewise. * c-c++-common/goacc/host_data-5.c: Likewise. * obj-c++.dg/gnu-api-2-class-meta.mm: Likewise. * obj-c++.dg/attributes/method-nonnull-1.mm: Likewise. * obj-c++.dg/gnu-api-2-method.mm: Likewise. * gcc.target/aarch64/pr60697.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vldX_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vshuffle.inc: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vrshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vldX_dup.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vldX.c: Likewise. * gcc.target/aarch64/aapcs64/ice_2.c: Likewise. * gcc.target/aarch64/aapcs64/test_23.c: Likewise. * gcc.target/aarch64/vrnd_f64_1.c: Likewise. * g++.dg/warn/Wconversion-real-integer-3.C: Likewise. * g++.dg/lookup/koenig5.C: Likewise. * g++.dg/ext/no-asm-2.C: Likewise. * gfortran.dg/bounds_check_array_ctor_3.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_7.f90: Likewise. * gfortran.dg/used_types_16.f90: Likewise. * gfortran.dg/assumed_rank_bounds_1.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_1.f90: Likewise. * gfortran.dg/assumed_rank_bounds_2.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_4.f90: Likewise. * gfortran.dg/abstract_type_6.f03: Likewise. * gfortran.dg/bounds_check_array_ctor_5.f90: Likewise. * gfortran.dg/used_types_15.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_8.f90: Likewise. * gfortran.dg/exit_3.f08: Likewise. * gfortran.dg/open_status_2.f90: Likewise. * gfortran.dg/derived_pointer_recursion_2.f90: Likewise. * gfortran.dg/intrinsic_std_1.f90: Likewise. * gfortran.dg/associate_1.f03: Likewise. * gfortran.dg/bounds_check_array_ctor_2.f90: Likewise. * gfortran.dg/intrinsic_std_6.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_6.f90: Likewise. * gcc.dg/builtin-object-size-1.c: Likewise. * gcc.dg/noreturn-6.c: Likewise. * gcc.dg/builtin-stringop-chk-1.c: Likewise. * gcc.dg/globalalias.c: Likewise. * gcc.dg/builtins-config.h: Likewise. * gcc.dg/pr30457.c: Likewise. * gcc.c-torture/compile/volatile-1.c: Likewise. * gcc.c-torture/execute/20101011-1.c: Likewise. * c-c++-common/Waddress-1.c: Likewise. From-SVN: r233358
2016-02-12 00:53:54 +01:00
here will be adequate to get the desired behavior. */
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
cxx_pp->flags |= pp_c_flag_gnu_v3;
name = lang_decl_name (decl, v, translate);
/* Subsequent calls to the pretty printer shouldn't use this style. */
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
cxx_pp->flags &= ~pp_c_flag_gnu_v3;
return name;
}
Makefile.in: Update. * Makefile.in: Update. * c-common.c: Include langhooks.h. (inline_forbidden_p): Use new hook. * diagnostic.c: Include langhooks.h. (format_with_decl, announce_function, default_print_error_function): Use new hook. * dwarf2out.c (dwarf2_name): Use new hook. * function.c: Include langhooks.h. (init_function_start): Use new hook. * langhooks-def.h (lhd_decl_printable_name): New. (LANGHOOKS_DECL_PRINTABLE_NAME): New. (LANGHOOKS_INITIALIZER): Update. * langhooks.c (lhd_decl_printable_name): New. * langhooks.h (struct lang_hooks): New hook. * toplev.c (decl_name, decl_printable_name): Remove. (open_dump_file): Use new hook. (process_options): Remove old hook. * tree.h (decl_printable_name): Remove. ada: * misc.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. (gnat_init): Remove old hook. cp: * cp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. * cp-tree.h (lang_printable_name): Rename. * error.c (lang_decl_name): Use new hook. * lex.c (cxx_init): Remove old hook. * pt.c (tsubst_expr): Use new hook. * tree.c (lang_printable_name): Rename. f: * com.c (lang_printable_name): Rename. (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. (ffe_init): Don't use old hook. java: * decl.c (start_java_method): Use new hook. * lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. (java_init): Remove old hook. objc: * objc-act.c (objc_init): Remove old hook. (objc_printable_name): Export. * objc-act.h (objc_printable_name): New. * objc-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. From-SVN: r51066
2002-03-20 08:58:41 +01:00
/* Generate the three forms of printable names for cxx_printable_name. */
const char *
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
lang_decl_name (tree decl, int v, bool translate)
{
if (v >= 2)
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
return (translate
? decl_as_string_translate (decl, TFF_DECL_SPECIFIERS)
: decl_as_string (decl, TFF_DECL_SPECIFIERS));
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
pp_translate_identifiers (cxx_pp) = translate;
if (v == 1
&& (DECL_CLASS_SCOPE_P (decl)
|| (DECL_NAMESPACE_SCOPE_P (decl)
&& CP_DECL_CONTEXT (decl) != global_namespace)))
{
dump_type (cxx_pp, CP_DECL_CONTEXT (decl), TFF_PLAIN_IDENTIFIER);
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
pp_cxx_colon_colon (cxx_pp);
}
if (TREE_CODE (decl) == FUNCTION_DECL)
dump_function_name (cxx_pp, decl, TFF_PLAIN_IDENTIFIER);
else if ((DECL_NAME (decl) == NULL_TREE)
&& TREE_CODE (decl) == NAMESPACE_DECL)
dump_decl (cxx_pp, decl, TFF_PLAIN_IDENTIFIER | TFF_UNQUALIFIED_NAME);
else
dump_decl (cxx_pp, DECL_NAME (decl), TFF_PLAIN_IDENTIFIER);
return pp_ggc_formatted_text (cxx_pp);
}
toplev.c (default_tree_printer): Handle setting location with '+' flag. 2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
2005-07-02 12:55:32 +02:00
/* Return the location of a tree passed to %+ formats. */
location_t
location_of (tree t)
1994-02-24 02:02:37 +01:00
{
if (TYPE_P (t))
{
t = TYPE_MAIN_DECL (t);
if (t == NULL_TREE)
return input_location;
}
tinfo.h (__class_type_info): Fix illegal declaration. 1999-04-02 Mark Mitchell <mark@codesourcery.com> * tinfo.h (__class_type_info): Fix illegal declaration. * cp-tree.def (TEMPLATE_ID_EXPR): Update comment. * cp-tree.h (INHERITED_VALUE_BINDING_P): New macro. (IDENTIFIER_CLASS_VALUE): Improve documentation. (is_properly_derived_from): Declare. (invalidate_class_lookup_cache): Likewise. (maybe_maybe_note_name_used_in_class): Likewise. (note_name_declared_in_class): Likewise. (push_using_decl): Remove duplicate declaration. (id_in_current_class): Remove declaration. (push_class_binding): Change prototype. (clear_identitifer_class_values): Declare. * call.c (is_properly_derived_from): Make it global. (build_new_function_call): Be careful about updating candidates. (build_new_method_call): Handle COMPONENT_REFs. Don't crash when asked to make illegal calls. * class.c: Include splay-tree.h. (class_stack_node): Add names_used slot. (check_member_decl_is_same_in_complete_scope): Remove. (add_method): Fix comment. Push the declaration into class scope. (finish_struct_1): When popping the class, pop the bindings too. Remove check for data member/function member conflict. (finish_struct): Remove calls to check_member_decl_is_same_in_complete_scope. Change calls to popclass. (pushclass): Clear names_used in the class stack entry. Use invalidate_class_lookup_cache to remove cached entries, rather than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE before entering a new class. Remove dead code. Don't mess with current_function_decl when pushing declarations. (invalidate_class_lookup_cache): New function, split out from ... (popclass): Here. Clean up names_used on our way out. (instantiate_type): Adjust. (build_self_reference): Don't push the declaration here. (maybe_note_name_used_in_class): New function. (note_name_declared_in_class): Likewise. * decl.c (add_binding): Change prototype. (find_class_binding_level): New function. (innermost_nonclass_level): Likewise. (current_binding_level): Update documentation. (inner_binding_level): Remove. Replace with current_binding_level throughout. (push_binding_level): Remove special handling of class_binding_level. (pop_binding_level): Likewise. Use find_class_binding_level. (suspend_binding_level): Likewise. (global_bindings_p): Use innermost_nonclass_level. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (pseudo_global_level_p): Likewise. (push_binding): Clear INHERITED_VALUE_BINDING_P. (add_binding): Check for illegal multiple declarations. Return a value indicating whether or not the new binding was legal. (push_local_binding): Skip over class binding levels. Check return value from add_binding. (push_class_binding): Set INHERITED_VALUE_BINDING_P. Call note_name_declared_in_class. (pushlevel_class): Remove "fake out the rest of the compiler" code. (poplevel_class): Reset IDENTIFIER_CLASS_VALUEs. (clear_identifier_class_values): New function. (pop_from_top_level): Use it. (pop_everything): Tweak. (maybe_process_template_type_declaration): Don't push the declaration for the template here. (pushtag): Don't push tag declarations into class scope here. (pushdecl): Apply DeMorgan's law for readability. (pushdecl_class_level): Remove special-case code for TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions. (push_class_level_bindng): Deal with inherited bindings. (lookup_name_real): Remove special-case code for TYPE_BEING_DEFINED, and some implicit typename magic. (grokdeclarator): Handle COMPONENT_REF for a template function. (build_enumerator): Don't call pushdecl_class_level here. (id_in_current_class): Remove. * decl2.c (grokfield): Don't call pushdecl_class_level or check_template_shadow. * errfn.c (cp_file_of): Don't declare. (cp_line_of): Likewise. * error.c (dump_decl): Handle an OVERLOAD. (cp_file_of): Likewise. (cp_line_of): Likewise. * init.c (build_member_call): Handle a COMPONENT_REF. * lex.c (do_identifier): Call maybe_note_name_used_in_class, not pushdecl_class_level. * method.c (hack_identifier): Build COMPONENT_REFs for references to member templates as well as member functions. Remove dead code. * parse.y (left_curly): Remove. (nonnested_type): Call maybe_note_name_used_in_class, not pushdecl_class_level. * parse.c: Regenerated. (nested_name_specifier_1): Likewise. * pt.c (check_explicit_specialization): Adjust, for robustness. (check_template_shadow): Handle OVERLOADs. (build_template_decl): Set DECL_CONSTRUCTOR_P on the TEMPLATE_DECL, if appropriate. * search.c (envelope_add_decl): Remove. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (dfs_push_decls): New function. (dfs_push_type_decls): Likewise. (setup_class_bindings): Likewise. (template_self_reference_p): Likewise. (lookup_field_r): Use it. (looup_member): Remove old comment. Deal with ambiguity. (push_class_decls): Use dfs_push_decls and dfs_push_type_decls, and remove envelope processing. * semantics.c (begin_class_definition): Let pushclass push declarations for base classes. (finish_member_declaration): Push declarations into class scope. * typeck.c (build_component_ref): Just put an OVERLOAD into the COMPONENT_REF, not a TREE_LIST of an OVERLOAD. (build_x_function_call): Deal with OVERLOAD. Handle template-ids. * Makefile.in (class.o): Depend on splay-tree.h. From-SVN: r26133
1999-04-02 17:36:57 +02:00
else if (TREE_CODE (t) == OVERLOAD)
t = OVL_FUNCTION (t);
if (DECL_P (t))
return DECL_SOURCE_LOCATION (t);
Remove macros that implicitly use input_location gcc/ * input.h (input_line): Remove. (input_filename): Likewise. (in_system_header): Likewise. * tree.h (EXPR_LOC_OR_HERE): Remove. * config/bfin/bfin.c (output_file_start): Remove use of input_filename macro. * builtins.c (c_strlen): Remove use of EXPR_LOC_OR_HERE macro. * gimplify.c (internal_get_tmp_var): Likewise. EXPR_LOC_OR_HERE macro. (shortcut_cond_expr): Likewise. * tree-diagnostic.c (diagnostic_report_current_function): Remove use of input_filename macro. * tree.c (get_file_function_name): Likewise. gcc/ada * gcc-interface/utils2.c (build_call_raise): Remove use of input_line macro. (build_call_raise_range): Likewise. (build_call_raise_column): Likewise. gcc/c-family * c-common.c (unsafe_conversion_p): Remove use of EXPR_LOC_OR_HERE macro. (conversion_warning): Likewise. (warnings_for_convert_and_check): Likewise. (warn_for_collisions_1): Likewise. (shorten_compare): Likewise, and remove use of in_system_header macro, using the location from the former. * c-lex.c (dump_one_header): Remove use of input_filename macro. (cb_def_pragma): Remove use of in_system_header macro. (lex_string): Likewise. * c-pragma.c (handle_pragma_float_const_decimal64): Likewise. gcc/c * c-decl.c (define_label, shadow_tag_warned) (check_bitfield_type_and_width, grokdeclarator, grokparms, store_parm_decls_newstyle, store_parm_decls_oldstyle) (declspecs_add_type): Remove use of in_system_header macro. * c-parser.c (c_parser_unary_expression): Likewise. * c-typeck.c (store_init_value, process_init_element) (c_start_case): Likewise. * c-decl.c (build_enumerator): Remove use of EXPR_LOC_OR_HERE macro. * c-parser.c (c_parser_set_source_position_from_token): Remove reference to in_system_header from comment. gcc/cp * call.c (build_integral_nontype_arg_conv): Remove use of EXPR_LOC_OR_HERE macro. (convert_like_real): Likewise. (convert_arg_to_ellipsis): Likewise. (build_cxx_call): Likewise. (perform_implicit_conversion_flags): Likewise. (initialize_reference): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_reference): Likewise. (ocp_convert): Likewise. (convert_to_void): Likewise. * decl.c (pop_label): Update comment. (pop_switch): Remove use of EXPR_LOC_OR_HERE macro. (check_tag_decl): Remove use of in_system_header macro. (make_rtl_for_nonlocal_decl): Remove use of input_filename macro. (compute_array_index_type): Remove use of in_system_header macro. (grokdeclarator): Likewise. * error.c (dump_global_iord): Remove use of input_filename macro. (location_of): Remove use of EXPR_LOC_OR_HERE macro. (maybe_warn_cpp0x): Remove use of in_system_header macro. * init.c (build_new_1): Remove use of EXPR_LOC_OR_HERE macro. * lex.c (handle_pragma_interface): Remove use of input_filename macro. (handle_pragma_implementation): Likewise. (cxx_make_type): Likewise. (in_main_input_context): Likewise. * name-lookup.c (push_binding_level): Remove use of input_line macro. (leave_scope): Likewise. (resume_scope): Likewise. * parser.c (cp_parser_unqualified_id): Remove use of in_system_header macro. (cp_parser_cast_expression): Likewise. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_exception_specification_opt): Likewise. * pt.c (unify_arg_conversion): Remove use of EXPR_LOC_OR_HERE macro. (convert_nontype_argument): Likewise. (push_tinst_level): Remove use of in_system_header macro. (tsubst_copy_and_build): Remove use of EXPR_LOC_OR_HERE macros. (do_decl_instantiation): Remove use of in_system_header macro. (do_type_instantiation): Likewise. * semantics.c (finish_call_expr): Remove use of EXPR_LOC_OR_HERE macro. (begin_class_definition): Remove use of input_filename macro. (cxx_eval_call_expression): Remove use of EXPR_LOC_OR_HERE macro. (cxx_eval_constant_expression): Likewise. (potential_constant_expression_1): Likewise. * typeck.c (decay_conversion): Likewise. (rationalize_conditional_expr): Likewise. (build_x_compound_expr_from_list): Likewise. (convert_for_assignment): Likewise. * typeck2.c (check_narrowing): Likewise. gcc/fortran * trans.c (trans_runtime_error_vararg): Remove use of input_line macro. gcc/java * class.c (maybe_layout_super_class): Update comment. * decl.c (java_add_stmt): Remove use of input_filename macro. * jcf-parse.c (set_source_filename): Remove use of input_filename macro. (parse_class_file): Remove use of input_line and input_filename macros. (java_parse_file): Remove use of input_filename macro. From-SVN: r205262
2013-11-22 15:18:13 +01:00
return EXPR_LOC_OR_LOC (t, input_location);
1994-02-24 02:02:37 +01:00
}
/* Now the interfaces from error et al to dump_type et al. Each takes an
on/off VERBOSE flag and supply the appropriate TFF_ flags to a dump_
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
function. */
static const char *
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
decl_to_string (tree decl, int verbose)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
{
int flags = 0;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == RECORD_TYPE
|| TREE_CODE (decl) == UNION_TYPE || TREE_CODE (decl) == ENUMERAL_TYPE)
flags = TFF_CLASS_KEY_OR_ENUM;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (verbose)
flags |= TFF_DECL_SPECIFIERS;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
else if (TREE_CODE (decl) == FUNCTION_DECL)
flags |= TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE;
flags |= TFF_TEMPLATE_HEADER;
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
dump_decl (cxx_pp, decl, flags);
return pp_ggc_formatted_text (cxx_pp);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
static const char *
expr_to_string (tree decl)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
{
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
dump_expr (cxx_pp, decl, 0);
return pp_ggc_formatted_text (cxx_pp);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
static const char *
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
fndecl_to_string (tree fndecl, int verbose)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
{
int flags;
flags = TFF_EXCEPTION_SPECIFICATION | TFF_DECL_SPECIFIERS
| TFF_TEMPLATE_HEADER;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (verbose)
flags |= TFF_FUNCTION_DEFAULT_ARGUMENTS;
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
dump_decl (cxx_pp, fndecl, flags);
return pp_ggc_formatted_text (cxx_pp);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
static const char *
code_to_string (enum tree_code c)
1994-02-24 02:02:37 +01:00
{
tree-core.h (tree_code_name): Remove. gcc/ * tree-core.h (tree_code_name): Remove. * tree.h (get_tree_code_name): New prototype. * tree.c (tree_code_name): Make static. (get_tree_code_name): New function. (dump_tree_statistics, tree_check_failed, tree_not_check_failed, tree_class_check_failed, tree_range_check_failed, tree_not_class_check_failed, omp_clause_check_failed, tree_contains_struct_check_failed, tree_operand_check_failed): Use new wrapper get_tree_code_name instead of calling tree_code_name directly. * tree-vrp.c (dump_asserts_for): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-pretty-print.c (do_niy, dump_generic_node): Likewise. * tree-pretty-print.h (pp_unsupported_tree): Likewise. * lto-streamer-out.c (lto_write_tree, DFS_write_tree): Likewise. * tree-ssa-dom.c (print_expr_hash_elt): Likewise. * gimple-pretty-print.c (dump_unary_rhs, dump_binary_rhs, dump_ternary_rhs, dump_gimple_assign, dump_gimple_cond, dump_gimple_omp_for): Likewise. * tree-vect-data-refs.c (vect_create_data_ref_ptr): Likewise. * tree-ssa-pre.c (print_pre_expr): Likewise. * ipa-prop.c (ipa_print_node_jump_functions_for_edge): Likewise. * print-tree.c (print_node_brief, print_node): Likewise. * gimple.c (gimple_check_failed): Likewise. * lto-streamer.c (lto_tag_name, print_lto_report): Likewise. * config/frv/frv.c (frv_init_cumulative_args): Likewise. * config/mep/mep.c (mep_validate_vliw): Likewise. * config/iq2000/iq2000.c (init_cumulative_args): Likewise. * config/rs6000/rs6000.c (init_cumulative_args): Likewise. gcc/cp/ * error.c (code_to_string): Use new wrapper get_tree_code_name. * cxx-pretty-print.c (pp_cxx_assignment_operator): Likewise. * pt.c (tsubst): Likewise. * semantics.c (cxx_eval_constant_expression, potential_constant_expression_1): Likewise. * mangle.c (MANGLE_TRACE_TREE, dump_substitution_candidates, add_substitution, find_substitution): Likewise. From-SVN: r203695
2013-10-16 12:09:17 +02:00
return get_tree_code_name (c);
1994-02-24 02:02:37 +01:00
}
const char *
language_to_string (enum languages c)
1994-02-24 02:02:37 +01:00
{
switch (c)
{
case lang_c:
return "C";
case lang_cplusplus:
return "C++";
default:
call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. * call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. From-SVN: r86778
2004-08-30 17:28:48 +02:00
gcc_unreachable ();
1994-02-24 02:02:37 +01:00
}
return NULL;
1994-02-24 02:02:37 +01:00
}
/* Return the proper printed version of a parameter to a C++ function. */
1996-07-11 03:13:25 +02:00
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
static const char *
parm_to_string (int p)
1994-02-24 02:02:37 +01:00
{
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
1994-02-24 02:02:37 +01:00
if (p < 0)
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
pp_string (cxx_pp, "'this'");
else
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
pp_decimal_int (cxx_pp, p + 1);
return pp_ggc_formatted_text (cxx_pp);
1994-02-24 02:02:37 +01:00
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
static const char *
op_to_string (enum tree_code p)
1994-02-24 02:02:37 +01:00
{
tree id = operator_name_info[p].identifier;
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
return id ? IDENTIFIER_POINTER (id) : M_("<unknown>");
1994-02-24 02:02:37 +01:00
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
static const char *
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
type_to_string (tree typ, int verbose)
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
{
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
int flags = 0;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (verbose)
flags |= TFF_CLASS_KEY_OR_ENUM;
flags |= TFF_TEMPLATE_HEADER;
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
dump_type (cxx_pp, typ, flags);
/* If we're printing a type that involves typedefs, also print the
stripped version. But sometimes the stripped version looks
exactly the same, so we don't want it after all. To avoid printing
it in that case, we play ugly obstack games. */
if (typ && TYPE_P (typ) && typ != TYPE_CANONICAL (typ)
&& !uses_template_parms (typ))
{
int aka_start, aka_len; char *p;
struct obstack *ob = pp_buffer (cxx_pp)->obstack;
/* Remember the end of the initial dump. */
int len = obstack_object_size (ob);
tree aka = strip_typedefs (typ);
pp_string (cxx_pp, " {aka");
pp_cxx_whitespace (cxx_pp);
/* And remember the start of the aka dump. */
aka_start = obstack_object_size (ob);
dump_type (cxx_pp, aka, flags);
aka_len = obstack_object_size (ob) - aka_start;
pretty-print.h (pp_underscore): New. * pretty-print.h (pp_underscore): New. (pp_comma): Tidy. * gimple-pretty-print.c (dump_unary_rhs): Use specialized pretty printer functions instead of pp_character. (dump_binary_rhs): Likewise. (dump_ternary_rhs): Likewise. (dump_gimple_call_args): Likewise. (pp_points_to_solution): Likewise. (dump_gimple_call): Likewise. (dump_gimple_switch): Likewise. (dump_gimple_cond): Likewise. (dump_gimple_bind): Likewise. (dump_gimple_try): Likewise. (dump_gimple_omp_for): Likewise. (dump_gimple_omp_continue): Likewise. (dump_gimple_omp_single): Likewise. (dump_gimple_omp_sections): Likewise. (dump_gimple_omp_block): Likewise. (dump_gimple_omp_critical): Likewise. (dump_gimple_transaction): Likewise. (dump_gimple_asm): Likewise. (dump_gimple_phi): Likewise. (dump_gimple_omp_parallel): Likewise. (dump_gimple_omp_task): Likewise. (dump_gimple_omp_atomic_load): Likewise. (dump_gimple_omp_atomic_store): Likewise. (dump_gimple_mem_ops): Likewise. (pp_gimple_stmt_1): Likewise. (pp_cfg_jump): Likewise. (dump_implicit_edges): Likewise. (gimple_dump_bb_for_graph): Likewise. * graph.c (draw_cfg_node): Likewise. * langhooks.c (lhd_print_error_function): Likewise. * sched-vis.c (print_exp): Likewise. (print_value): Likewise. (print_pattern): Likewise. (print_insn): Likewise. (rtl_dump_bb_for_graph): Likewise. * tree-pretty-print.c (dump_function_declaration): Likewise. (dump_array_domain): Likewise. (dump_omp_clause): Likewise. (dump_location): Likewise. (dump_generic_node): Likewise. (print_struct_decl): Likewise. * diagnostic.c (diagnostic_show_locus): Use pp_space. c-family/ * c-ada-spec.c (print_ada_macros): Use specialized pretty printer functions instead of pp_character. (pp_ada_tree_identifier): Likewise. (dump_ada_double_name): Likewise. (dump_ada_function_declaration): Likewise. (dump_ada_array_domains): Likewise. (dump_template_types): Likewise. (dump_generic_ada_node): Likewise. (print_ada_declaration): Likewise. (print_ada_struct_decl): Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. cp/ * error.c (dump_aggr_type): Use specialized pretty printer functions instead of pp_character. (dump_type_prefix): Likewise. (dump_simple_decl): Likewise. (type_to_string): Likewise. From-SVN: r201467
2013-08-03 20:57:25 +02:00
pp_right_brace (cxx_pp);
p = (char*)obstack_base (ob);
/* If they are identical, cut off the aka with a NUL. */
if (len == aka_len && memcmp (p, p+aka_start, len) == 0)
p[len] = '\0';
}
return pp_ggc_formatted_text (cxx_pp);
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
}
static const char *
assop_to_string (enum tree_code p)
{
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
tree id = assignment_operator_name_info[(int) p].identifier;
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
return id ? IDENTIFIER_POINTER (id) : M_("{unknown}");
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
static const char *
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
args_to_string (tree p, int verbose)
1994-02-24 02:02:37 +01:00
{
int flags = 0;
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
if (verbose)
flags |= TFF_CLASS_KEY_OR_ENUM;
1994-02-24 02:02:37 +01:00
if (p == NULL_TREE)
return "";
1994-02-24 02:02:37 +01:00
builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros. * builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros. * c-common.c (decl_attributes,check_format_info,truthvalue_conversion, c_get_alias_set): Likewise. * c-decl.c (duplicate_decls): Likewise. * c-typeck.c (default_conversion,build_unary_op): Likewise. * calls.c (initialize_argument_information): Likewise. * dwarf2out.c (decl_class_context,add_abstract_origin_attribute): Likewise. * dwarfout.c (decl_class_context,output_type): Likewise. * expr.c (get_inner_reference): Likewise. * fold-const.c (simple_operand_p,fold): Likewise. * function.c (aggregate_value_p): Likewise. * stmt.c (expand_asm_operands): Likewise. * varasm.c (named_section): Likewise. * call.c (check_dtor_name,build_new_method_call): Likewise. * decl.c (push_class_binding,poplevel,pushtag,lookup_namespace_name, make_typename_type,check_initializer,cp_finish_decl,xref_tag): Likewise. * decl2.c (grokfield,build_expr_from_tree,build_expr_from_tree, decl_namespace,arg_assoc_template_arg,arg_assoc, validate_nonmember_using_decl,do_class_using_decl): Likewise. * error.c (dump_template_argument,dump_expr,cp_file_of,cp_line_of, args_to_string): Likewise. * friend.c (is_friend): Likewise. * lex.c (note_got_semicolon,note_list_got_semicolon,is_global): Likewise. * method.c (build_overload_nested_name,build_overload_value, build_qualified_name,build_qualified_name,hack_identifier): Likewise. * parse.y (typename_sub,typename_sub1): Likewise. * pt.c (push_inline_template_parms_recursive,check_template_shadow, process_partial_specialization,convert_template_argument, template_args_equal,add_pending_template,lookup_template_class, for_each_template_parm_r,maybe_fold_nontype_arg, tsubst,instantiate_template,type_unification_real,unify, instantiate_pending_templates,set_mangled_name_for_template_decl): Likewise. * repo.c (repo_get_id,repo_template_used): Likewise. * search.c (lookup_field_1): Likewise. * tree.c (walk_tree,get_type_decl,cp_tree_equal,member_p): Likewise. * xref.c (classname): Likewise. From-SVN: r32698
2000-03-23 01:41:05 +01:00
if (TYPE_P (TREE_VALUE (p)))
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
return type_as_string_translate (p, flags);
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
for (; p; p = TREE_CHAIN (p))
{
if (TREE_VALUE (p) == null_node)
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
pp_cxx_ws_string (cxx_pp, "NULL");
else
dump_type (cxx_pp, error_type (TREE_VALUE (p)), flags);
if (TREE_CHAIN (p))
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
pp_separate_with_comma (cxx_pp);
}
return pp_ggc_formatted_text (cxx_pp);
1994-02-24 02:02:37 +01:00
}
/* Pretty-print a deduction substitution (from deduction_tsubst_fntype). P
is a TREE_LIST with purpose the TEMPLATE_DECL, value the template
arguments. */
static const char *
subst_to_string (tree p)
{
tree decl = TREE_PURPOSE (p);
tree targs = TREE_VALUE (p);
tree tparms = DECL_TEMPLATE_PARMS (decl);
int flags = (TFF_DECL_SPECIFIERS|TFF_TEMPLATE_HEADER
|TFF_NO_TEMPLATE_BINDINGS);
if (p == NULL_TREE)
return "";
reinit_cxx_pp ();
dump_template_decl (cxx_pp, TREE_PURPOSE (p), flags);
dump_substitution (cxx_pp, NULL, tparms, targs, /*flags=*/0);
return pp_ggc_formatted_text (cxx_pp);
}
Augment stringification of trees. * cp-tree.h (tree_string_flags): New error stringifying enumeration. (fndecl_as_string, type_as_string_real, args_as_string, code_as_string, language_as_string, parm_as_string, op_as_string, assop_as_string, cv_as_string): Remove. (type_as_string, decl_as_string, expr_as_string): Adjust prototype. (context_as_string): Declare new function. * error.c (cp_printers): Move definition. (OB_UNPUT): Remove. (OB_END_TEMPLATE_ID): Adjust. (interesting_scope_p): Remove. (dump_scope): New static function. (dump_qualifiers): Adjust prototype, reimplement. (dump_template_value): Use tree_string_flags. (dump_type_real): Move back to dump_type. (dump_type): Adjust prototype. Use tree_string_flags. (dump_aggr_type): Likewise. Use dump_template_parms. (dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag. (dump_type_suffix): Adjust prototype. Use tree_string_flags. (dump_simple_decl): Likewise. (dump_decl): Likewise. Use dump_template_decl. (dump_template_decl): New static function broken out of dump_decl. (dump_function_decl): Adjust prototype. Use tree_string_flags. (dump_parameters): Likewise. Prefix space. (dump_exception_spec): Adjust prototype. Use tree_string_flags. (dump_function_name): Likewise. Use dump_template_parms. (dump_template_parms): New static function broken out of dump_function_name. (dump_expr_list): Adjust prototype. Use tree_string_flags. (dump_expr): Likewise. (fndecl_as_string): Removed (type_as_string_real): Removed (dump_binary_op): Adjust prototype. Use tree_string_flags. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): New function. (lang_decl_name): Adjust. (decl_to_string): New static print callback. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_as_string): Renamed to ... (code_to_string): ... here. Adjust. (language_as_string): Renamed to ... (language_to_string): ... here. Adjust. (parm_as_string): Renamed to ... (parm_to_string): ... here. (op_as_string): Renamed to ... (op_to_string): ... here. (assop_as_string): Renamed to ... (assop_to_string): ... here. (type_to_string): New static print callback. (args_as_string): Renamed to ... (args_to_string): ... here. Adjust. (cv_as_string): Renamed to ... (cv_to_string): ... here. Adjust. * pt.c (mangle_class_name_for_template): Use tree_string_flags. (print_template_context): Likewise. From-SVN: r29673
1999-09-27 10:26:00 +02:00
static const char *
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
cv_to_string (tree p, int v)
{
error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove. (pp_template_argument_list_end): Likewise. (pp_separate_with_comma): Use pp_cxx_separate_with. (reinit_global_formatting_buffer): Remove. (pp_non_consecutive_character): Likewise. (dump_scope): Use pp_cxx_colon_colon. (dump_template_parameter): Use pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace. (dump_templat_bindings): Replace use of pp_string with sequence of pp_cxx_whitespace and pp_equal. (dump_type): Use pp_cxx_identifier, pp_cxx_tree_identifier, pp_cxx_colon_colon, pp_cxx_whitespace throughout. Don't set padding here. (dump_aggr_type): Use pp_cxx_identifier amd pp_cxx_tree_identifier. (dump_type_prefix): Don't set padding. Use pp_cxx_whitespace, pp_cxx_left_parent, pp_cxx_colon_colon and pp_cxx_star troughout. (dump_type_suffix): Use pp_cxx_right_paren, pp_cxx_left_bracket, pp_cxx_right_bracket, pp_cxx_identifier throughout, (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. Set padding as appropriate. (dump_parameters): Use pp_cxx_left_paren, pp_cxx_identifier and pp_cxx_right_paren. (dump_exception_spec): Likewise. (dump_function_name): Use pp_cxx_tree_identifier and pp_cxx_identifier. (dump_template_parms): Use pp_cxx_begin_template_argument_list and pp_cxx_end_template_argument_list. (dump_expr): Use pp_cxx_left_paren, pp_cxx_right_paren, pp_cxx_colon_colon, pp_cxx_identifier, pp_cxx_tree_identifier and pp_cxx_whitespace throughout. (dump_binary_op): Use pp_cxx_whitespace, pp_cxx_left_paren and pp_cxx_right_paren. (dump_unary_op): Likewise. (reinit_cxx_pp): New function. (type_as_string); Use it. (expr_as_string): Likewise. (decl_as_string); Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (parm_to_string): Likewise. (type_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. From-SVN: r83732
2004-06-27 17:20:41 +02:00
reinit_cxx_pp ();
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
cxx_pp->padding = v ? pp_before : pp_none;
pp_cxx_cv_qualifier_seq (cxx_pp, p);
return pp_ggc_formatted_text (cxx_pp);
}
static const char *
eh_spec_to_string (tree p, int /*v*/)
{
int flags = 0;
reinit_cxx_pp ();
dump_exception_spec (cxx_pp, p, flags);
return pp_ggc_formatted_text (cxx_pp);
}
/* Langhook for print_error_function. */
void
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
cxx_print_error_function (diagnostic_context *context, const char *file,
diagnostic_info *diagnostic)
{
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
lhd_print_error_function (context, file, diagnostic);
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_set_prefix (context->printer, file);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
maybe_print_instantiation_context (context);
}
static void
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
cp_diagnostic_starter (diagnostic_context *context,
diagnostic_info *diagnostic)
{
re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color) gcc/fortran/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 Replace all calls to gfc_notify_std_1 with gfc_notify_std and gfc_warning_1 with gfc_warning. * decl.c (gfc_verify_c_interop_param): Here. * resolve.c (resolve_branch): Here. (resolve_fl_derived): Here. * dependency.c (gfc_check_argument_var_dependency): * scanner.c (preprocessor_line): Use gfc_warning_now_at. Fix line counter and locations before and after warning. * gfortran.h (gfc_warning_1, gfc_warning_now_1, gfc_notify_std_1): Delete. (gfc_warning_now_at): Declare. * error.c (gfc_warning_1): Delete. (gfc_notify_std_1): Delete. (gfc_warning_now_1): Delete. (gfc_format_decoder): Handle two locations. (gfc_diagnostic_build_prefix): Rename as gfc_diagnostic_build_kind_prefix. (gfc_diagnostic_build_locus_prefix): Take an expanded_location instead of diagnostic_info. (gfc_diagnostic_build_locus_prefix): Add overload that takes two expanded_location. (gfc_diagnostic_starter): Handle two locations. (gfc_warning_now_at): New. (gfc_diagnostics_init): Initialize caret_chars array. (gfc_diagnostics_finish): Reset caret_chars array to default. gcc/cp/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * error.c (cp_diagnostic_starter): Use diagnostic_location function. (cp_print_error_function): Likewise. (cp_printer): Replace locus pointer with accessor function. gcc/c/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * c-objc-common.c (c_tree_printer): Replace locus pointer with accessor function. gcc/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * tree-pretty-print.c (percent_K_format): Replace locus pointer with accessor function. * tree-diagnostic.c (diagnostic_report_current_function): Use diagnostic_location function. (maybe_unwind_expanded_macro_loc): Likewise. (virt_loc_aware_diagnostic_finalizer): Likewise. (default_tree_printer): Replace locus pointer with accessor function. * diagnostic.c (diagnostic_initialize): Initialize caret_chars array. (diagnostic_set_info_translated): Initialize second location. (diagnostic_build_prefix): Use CARET_LINE_MARGIN. (diagnostic_show_locus): Handle two locations. Call diagnostic_print_caret_line. (diagnostic_print_caret_line): New. (default_diagnostic_starter): Use diagnostic_location function. (diagnostic_report_diagnostic): Use diagnostic_location function. (verbatim): Do not set text.locus. * diagnostic.h (struct diagnostic_info): Remove location field. (struct diagnostic_context): Make caret_chars an array of two. (diagnostic_location): New inline. (diagnostic_expand_location): Handle two locations. (diagnostic_same_line): New inline. (diagnostic_print_caret_line): Declare. (CARET_LINE_MARGIN): New constant. * pretty-print.c (pp_printf): Do not set text.locus. (pp_verbatim): Do not set text.locus. * pretty-print.h (MAX_LOCATIONS_PER_MESSAGE): New constant. (struct text_info): Replace locus pointer with locations array. Add accessor functions. gcc/testsuite/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * lib/gfortran-dg.exp: Update regex to handle two locations for the same diagnostic without caret. * gfortran.dg/badline.f: Test also that line numbers are correct before and after "left but not entered" warning. From-SVN: r223237
2015-05-16 14:31:00 +02:00
diagnostic_report_current_module (context, diagnostic_location (diagnostic));
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
cp_print_error_function (context, diagnostic);
maybe_print_instantiation_context (context);
maybe_print_constexpr_context (context);
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_set_prefix (context->printer, diagnostic_build_prefix (context,
diagnostic));
}
/* Print current function onto BUFFER, in the process of reporting
a diagnostic message. Called from cp_diagnostic_starter. */
static void
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
cp_print_error_function (diagnostic_context *context,
diagnostic_info *diagnostic)
{
/* If we are in an instantiation context, current_function_decl is likely
to be wrong, so just rely on print_instantiation_full_context. */
if (current_instantiation ())
return;
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
if (diagnostic_last_function_changed (context, diagnostic))
{
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
const char *old_prefix = context->printer->prefix;
re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color) gcc/fortran/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 Replace all calls to gfc_notify_std_1 with gfc_notify_std and gfc_warning_1 with gfc_warning. * decl.c (gfc_verify_c_interop_param): Here. * resolve.c (resolve_branch): Here. (resolve_fl_derived): Here. * dependency.c (gfc_check_argument_var_dependency): * scanner.c (preprocessor_line): Use gfc_warning_now_at. Fix line counter and locations before and after warning. * gfortran.h (gfc_warning_1, gfc_warning_now_1, gfc_notify_std_1): Delete. (gfc_warning_now_at): Declare. * error.c (gfc_warning_1): Delete. (gfc_notify_std_1): Delete. (gfc_warning_now_1): Delete. (gfc_format_decoder): Handle two locations. (gfc_diagnostic_build_prefix): Rename as gfc_diagnostic_build_kind_prefix. (gfc_diagnostic_build_locus_prefix): Take an expanded_location instead of diagnostic_info. (gfc_diagnostic_build_locus_prefix): Add overload that takes two expanded_location. (gfc_diagnostic_starter): Handle two locations. (gfc_warning_now_at): New. (gfc_diagnostics_init): Initialize caret_chars array. (gfc_diagnostics_finish): Reset caret_chars array to default. gcc/cp/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * error.c (cp_diagnostic_starter): Use diagnostic_location function. (cp_print_error_function): Likewise. (cp_printer): Replace locus pointer with accessor function. gcc/c/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * c-objc-common.c (c_tree_printer): Replace locus pointer with accessor function. gcc/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * tree-pretty-print.c (percent_K_format): Replace locus pointer with accessor function. * tree-diagnostic.c (diagnostic_report_current_function): Use diagnostic_location function. (maybe_unwind_expanded_macro_loc): Likewise. (virt_loc_aware_diagnostic_finalizer): Likewise. (default_tree_printer): Replace locus pointer with accessor function. * diagnostic.c (diagnostic_initialize): Initialize caret_chars array. (diagnostic_set_info_translated): Initialize second location. (diagnostic_build_prefix): Use CARET_LINE_MARGIN. (diagnostic_show_locus): Handle two locations. Call diagnostic_print_caret_line. (diagnostic_print_caret_line): New. (default_diagnostic_starter): Use diagnostic_location function. (diagnostic_report_diagnostic): Use diagnostic_location function. (verbatim): Do not set text.locus. * diagnostic.h (struct diagnostic_info): Remove location field. (struct diagnostic_context): Make caret_chars an array of two. (diagnostic_location): New inline. (diagnostic_expand_location): Handle two locations. (diagnostic_same_line): New inline. (diagnostic_print_caret_line): Declare. (CARET_LINE_MARGIN): New constant. * pretty-print.c (pp_printf): Do not set text.locus. (pp_verbatim): Do not set text.locus. * pretty-print.h (MAX_LOCATIONS_PER_MESSAGE): New constant. (struct text_info): Replace locus pointer with locations array. Add accessor functions. gcc/testsuite/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * lib/gfortran-dg.exp: Update regex to handle two locations for the same diagnostic without caret. * gfortran.dg/badline.f: Test also that line numbers are correct before and after "left but not entered" warning. From-SVN: r223237
2015-05-16 14:31:00 +02:00
const char *file = LOCATION_FILE (diagnostic_location (diagnostic));
diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. * diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. (diagnostic_initialize): Initialize x_data not last_function. (diagnostic_report_current_function): Move to tree-diagnostic.c. (default_diagnostic_starter): Call diagnostic_report_current_module not diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize x_data not abstract_origin. (verbatim): Likewise. * diagnostic.h (struct diagnostic_info): Change abstract_origin to x_data. (struct diagnostic_context): Change last_function to x_data. (diagnostic_auxiliary_data): Replace with diagnostic_context_auxiliary_data and diagnostic_info_auxiliary_data. (diagnostic_last_function_changed, diagnostic_set_last_function, diagnostic_report_current_function): Move to tree-diagnostic.h. (print_declaration, dump_generic_node, print_generic_stmt, print_generic_stmt_indented, print_generic_expr, print_generic_decl, debug_c_tree, dump_omp_clauses, print_call_name, debug_generic_expr, debug_generic_stmt, debug_tree_chain, default_tree_printer): Move to tree-pretty-print.h. (debug_gimple_stmt, debug_gimple_seq, print_gimple_seq, print_gimple_stmt, print_gimple_expr, dump_gimple_stmt): Move to gimple-pretty-print.h. * pretty-print.c: Don't include tree.h (pp_base_format): Don't handle %K here. (pp_base_tree_identifier): Move to tree-pretty-print.c. * pretty-print.h (text_info): Change abstract_origin to x_data. (pp_tree_identifier, pp_unsupported_tree, pp_base_tree_identifier): Move to tree-pretty-print.h. * gimple-pretty-print.h, tree-diagnostic.c, tree-diagnostic.h, tree-pretty-print.h: New files. * tree-pretty-print.c: Include tree-pretty-print.h. (percent_K_format): New. Moved from pretty-print.c. (pp_base_tree_identifier): Move from pretty-print.c. * c-objc-common.c: Include tree-pretty-print.h. (c_tree_printer): Handle %K here. * langhooks.c: Include tree-diagnostic.h. (lhd_print_error_function): Use diagnostic_abstract_origin macro. * toplev.c: Include tree-diagnostic.h and tree-pretty-print.h. (default_tree_printer): Handle %K using percent_K_format. (general_init): Use default_tree_diagnostic_starter. * tree.c: Include tree-diagnostic.h and tree-pretty-print.h. (free_lang_data): Use default_tree_diagnostic_starter. * c-pretty-print.c: Include tree-pretty-print.h. * cfgexpand.c: Include tree-pretty-print.h and gimple-pretty-print.h. * cgraphunit.c: Include tree-pretty-print.h and gimple-pretty-print.h. * dwarf2out.c: Include tree-pretty-print.h. * except.c: Include tree-pretty-print.h. * gimple-pretty-print.c: Include tree-pretty-print.h and gimple-pretty-print.h. * gimplify.c: Include tree-pretty-print.h. * graphite-poly.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-cp.c: Include tree-pretty-print.h. * ipa-inline.c: Include gimple-pretty-print.h. * ipa-prop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-pure-const.c: Include gimple-pretty-print.h. * ipa-struct-reorg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-type-escape.c: Include tree-pretty-print.h. * print-rtl.c: Include tree-pretty-print.h. * print-tree.c: Include gimple-pretty-print.h. * sese.c: Include tree-pretty-print.h. * tree-affine.c: Include tree-pretty-print.h. * tree-browser.c: Include tree-pretty-print.h. * tree-call-cdce.c: Include gimple-pretty-print.h. * tree-cfg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-chrec.c: Include tree-pretty-print.h. * tree-data-ref.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-dfa.c: Include tree-pretty-print.h. * tree-if-conv.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-inline.c: Include tree-pretty-print.h. * tree-into-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-nrv.c: Include tree-pretty-print.h. * tree-object-size.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-outof-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-parloops.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-predcom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-scalar-evolution.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-sra.c: Include tree-pretty-print.h. * tree-ssa-address.c: Include tree-pretty-print.h. * tree-ssa-alias.c: Include tree-pretty-print.h. * tree-ssa-ccp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-coalesce.c: Include tree-pretty-print.h. * tree-ssa-copy.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-copyrename.c: Include tree-pretty-print.h. * tree-ssa-dce.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dse.c: Include gimple-pretty-print.h. * tree-ssa-forwprop.c: Include tree-pretty-print.h. * tree-ssa-ifcombine.c: Include tree-pretty-print.h. * tree-ssa-live.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-im.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivcanon.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivopts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-niter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-prefetch.c: Include tree-pretty-print.h. * tree-ssa-math-opts.c: Include gimple-pretty-print.h. * tree-ssa-operands.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-phiprop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-pre.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-propagate.c: Include gimple-pretty-print.h. * tree-ssa-reassoc.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sccvn.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sink.c: Include gimple-pretty-print.h. * tree-ssa-ter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-uninit.c: Include gimple-pretty-print.h. * tree-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-stdarg.c: Include gimple-pretty-print.h. * tree-switch-conversion.c: Include gimple-pretty-print.h. * tree-tailcall.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-data-refs.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop-manip.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-patterns.c: Include gimple-pretty-print.h. * tree-vect-slp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-stmts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vectorizer.c: Include tree-pretty-print.h. * tree-vrp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * value-prof.c: Include tree-pretty-print.h and gimple-pretty-print.h. * var-tracking.c: Include tree-pretty-print.h. * Makefile.in (OBJS-common): Add tree-diagnostic.o. (tree-diagnostic.o): New dependencies. (c-objc-common.o, c-pretty-print.o, langhooks.o, tree.o, tree-inline.o, print-tree.o, stor-layout.o, tree-ssa-uninit.o, tree-ssa.o, tree-into-ssa.o, tree-ssa-ter.o, tree-ssa-coalesce.o, tree-outof-ssa.o, tree-ssa-forwprop.o, tree-ssa-phiprop.o, tree-ssa-ifcombine.o, tree-nrv.o, tree-ssa-copy.o, tree-ssa-propagate.o, tree-ssa-dom.o, tree-ssa-uncprop.o, tree-ssa-live.o, tree-ssa-copyrename.o, tree-ssa-pre.o, tree-ssa-sccvn.o, tree-vrp.o, tree-cfg.o, tree-tailcall.o, tree-ssa-sink.o, tree-if-conv.o, tree-dfa.o, tree-ssa-operands.o, tree-ssa-address.o, tree-ssa-loop-niter.o, tree-ssa-loop-ivcanon.o, tree-ssa-loop-prefetch.o, tree-predcom.o, tree-ssa-loop-ivopts.o, tree-affine.o, tree-ssa-loop-im.o, tree-ssa-math-opts.o, tree-ssa-alias.o, tree-ssa-reassoc.o, gimplify.o, tree-browser.o, tree-chrec.o, tree-scalar-evolution.o, tree-data-ref.o, sese.o, graphite-poly.o, tree-vect-loop.o, tree-vect-loop-manip.o, tree-vect-patterns.o, tree-vect-slp.o, tree-vect-stmts.o, tree-vect-data-refs.o, tree-vectorizer.o, tree-parloops.o, tree-stdarg.o, tree-object-size.o, gimple-pretty-print.o, tree-pretty-print.o, diagnostic.o, toplev.o, print-rtl.o, except.o, dwarf2out.o, cgraphunit.o, ipa-prop.o, ipa-cp.o, ipa-inline.o, ipa-pure-const.o, ipa-type-escape.o, ipa-struct-reorg.o, tree-ssa-dce.o, tree-call-cdce.o, tree-ssa-ccp.o, tree-sra.o, tree-switch-conversion.o, var-tracking.o, value-prof.o, cfgexpand.o, pretty-print.o): Update dependencies. cp: * error.c: Include tree-diagnostic.h and tree-pretty-print.h. (cp_print_error_function): Use diagnostic_abstract_origin macro. (cp_printer): Handle %K here using percent_K_format. * cxx-pretty-print.c: Include tree-pretty-print.h. * Make-lang.in (cp/error.o, cp/cxx-pretty-print.o): Update dependencies. From-SVN: r159685
2010-05-22 00:34:26 +02:00
tree abstract_origin = diagnostic_abstract_origin (diagnostic);
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
char *new_prefix = (file && abstract_origin == NULL)
? file_name_as_prefix (context, file) : NULL;
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_set_prefix (context->printer, new_prefix);
if (current_function_decl == NULL)
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_string (context->printer, _("At global scope:"));
else
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
{
tree fndecl, ao;
if (abstract_origin)
{
ao = BLOCK_ABSTRACT_ORIGIN (abstract_origin);
while (TREE_CODE (ao) == BLOCK
&& BLOCK_ABSTRACT_ORIGIN (ao)
&& BLOCK_ABSTRACT_ORIGIN (ao) != ao)
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
ao = BLOCK_ABSTRACT_ORIGIN (ao);
gcc_assert (TREE_CODE (ao) == FUNCTION_DECL);
fndecl = ao;
}
else
fndecl = current_function_decl;
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
pp_printf (context->printer, function_category (fndecl),
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
cxx_printable_name_translate (fndecl, 2));
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
while (abstract_origin)
{
location_t *locus;
tree block = abstract_origin;
locus = &BLOCK_SOURCE_LOCATION (block);
fndecl = NULL;
block = BLOCK_SUPERCONTEXT (block);
while (block && TREE_CODE (block) == BLOCK
&& BLOCK_ABSTRACT_ORIGIN (block))
{
ao = BLOCK_ABSTRACT_ORIGIN (block);
while (TREE_CODE (ao) == BLOCK
&& BLOCK_ABSTRACT_ORIGIN (ao)
&& BLOCK_ABSTRACT_ORIGIN (ao) != ao)
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
ao = BLOCK_ABSTRACT_ORIGIN (ao);
if (TREE_CODE (ao) == FUNCTION_DECL)
{
fndecl = ao;
break;
}
else if (TREE_CODE (ao) != BLOCK)
break;
block = BLOCK_SUPERCONTEXT (block);
}
if (fndecl)
abstract_origin = block;
else
{
while (block && TREE_CODE (block) == BLOCK)
block = BLOCK_SUPERCONTEXT (block);
if (block && TREE_CODE (block) == FUNCTION_DECL)
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
fndecl = block;
abstract_origin = NULL;
}
if (fndecl)
{
expanded_location s = expand_location (*locus);
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_character (context->printer, ',');
pp_newline (context->printer);
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
if (s.file != NULL)
{
if (context->show_column && s.column != 0)
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
pp_printf (context->printer,
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
_(" inlined from %qs at %r%s:%d:%d%R"),
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
cxx_printable_name_translate (fndecl, 2),
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
"locus", s.file, s.line, s.column);
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
else
pp_printf (context->printer,
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
_(" inlined from %qs at %r%s:%d%R"),
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
cxx_printable_name_translate (fndecl, 2),
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
"locus", s.file, s.line);
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
}
else
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
pp_printf (context->printer, _(" inlined from %qs"),
pretty-print.h (struct pretty_print_info): Add translate_identifiers. * pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
2009-05-10 12:28:34 +02:00
cxx_printable_name_translate (fndecl, 2));
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
}
}
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_character (context->printer, ':');
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
}
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_newline (context->printer);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
diagnostic_set_last_function (context, diagnostic);
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_destroy_prefix (context->printer);
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
context->printer->prefix = old_prefix;
}
}
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
/* Returns a description of FUNCTION using standard terminology. The
result is a format string of the form "In CATEGORY %qs". */
static const char *
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
function_category (tree fn)
{
re PR c/40401 (ICE: verify_gimple failed) 2009-07-17 Richard Guenther <rguenther@suse.de> PR c/40401 * tree-pass.h (pass_diagnose_omp_blocks): Declare. (pass_warn_unused_result): Likewise. (TODO_set_props): Remove. * omp-low.c (diagnose_omp_structured_block_errors): Change to run as a pass. (pass_diagnose_omp_blocks): Define. * c-decl.c (pop_file_scope): Do not finalize the CU here. (c_gimple_diagnostics_recursively): Remove. (finish_function): Do not call it. (c_write_global_declarations): Continue after errors. Finalize the CU here. * c-gimplify.c (c_genericize): Do not gimplify here. * c-common.c (c_warn_unused_result): Move ... * tree-cfg.c (do_warn_unused_result): ... here. (run_warn_unused_result): New function. (gate_warn_unused_result): New function. (pass_warn_unused_result): New pass. * c-common.h (c_warn_unused_result): Remove. * flags.h (flag_warn_unused_result): Declare. * c-opts.c (c_common_init_options): Enable flag_warn_unused_result. * opts.c (flag_warn_unused_result): Initialize to false. * toplev.c (compile_file): Add comment. * omp-low.c (create_omp_child_function): Do not register the function with the frontend. (diagnose_omp_structured_block_errors): Prepare to be called as optimization pass. (gate_diagnose_omp_blocks): New function. (pass_diagnose_omp_blocks): New pass. * cgraph.h (cgraph_optimize): Remove. (cgraph_analyze_function): Likewise. * cgraph.c (cgraph_add_new_function): Gimplify C++ thunks. * cgraphunit.c (cgraph_lower_function): Lower nested functions before their parents here. (cgraph_finalize_function): Not here. (cgraph_analyze_function): Gimplify functions here. (cgraph_finalize_compilation_unit): Continue after errors. Optimize the callgraph from here. (cgraph_optimize): Make static. * langhooks.c (write_global_declarations): Finalize the CU. * gimplify.c (gimplify_asm_expr): Do not emit ASMs with errors. (gimplify_function_tree): Assert we gimplify only once. Set PROP_gimple_any property. * tree-nested.c (gimplify_all_functions): New function. (lower_nested_functions): Gimplify all nested functions. * gimple.h (diagnose_omp_structured_block_errors): Remove. * passes.c (init_optimization_passes): Add pass_warn_unused_result and pass_diagnose_omp_blocks after gimplification. Do not set TODO_set_props on all_lowering_passes. (execute_one_pass): Do not handle TODO_set_props. * Makefile.in (cgraphunit.o): Add $(TREE_DUMP_H) dependency. (gimplify.o): Add tree-pass.h dependency. * tree-inline.c (copy_statement_list): Properly copy STATEMENT_LIST. (copy_tree_body_r): Properly handle TARGET_EXPR like SAVE_EXPR. (unsave_r): Likewise. * c-omp.c (c_finish_omp_atomic): Set DECL_CONTEXT on the temporary variable. cp/ * decl.c (finish_function): Do not emit unused result warnings from here. * cp-objcp-common.h (LANG_HOOKS_POST_GIMPLIFY_PASS): Use c_warn_unused_result_pass. * semantics.c (expand_or_defer_fn): Adjust assertion about IL status. * optimize.c (clone_body): Clone in GENERIC. (maybe_clone_body): Do not clear DECL_SAVED_TREE. * decl2.c (cp_write_global_declarations): Fix body test. Do not call cgraph_optimize. * Make-lang.in (optimize.o): Add tree-iterator.h dependency. * method.c (use_thunk): Register thunk with cgraph_finalize_function. * error.c (function_category): Guard access of DECL_LANG_SPECIFIC. java/ * java-gimplify.c (java_genericize): Do not gimplify here. But replace all local references. (java_gimplify_expr): Do not replace local references here. (java_gimplify_modify_expr): Likewise. * jcf-parse.c (java_parse_file): Do not finalize the CU or optimize the cgraph here. * decl.c (java_replace_reference): Make static. (java_replace_references): New function. (end_java_method): Clear base_decl_map. * java-tree.h (java_replace_references): Declare. (java_replace_reference): Remove. ada/ * utils.c (end_subprog_body): Revert to pre-tuples state. Remove unused parameter. (gnat_gimplify_function): Do not gimplify here. Fold into its only caller and remove. (gnat_builtin_function): Adjust for end_subprog_body signature change. (gnat_write_global_declarations): Also finalize the CU. * misc.c (gnat_parse_file): Do not finalize the CU here. * trans.c (gigi): Revert to pre-tuples state. (Subprogram_Body_to_gnu): Adjust for end_subprog_body signature change. * gigi.h (end_subprog_body): Remove unused parameter. fortran/ * f95-lang.c (gfc_be_parse_file): Do not finalize the CU here. * trans-decl.c (gfc_gimplify_function): Remove. (build_entry_thunks): Do not gimplify here. (create_main_function): Likewise. (gfc_generate_function_code): Likewise. * g++.dg/rtti/crash4.C: New testcase. * g++.dg/torture/20090706-1.C: Likewise. * gcc.dg/redecl-17.c: Likewise. * gfortran.dg/missing_optional_dummy_5.f90: Adjust pattern. * gcc.dg/declspec-9.c: Expect extra error. * gcc.dg/declspec-10.c: Likewise. * gcc.dg/declspec-11.c: Likewise. * gcc.dg/redecl-10.c: Expect extra warnings. * gcc.target/i386/pr39082-1.c: Adjust diagnostic location. * gcc.target/i386/pr39545-1.c: Likewise. * g++.dg/ext/asm3.C: Expect more errors. * g++.dg/gomp/block-1.C: Likewise. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.old-deja/g++.jason/report.C: Expect extra warnings. * g++.dg/warn/unused-result1.C: XFAIL. From-SVN: r149750
2009-07-17 17:49:34 +02:00
/* We can get called from the middle-end for diagnostics of function
clones. Make sure we have language specific information before
dereferencing it. */
if (DECL_LANG_SPECIFIC (STRIP_TEMPLATE (fn))
&& DECL_FUNCTION_MEMBER_P (fn))
{
if (DECL_STATIC_FUNCTION_P (fn))
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
return _("In static member function %qs");
else if (DECL_COPY_CONSTRUCTOR_P (fn))
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
return _("In copy constructor %qs");
else if (DECL_CONSTRUCTOR_P (fn))
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
return _("In constructor %qs");
else if (DECL_DESTRUCTOR_P (fn))
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
return _("In destructor %qs");
else if (LAMBDA_FUNCTION_P (fn))
return _("In lambda function");
else
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
return _("In member function %qs");
}
else
c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. * c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string. Mark "({anonymous})" for translation. * c-pretty-print.c (pp_c_ws_string): New. (pp_c_cv_qualifier, pp_c_type_specifier, pp_c_specifier_qualifier_list, pp_c_parameter_type_list, pp_c_storage_class_specifier, pp_c_function_specifier, pp_c_attributes, pp_c_bool_constant, pp_c_constant, pp_c_primary_expression, pp_c_postfix_expression, pp_c_unary_expression, pp_c_shift_expression, pp_c_relational_expression, pp_c_equality_expression, pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly use pp_string and pp_c_ws_string in place of pp_identifier and pp_c_identifier for non-identifiers. Mark English strings for translation. * c-pretty-print.h (pp_c_ws_string): Declare. cp: * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression, pp_cxx_new_expression, pp_cxx_delete_expression, pp_cxx_unary_expression, pp_cxx_assignment_operator, pp_cxx_assignment_expression, pp_cxx_expression, pp_cxx_function_specifier, pp_cxx_decl_specifier_seq, pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq, pp_cxx_exception_specification, pp_cxx_direct_declarator, pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement, pp_cxx_namespace_alias_definition, pp_cxx_template_parameter, pp_cxx_canonical_template_parameter, pp_cxx_template_declaration, pp_cxx_declaration, pp_cxx_typeid_expression, pp_cxx_va_arg_expression, pp_cxx_offsetof_expression, pp_cxx_trait_expression): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. * cxx-pretty-print.h (pp_cxx_ws_string): Define. * error.c (dump_template_parameter, dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl, dump_decl, dump_template_decl, dump_function_decl, dump_parameters, dump_exception_spec, dump_template_parms, dump_expr, dump_binary_op, dump_unary_op, op_to_string, assop_to_string, args_to_string, cp_print_error_function, print_instantiation_full_context, print_instantiation_partial_context): Mostly use pp_string and pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier for non-identifiers. Mark English strings for translation. (dump_global_iord): Mark strings for translation; use longer strings instead of substituting single words. (function_category): Return a format string marked for translation, not a single word or phrase to substitute in a longer phrase. From-SVN: r147033
2009-05-01 16:09:20 +02:00
return _("In function %qs");
}
/* Report the full context of a current template instantiation,
onto BUFFER. */
static void
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
print_instantiation_full_context (diagnostic_context *context)
{
decl.c (cp_tree_node_structure): Kill TINST_LEVEL case. 2007-08-25 Paolo Bonzini <bonzini@gnu.org> * decl.c (cp_tree_node_structure): Kill TINST_LEVEL case. * cp-objcp-common.c (cp_tree_size): Ditto. * tree.c (cp_walk_subtrees): Ditto * cp-tree.def (TINST_LEVEL): Go away. * cp-tree.h (struct tinst_level_s): Rename to struct tinst_level, move together with other non-tree structs. (enum cp_tree_node_structure_enum): Nuke TS_CP_TINST_LEVEL. (union lang_tree_node): Eliminate tinst_level field. (TINST_DECL, TINST_LOCATION, TINST_IN_SYSTEM_HEADER_P): Annihilate. (current_instantiation, outermost_tinst_level): Return a "struct tinst_level *". * error.c (print_instantiation_partial_context): Change second parameter to a "struct tinst_level *". Replace accessor macros with field access. (print_instantiation_full_context): Likewise. * lex.c (in_main_input_context): Likewise. * pt.c (struct pending_templates): New. (pending_templates, last_pending_template): Use it as a type. (current_tinst_level): Change typo to "struct tinst_level *" (reopen_tinst_level): Accept "struct tinst_level *", return decl. (add_pending_template): Construct a "struct pending_template". Replace TINST_LEVEL accessor macros with field access. (push_tinst_level): Likewise, using GGC_NEW instead of make_node. (pop_tinst_level): Likewise. (instantiate_pending_templates): Likewise. Factor common code used when an instantiation has been done. (outermost_tinst_level): Replace tree_last with loop. (current_instantiation): Return a "struct tinst_level *". From-SVN: r127796
2007-08-25 09:36:35 +02:00
struct tinst_level *p = current_instantiation ();
location_t location = input_location;
if (p)
{
pp_verbatim (context->printer,
TREE_CODE (p->decl) == TREE_LIST
? _("%s: In substitution of %qS:\n")
: _("%s: In instantiation of %q#D:\n"),
LOCATION_FILE (location),
p->decl);
location = p->locus;
p = p->next;
}
print_instantiation_partial_context (context, p, location);
}
/* Helper function of print_instantiation_partial_context() that
prints a single line of instantiation context. */
static void
print_instantiation_partial_context_line (diagnostic_context *context,
const struct tinst_level *t,
location_t loc, bool recursive_p)
{
if (loc == UNKNOWN_LOCATION)
return;
expanded_location xloc = expand_location (loc);
if (context->show_column)
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
pp_verbatim (context->printer, _("%r%s:%d:%d:%R "),
"locus", xloc.file, xloc.line, xloc.column);
else
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
pp_verbatim (context->printer, _("%r%s:%d:%R "),
"locus", xloc.file, xloc.line);
if (t != NULL)
{
if (TREE_CODE (t->decl) == TREE_LIST)
pp_verbatim (context->printer,
recursive_p
? _("recursively required by substitution of %qS\n")
: _("required by substitution of %qS\n"),
t->decl);
else
pp_verbatim (context->printer,
recursive_p
? _("recursively required from %q#D\n")
: _("required from %q#D\n"),
t->decl);
}
else
{
pp_verbatim (context->printer,
recursive_p
PR other/69006: fix extra newlines after diagnostics gcc/c-family/ChangeLog: PR other/69006 * c-opts.c (c_diagnostic_finalizer): Replace invocation of pp_newline_and_flush with pp_flush. gcc/cp/ChangeLog: PR other/69006 * error.c (print_instantiation_partial_context_line): Add missing newlines from output for the t == NULL case. (print_instantiation_partial_context): Remove call to pp_newline. gcc/ChangeLog: PR other/69006 * diagnostic-show-locus.c (layout::print_source_line): Replace call to pp_newline with call to layout::print_newline. (layout::print_annotation_line): Likewise. (layout::move_to_column): Likewise. (layout::print_any_fixits): After printing any fixits, print a trailing newline, if necessary. (layout::print_newline): New method, resetting any colorization before a newline. (diagnostic_show_locus): Move the pp_newline to before the early bailout. Remove dummy block enclosing the layout instance. * diagnostic.c (default_diagnostic_finalizer): Replace invocation of pp_newline_and_flush with pp_flush. (diagnostic_append_note): Delete use of pp_newline. (diagnostic_append_note_at_rich_loc): Delete. * diagnostic.h (diagnostic_append_note_at_rich_loc): Delete. * pretty-print.h (output_buffer_append_r): Reset buff->line_length when newline characters are added to the buffer. gcc/fortran/ChangeLog: PR other/69006 * error.c (gfc_diagnostic_starter): Delete use of pp_newline. gcc/testsuite/ChangeLog: PR other/69006 * g++.dg/ext/timevar1.C: Add dg-allow-blank-lines-in-output directive. * gcc.dg/plugin/diagnostic-test-show-locus-color.c: Update expected multiline output to reflect the colorization being disabled before newlines. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (custom_diagnostic_finalizer): Replace call to pp_newline_and_flush with call to pp_flush. * gcc.dg/unroll-2.c: Add dg-allow-blank-lines-in-output directive. * gfortran.dg/implicit_class_1.f90: Likewise. * lib/gcc-dg.exp (allow_blank_lines): New global. (dg-allow-blank-lines-in-output): New procedure. (gcc-dg-prune): Complain about blank lines in the output, unless dg-allow-blank-lines-in-output was called. * lib/multiline.exp (_build_multiline_regex): Only support arbitrary followup text for non-blank-lines, not for blank lines. From-SVN: r232837
2016-01-26 18:08:12 +01:00
? _("recursively required from here\n")
: _("required from here\n"));
}
}
/* Same as print_instantiation_full_context but less verbose. */
static void
print_instantiation_partial_context (diagnostic_context *context,
struct tinst_level *t0, location_t loc)
{
struct tinst_level *t;
int n_total = 0;
int n;
location_t prev_loc = loc;
for (t = t0; t != NULL; t = t->next)
if (prev_loc != t->locus)
{
prev_loc = t->locus;
n_total++;
}
t = t0;
if (template_backtrace_limit
&& n_total > template_backtrace_limit)
{
int skip = n_total - template_backtrace_limit;
int head = template_backtrace_limit / 2;
/* Avoid skipping just 1. If so, skip 2. */
if (skip == 1)
{
skip = 2;
head = (template_backtrace_limit - 1) / 2;
}
for (n = 0; n < head; n++)
{
gcc_assert (t != NULL);
if (loc != t->locus)
print_instantiation_partial_context_line (context, t, loc,
/*recursive_p=*/false);
loc = t->locus;
t = t->next;
}
if (t != NULL && skip > 0)
{
expanded_location xloc;
xloc = expand_location (loc);
if (context->show_column)
pp_verbatim (context->printer,
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
_("%r%s:%d:%d:%R [ skipping %d instantiation "
"contexts, use -ftemplate-backtrace-limit=0 to "
"disable ]\n"),
"locus", xloc.file, xloc.line, xloc.column, skip);
else
pp_verbatim (context->printer,
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
_("%r%s:%d:%R [ skipping %d instantiation "
"contexts, use -ftemplate-backtrace-limit=0 to "
"disable ]\n"),
"locus", xloc.file, xloc.line, skip);
do {
loc = t->locus;
t = t->next;
} while (t != NULL && --skip > 0);
}
}
while (t != NULL)
{
while (t->next != NULL && t->locus == t->next->locus)
{
loc = t->locus;
t = t->next;
}
print_instantiation_partial_context_line (context, t, loc,
t->locus == loc);
decl.c (cp_tree_node_structure): Kill TINST_LEVEL case. 2007-08-25 Paolo Bonzini <bonzini@gnu.org> * decl.c (cp_tree_node_structure): Kill TINST_LEVEL case. * cp-objcp-common.c (cp_tree_size): Ditto. * tree.c (cp_walk_subtrees): Ditto * cp-tree.def (TINST_LEVEL): Go away. * cp-tree.h (struct tinst_level_s): Rename to struct tinst_level, move together with other non-tree structs. (enum cp_tree_node_structure_enum): Nuke TS_CP_TINST_LEVEL. (union lang_tree_node): Eliminate tinst_level field. (TINST_DECL, TINST_LOCATION, TINST_IN_SYSTEM_HEADER_P): Annihilate. (current_instantiation, outermost_tinst_level): Return a "struct tinst_level *". * error.c (print_instantiation_partial_context): Change second parameter to a "struct tinst_level *". Replace accessor macros with field access. (print_instantiation_full_context): Likewise. * lex.c (in_main_input_context): Likewise. * pt.c (struct pending_templates): New. (pending_templates, last_pending_template): Use it as a type. (current_tinst_level): Change typo to "struct tinst_level *" (reopen_tinst_level): Accept "struct tinst_level *", return decl. (add_pending_template): Construct a "struct pending_template". Replace TINST_LEVEL accessor macros with field access. (push_tinst_level): Likewise, using GGC_NEW instead of make_node. (pop_tinst_level): Likewise. (instantiate_pending_templates): Likewise. Factor common code used when an instantiation has been done. (outermost_tinst_level): Replace tree_last with loop. (current_instantiation): Return a "struct tinst_level *". From-SVN: r127796
2007-08-25 09:36:35 +02:00
loc = t->locus;
t = t->next;
}
print_instantiation_partial_context_line (context, NULL, loc,
/*recursive_p=*/false);
}
/* Called from cp_thing to print the template context for an error. */
static void
error.c (init_error): Use C90 prototype style. * error.c (init_error): Use C90 prototype style. (dump_scope): Likewise. (dump_qualifiers): Likewise. (dump_template_argument): Likewise. (dump_template_argument_list): Likewise. (dump_template_parameter): Likewise. (dump_template_bindings): Likewise. (dump_type): Likewise. (dump_typename): Likewise. (class_key_or_enum): Likewise. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_simple_decl): Likewise. (dump_decl): Likewise. (dump_template_decl): Likewise. (dump_function_decl): Likewise. (dump_parameters): Likewise. (dump_exception_spec): Likewise. (dump_function_name): Likewise. (dump_template_parms): Likewise. (dump_char): Likewise. (dump_expr_list): Likewise. (dump_expr): Likewise. (dump_binary_op): Likewise. (dump_unary_op): Likewise. (type_as_string): Likewise. (expr_as_string): Likewise. (decl_as_string): Likewise. (context_as_string): Likewise. (lang_decl_name): Likewise. (cp_file_of): Likewise. (cp_line_of): Likewise. (decl_to_string): Likewise. (expr_to_string): Likewise. (fndecl_to_string): Likewise. (code_to_string): Likewise. (language_to_string): Likewise. (parm_to_string): Likewise. (op_to_string): Likewise. (type_to_string): Likewise. (assop_to_string): Likewise. (args_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (function_category): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. (print_integer): Likewise. (print_non_consecutive_character): Likewise. (locate_error): Likewise. From-SVN: r63928
2003-03-07 07:46:56 +01:00
maybe_print_instantiation_context (diagnostic_context *context)
{
if (!problematic_instantiation_changed () || current_instantiation () == 0)
return;
record_last_problematic_instantiation ();
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
print_instantiation_full_context (context);
}
/* Report what constexpr call(s) we're trying to expand, if any. */
void
maybe_print_constexpr_context (diagnostic_context *context)
{
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree> call_stack = cx_error_context ();
unsigned ix;
tree t;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
FOR_EACH_VEC_ELT (call_stack, ix, t)
{
expanded_location xloc = expand_location (EXPR_LOCATION (t));
const char *s = expr_as_string (t, 0);
if (context->show_column)
pp_verbatim (context->printer,
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
_("%r%s:%d:%d:%R in constexpr expansion of %qs"),
"locus", xloc.file, xloc.line, xloc.column, s);
else
pp_verbatim (context->printer,
opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841
2013-04-12 08:19:58 +02:00
_("%r%s:%d:%R in constexpr expansion of %qs"),
"locus", xloc.file, xloc.line, s);
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_newline (context->printer);
}
}
/* Called from output_format -- during diagnostic message processing --
to handle C++ specific format specifier with the following meanings:
%A function argument-list.
top level: * errors.h (warning, error, fatal, internal_error): Don't mark with ATTRIBUTE_PRINTF_n. * toplev.h (internal_error, fatal_io_error, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, error_for_asm, warning_for_asm): Likewise. cp: * Make-lang.in (CXX_OBJS): Take out cp/errfn.o. (cp/errfn.o): Delete rule. (cp/error.o): Depend on flags.h. * errfn.c: Delete file. * cp-tree.h: Declare warn_deprecated. Remove definitions of TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning, cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and internal_error respectively. Make cp_deprecated into a macro. Don't define cp_printer typedef or declare cp_printers. * error.c: Include flags.h. Delete: struct tree_formatting_info, print_function_argument_list, print_declaration, print_expression, print_function_declaration, print_function_parameter, print_type_id, print_cv_qualifier_seq, print_type_specifier_seq, print_simple_type_specifier, print_elaborated_type_specifier, print_rest_of_abstract_declarator, print_parameter_declaration_clause, print_exception_specification, print_nested_name_specifier, and definition of cp_printers. (locate_error): New function. (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and rewritten in terms of locate_error and diagnostic.c. (cp_tree_printer): Rename cp_printer; wire up to *_to_string instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. po: * POTFILES.in: Remove cp/errfn.c. From-SVN: r45765
2001-09-24 02:27:33 +02:00
%C tree code.
%D declaration.
%E expression.
%F function declaration.
top level: * errors.h (warning, error, fatal, internal_error): Don't mark with ATTRIBUTE_PRINTF_n. * toplev.h (internal_error, fatal_io_error, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, error_for_asm, warning_for_asm): Likewise. cp: * Make-lang.in (CXX_OBJS): Take out cp/errfn.o. (cp/errfn.o): Delete rule. (cp/error.o): Depend on flags.h. * errfn.c: Delete file. * cp-tree.h: Declare warn_deprecated. Remove definitions of TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning, cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and internal_error respectively. Make cp_deprecated into a macro. Don't define cp_printer typedef or declare cp_printers. * error.c: Include flags.h. Delete: struct tree_formatting_info, print_function_argument_list, print_declaration, print_expression, print_function_declaration, print_function_parameter, print_type_id, print_cv_qualifier_seq, print_type_specifier_seq, print_simple_type_specifier, print_elaborated_type_specifier, print_rest_of_abstract_declarator, print_parameter_declaration_clause, print_exception_specification, print_nested_name_specifier, and definition of cp_printers. (locate_error): New function. (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and rewritten in terms of locate_error and diagnostic.c. (cp_tree_printer): Rename cp_printer; wire up to *_to_string instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. po: * POTFILES.in: Remove cp/errfn.c. From-SVN: r45765
2001-09-24 02:27:33 +02:00
%L language as used in extern "lang".
%O binary operator.
%P function parameter whose position is indicated by an integer.
top level: * errors.h (warning, error, fatal, internal_error): Don't mark with ATTRIBUTE_PRINTF_n. * toplev.h (internal_error, fatal_io_error, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, error_for_asm, warning_for_asm): Likewise. cp: * Make-lang.in (CXX_OBJS): Take out cp/errfn.o. (cp/errfn.o): Delete rule. (cp/error.o): Depend on flags.h. * errfn.c: Delete file. * cp-tree.h: Declare warn_deprecated. Remove definitions of TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning, cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and internal_error respectively. Make cp_deprecated into a macro. Don't define cp_printer typedef or declare cp_printers. * error.c: Include flags.h. Delete: struct tree_formatting_info, print_function_argument_list, print_declaration, print_expression, print_function_declaration, print_function_parameter, print_type_id, print_cv_qualifier_seq, print_type_specifier_seq, print_simple_type_specifier, print_elaborated_type_specifier, print_rest_of_abstract_declarator, print_parameter_declaration_clause, print_exception_specification, print_nested_name_specifier, and definition of cp_printers. (locate_error): New function. (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and rewritten in terms of locate_error and diagnostic.c. (cp_tree_printer): Rename cp_printer; wire up to *_to_string instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. po: * POTFILES.in: Remove cp/errfn.c. From-SVN: r45765
2001-09-24 02:27:33 +02:00
%Q assignment operator.
%S substitution (template + args)
%T type.
%V cv-qualifier.
%X exception-specification. */
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
static bool
pretty-print.h (PP_NL_ARGMAX): New. gcc: * pretty-print.h (PP_NL_ARGMAX): New. (text_info): Add locus. (struct chunk_info): New. (output_buffer): Add formatted_obstack, chunk_obstack, and cur_chunk_array. Change obstack to a pointer. (pp_wrapping_mode_t, pp_wrapping_mode, pp_set_verbatim_wrapping): New. (struct pretty_print_info): Replace ideal_maximum_length and prefixing_rule with wrapping. (pp_line_cutoff, pp_prefixing_rule): Update to match. Update prototypes and wrapper macros throughout. * pretty-print.c (pp_formatted_text_data, pp_append_r) (pp_base_clear_output_area, pp_construct, pp_base_formatted_text) (pp_base_last_position_in_text, pp_base_newline, pp_base_character): Update for changes to pp structure. (pp_base_prepare_to_format, pp_base_format_text): Delete. (pp_base_format, pp_base_output_formatted_text): New functions. (pp_base_format_verbatim): Use pp_set_verbatim_wrapping. (pp_verbatim): Clear text.locus. (pp_printf): Likewise. Use pp_format and pp_output_formatted_text. * c-objc-common.c (c_tree_printer): Update function signature. * diagnostic.c (diagnostic_initialize): Update for changes to pp structure. (diagnostic_report_diagnostic): Call pp_format and then pp_output_formatted_text. (verbatim): Clear text.locus. * diagnostic.h (diagnostic_prefixing_rule, diagnostic_line_cutoff): Update for changes to pp structure. * c-lang.c: No need to include c-pretty-print.h. * Makefile.in: Remove bogus line containing only a tab. (c-lang.o): Update dependencies. * toplev.c (announce_function): Don't use verbatim. (default_tree_printer): Update signature. * objc/objc-lang.c: No need to include c-pretty-print.h. * objc/Make-lang.in: Update dependencies. gcc/cp: * cp-lang.c: No need to include cxx-pretty-print.h. * error.c (cp_printer): Update signature. No need to process flags. (print_instantiation_partial_context): Output last newline with pp_base_newline. * Make-lang.in: Update dependencies. gcc/objcp: * objcp-lang.c: No need to include cxx-pretty-print.h. * Make-lang.in: Update dependencies. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r101481
2005-07-01 01:09:06 +02:00
cp_printer (pretty_printer *pp, text_info *text, const char *spec,
int precision, bool wide, bool set_locus, bool verbose)
{
top level: * errors.h (warning, error, fatal, internal_error): Don't mark with ATTRIBUTE_PRINTF_n. * toplev.h (internal_error, fatal_io_error, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, error_for_asm, warning_for_asm): Likewise. cp: * Make-lang.in (CXX_OBJS): Take out cp/errfn.o. (cp/errfn.o): Delete rule. (cp/error.o): Depend on flags.h. * errfn.c: Delete file. * cp-tree.h: Declare warn_deprecated. Remove definitions of TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning, cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and internal_error respectively. Make cp_deprecated into a macro. Don't define cp_printer typedef or declare cp_printers. * error.c: Include flags.h. Delete: struct tree_formatting_info, print_function_argument_list, print_declaration, print_expression, print_function_declaration, print_function_parameter, print_type_id, print_cv_qualifier_seq, print_type_specifier_seq, print_simple_type_specifier, print_elaborated_type_specifier, print_rest_of_abstract_declarator, print_parameter_declaration_clause, print_exception_specification, print_nested_name_specifier, and definition of cp_printers. (locate_error): New function. (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and rewritten in terms of locate_error and diagnostic.c. (cp_tree_printer): Rename cp_printer; wire up to *_to_string instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. po: * POTFILES.in: Remove cp/errfn.c. From-SVN: r45765
2001-09-24 02:27:33 +02:00
const char *result;
pretty-print.h (PP_NL_ARGMAX): New. gcc: * pretty-print.h (PP_NL_ARGMAX): New. (text_info): Add locus. (struct chunk_info): New. (output_buffer): Add formatted_obstack, chunk_obstack, and cur_chunk_array. Change obstack to a pointer. (pp_wrapping_mode_t, pp_wrapping_mode, pp_set_verbatim_wrapping): New. (struct pretty_print_info): Replace ideal_maximum_length and prefixing_rule with wrapping. (pp_line_cutoff, pp_prefixing_rule): Update to match. Update prototypes and wrapper macros throughout. * pretty-print.c (pp_formatted_text_data, pp_append_r) (pp_base_clear_output_area, pp_construct, pp_base_formatted_text) (pp_base_last_position_in_text, pp_base_newline, pp_base_character): Update for changes to pp structure. (pp_base_prepare_to_format, pp_base_format_text): Delete. (pp_base_format, pp_base_output_formatted_text): New functions. (pp_base_format_verbatim): Use pp_set_verbatim_wrapping. (pp_verbatim): Clear text.locus. (pp_printf): Likewise. Use pp_format and pp_output_formatted_text. * c-objc-common.c (c_tree_printer): Update function signature. * diagnostic.c (diagnostic_initialize): Update for changes to pp structure. (diagnostic_report_diagnostic): Call pp_format and then pp_output_formatted_text. (verbatim): Clear text.locus. * diagnostic.h (diagnostic_prefixing_rule, diagnostic_line_cutoff): Update for changes to pp structure. * c-lang.c: No need to include c-pretty-print.h. * Makefile.in: Remove bogus line containing only a tab. (c-lang.o): Update dependencies. * toplev.c (announce_function): Don't use verbatim. (default_tree_printer): Update signature. * objc/objc-lang.c: No need to include c-pretty-print.h. * objc/Make-lang.in: Update dependencies. gcc/cp: * cp-lang.c: No need to include cxx-pretty-print.h. * error.c (cp_printer): Update signature. No need to process flags. (print_instantiation_partial_context): Output last newline with pp_base_newline. * Make-lang.in: Update dependencies. gcc/objcp: * objcp-lang.c: No need to include cxx-pretty-print.h. * Make-lang.in: Update dependencies. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r101481
2005-07-01 01:09:06 +02:00
tree t = NULL;
#define next_tree (t = va_arg (*text->args_ptr, tree))
#define next_tcode ((enum tree_code) va_arg (*text->args_ptr, int))
#define next_lang ((enum languages) va_arg (*text->args_ptr, int))
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
#define next_int va_arg (*text->args_ptr, int)
pretty-print.h (PP_NL_ARGMAX): New. gcc: * pretty-print.h (PP_NL_ARGMAX): New. (text_info): Add locus. (struct chunk_info): New. (output_buffer): Add formatted_obstack, chunk_obstack, and cur_chunk_array. Change obstack to a pointer. (pp_wrapping_mode_t, pp_wrapping_mode, pp_set_verbatim_wrapping): New. (struct pretty_print_info): Replace ideal_maximum_length and prefixing_rule with wrapping. (pp_line_cutoff, pp_prefixing_rule): Update to match. Update prototypes and wrapper macros throughout. * pretty-print.c (pp_formatted_text_data, pp_append_r) (pp_base_clear_output_area, pp_construct, pp_base_formatted_text) (pp_base_last_position_in_text, pp_base_newline, pp_base_character): Update for changes to pp structure. (pp_base_prepare_to_format, pp_base_format_text): Delete. (pp_base_format, pp_base_output_formatted_text): New functions. (pp_base_format_verbatim): Use pp_set_verbatim_wrapping. (pp_verbatim): Clear text.locus. (pp_printf): Likewise. Use pp_format and pp_output_formatted_text. * c-objc-common.c (c_tree_printer): Update function signature. * diagnostic.c (diagnostic_initialize): Update for changes to pp structure. (diagnostic_report_diagnostic): Call pp_format and then pp_output_formatted_text. (verbatim): Clear text.locus. * diagnostic.h (diagnostic_prefixing_rule, diagnostic_line_cutoff): Update for changes to pp structure. * c-lang.c: No need to include c-pretty-print.h. * Makefile.in: Remove bogus line containing only a tab. (c-lang.o): Update dependencies. * toplev.c (announce_function): Don't use verbatim. (default_tree_printer): Update signature. * objc/objc-lang.c: No need to include c-pretty-print.h. * objc/Make-lang.in: Update dependencies. gcc/cp: * cp-lang.c: No need to include cxx-pretty-print.h. * error.c (cp_printer): Update signature. No need to process flags. (print_instantiation_partial_context): Output last newline with pp_base_newline. * Make-lang.in: Update dependencies. gcc/objcp: * objcp-lang.c: No need to include cxx-pretty-print.h. * Make-lang.in: Update dependencies. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r101481
2005-07-01 01:09:06 +02:00
if (precision != 0 || wide)
return false;
switch (*spec)
{
top level: * errors.h (warning, error, fatal, internal_error): Don't mark with ATTRIBUTE_PRINTF_n. * toplev.h (internal_error, fatal_io_error, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, error_for_asm, warning_for_asm): Likewise. cp: * Make-lang.in (CXX_OBJS): Take out cp/errfn.o. (cp/errfn.o): Delete rule. (cp/error.o): Depend on flags.h. * errfn.c: Delete file. * cp-tree.h: Declare warn_deprecated. Remove definitions of TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning, cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and internal_error respectively. Make cp_deprecated into a macro. Don't define cp_printer typedef or declare cp_printers. * error.c: Include flags.h. Delete: struct tree_formatting_info, print_function_argument_list, print_declaration, print_expression, print_function_declaration, print_function_parameter, print_type_id, print_cv_qualifier_seq, print_type_specifier_seq, print_simple_type_specifier, print_elaborated_type_specifier, print_rest_of_abstract_declarator, print_parameter_declaration_clause, print_exception_specification, print_nested_name_specifier, and definition of cp_printers. (locate_error): New function. (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and rewritten in terms of locate_error and diagnostic.c. (cp_tree_printer): Rename cp_printer; wire up to *_to_string instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. po: * POTFILES.in: Remove cp/errfn.c. From-SVN: r45765
2001-09-24 02:27:33 +02:00
case 'A': result = args_to_string (next_tree, verbose); break;
case 'C': result = code_to_string (next_tcode); break;
case 'D':
{
tree temp = next_tree;
tree.h (VAR_P): New. * tree.h (VAR_P): New. cp/ * call.c (build_java_interface_fn_ref): Likewise. (make_temporary_var_for_ref_to_temp): Likewise. * class.c (check_field_decls): Likewise. (layout_class_type): Likewise. (finish_struct_1): Likewise. (fixed_type_or_null): Likewise. (get_vtbl_decl_for_binfo): Likewise. * cp-gimplify.c (omp_var_to_track): Likewise. (cp_genericize_r): Likewise. * cp-objcp-common.c (cxx_warn_unused_global_decl): Likewise. * cp-tree.h (LANG_DECL_HAS_MIN): Likewise. (DECL_DISCRIMINATOR_P): Likewise. * decl.c (poplevel): Likewise. (decls_match): Likewise. (duplicate_decls): Likewise. (decl_jump_unsafe): Likewise. (start_decl): Likewise. (check_for_uninitialized_const_var): Likewise. (make_rtl_for_nonlocal_decl): Likewise. (cp_finish_decl): Likewise. (expand_static_init): Likewise. (local_variable_p): Likewise. (maybe_register_incomplete_var): Likewise. * decl2.c (grokfield): Likewise. (comdat_linkage): Likewise. (determine_visibility): Likewise. (import_export_decl): Likewise. (prune_vars_needing_no_initialization): Likewise. (decl_maybe_constant_var_p): Likewise. * error.c (dump_simple_decl): Likewise. (dump_template_decl): Likewise. (cp_printer): Likewise. * except.c (build_throw): Likewise. * init.c (build_vtbl_address): Likewise. (member_init_ok_or_else): Likewise. (build_aggr_init): Likewise. (expand_aggr_init_1): Likewise. (build_offset_ref): Likewise. (constant_value_1): Likewise. * mangle.c (write_mangled_name): Likewise. (write_prefix): Likewise. * name-lookup.c (supplement_binding_1): Likewise. (add_decl_to_level): Likewise. (pushdecl_maybe_friend_1): Likewise. (check_for_out_of_scope_variable): Likewise. (validate_nonmember_using_decl): Likewise. (lookup_name_innermost_nonclass_level_1): Likewise. (lookup_arg_dependent_1): Likewise. * parser.c (cp_parser_lambda_introducer): Likewise. (cp_parser_template_argument): Likewise. (cp_parser_single_declaration): Likewise. * pt.c (convert_nontype_argument): Likewise. (instantiate_class_template_1): Likewise. (tsubst_decl): Likewise. (tsubst_expr): Likewise. (do_decl_instantiation): Likewise. (do_type_instantiation): Likewise. (regenerate_decl_from_template): Likewise. (always_instantiate_p): Likewise. (instantiate_decl): Likewise. (type_dependent_expression_p): Likewise. (build_non_dependent_expr): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_dynamic_cast_1): Likewise. * search.c (shared_member_p): Likewise. * semantics.c (outer_var_p): Likewise. (finish_id_expression): Likewise. (finish_omp_clauses): Likewise. (finish_decltype_type): Likewise. (ensure_literal_type_for_constexpr_object): Likewise. * tree.c (lvalue_kind): Likewise. (bot_replace): Likewise. (cp_tree_equal): Likewise. (handle_init_priority_attribute): Likewise. (decl_storage_duration): Likewise. * typeck.c (cxx_sizeof_expr): Likewise. (cxx_alignof_expr): Likewise. (decay_conversion): Likewise. (build_class_member_access_expr): Likewise. (cp_build_array_ref): Likewise. (cxx_mark_addressable): Likewise. (maybe_warn_about_returning_address_of_local): Likewise. (check_return_expr): Likewise. * typeck2.c (cxx_readonly_error): Likewise. (abstract_virtuals_error_sfinae): Likewise. (cxx_incomplete_type_diagnostic): Likewise. From-SVN: r197240
2013-03-29 17:09:35 +01:00
if (VAR_P (temp)
&& DECL_HAS_DEBUG_EXPR_P (temp))
{
temp = DECL_DEBUG_EXPR (temp);
if (!DECL_P (temp))
{
result = expr_to_string (temp);
break;
}
}
result = decl_to_string (temp, verbose);
}
break;
case 'E': result = expr_to_string (next_tree); break;
top level: * errors.h (warning, error, fatal, internal_error): Don't mark with ATTRIBUTE_PRINTF_n. * toplev.h (internal_error, fatal_io_error, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, error_for_asm, warning_for_asm): Likewise. cp: * Make-lang.in (CXX_OBJS): Take out cp/errfn.o. (cp/errfn.o): Delete rule. (cp/error.o): Depend on flags.h. * errfn.c: Delete file. * cp-tree.h: Declare warn_deprecated. Remove definitions of TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning, cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and internal_error respectively. Make cp_deprecated into a macro. Don't define cp_printer typedef or declare cp_printers. * error.c: Include flags.h. Delete: struct tree_formatting_info, print_function_argument_list, print_declaration, print_expression, print_function_declaration, print_function_parameter, print_type_id, print_cv_qualifier_seq, print_type_specifier_seq, print_simple_type_specifier, print_elaborated_type_specifier, print_rest_of_abstract_declarator, print_parameter_declaration_clause, print_exception_specification, print_nested_name_specifier, and definition of cp_printers. (locate_error): New function. (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and rewritten in terms of locate_error and diagnostic.c. (cp_tree_printer): Rename cp_printer; wire up to *_to_string instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. po: * POTFILES.in: Remove cp/errfn.c. From-SVN: r45765
2001-09-24 02:27:33 +02:00
case 'F': result = fndecl_to_string (next_tree, verbose); break;
case 'L': result = language_to_string (next_lang); break;
case 'O': result = op_to_string (next_tcode); break;
case 'P': result = parm_to_string (next_int); break;
case 'Q': result = assop_to_string (next_tcode); break;
case 'S': result = subst_to_string (next_tree); break;
top level: * errors.h (warning, error, fatal, internal_error): Don't mark with ATTRIBUTE_PRINTF_n. * toplev.h (internal_error, fatal_io_error, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, error_for_asm, warning_for_asm): Likewise. cp: * Make-lang.in (CXX_OBJS): Take out cp/errfn.o. (cp/errfn.o): Delete rule. (cp/error.o): Depend on flags.h. * errfn.c: Delete file. * cp-tree.h: Declare warn_deprecated. Remove definitions of TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning, cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and internal_error respectively. Make cp_deprecated into a macro. Don't define cp_printer typedef or declare cp_printers. * error.c: Include flags.h. Delete: struct tree_formatting_info, print_function_argument_list, print_declaration, print_expression, print_function_declaration, print_function_parameter, print_type_id, print_cv_qualifier_seq, print_type_specifier_seq, print_simple_type_specifier, print_elaborated_type_specifier, print_rest_of_abstract_declarator, print_parameter_declaration_clause, print_exception_specification, print_nested_name_specifier, and definition of cp_printers. (locate_error): New function. (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and rewritten in terms of locate_error and diagnostic.c. (cp_tree_printer): Rename cp_printer; wire up to *_to_string instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. po: * POTFILES.in: Remove cp/errfn.c. From-SVN: r45765
2001-09-24 02:27:33 +02:00
case 'T': result = type_to_string (next_tree, verbose); break;
case 'V': result = cv_to_string (next_tree, verbose); break;
case 'X': result = eh_spec_to_string (next_tree, verbose); break;
diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. * diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. (diagnostic_initialize): Initialize x_data not last_function. (diagnostic_report_current_function): Move to tree-diagnostic.c. (default_diagnostic_starter): Call diagnostic_report_current_module not diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize x_data not abstract_origin. (verbatim): Likewise. * diagnostic.h (struct diagnostic_info): Change abstract_origin to x_data. (struct diagnostic_context): Change last_function to x_data. (diagnostic_auxiliary_data): Replace with diagnostic_context_auxiliary_data and diagnostic_info_auxiliary_data. (diagnostic_last_function_changed, diagnostic_set_last_function, diagnostic_report_current_function): Move to tree-diagnostic.h. (print_declaration, dump_generic_node, print_generic_stmt, print_generic_stmt_indented, print_generic_expr, print_generic_decl, debug_c_tree, dump_omp_clauses, print_call_name, debug_generic_expr, debug_generic_stmt, debug_tree_chain, default_tree_printer): Move to tree-pretty-print.h. (debug_gimple_stmt, debug_gimple_seq, print_gimple_seq, print_gimple_stmt, print_gimple_expr, dump_gimple_stmt): Move to gimple-pretty-print.h. * pretty-print.c: Don't include tree.h (pp_base_format): Don't handle %K here. (pp_base_tree_identifier): Move to tree-pretty-print.c. * pretty-print.h (text_info): Change abstract_origin to x_data. (pp_tree_identifier, pp_unsupported_tree, pp_base_tree_identifier): Move to tree-pretty-print.h. * gimple-pretty-print.h, tree-diagnostic.c, tree-diagnostic.h, tree-pretty-print.h: New files. * tree-pretty-print.c: Include tree-pretty-print.h. (percent_K_format): New. Moved from pretty-print.c. (pp_base_tree_identifier): Move from pretty-print.c. * c-objc-common.c: Include tree-pretty-print.h. (c_tree_printer): Handle %K here. * langhooks.c: Include tree-diagnostic.h. (lhd_print_error_function): Use diagnostic_abstract_origin macro. * toplev.c: Include tree-diagnostic.h and tree-pretty-print.h. (default_tree_printer): Handle %K using percent_K_format. (general_init): Use default_tree_diagnostic_starter. * tree.c: Include tree-diagnostic.h and tree-pretty-print.h. (free_lang_data): Use default_tree_diagnostic_starter. * c-pretty-print.c: Include tree-pretty-print.h. * cfgexpand.c: Include tree-pretty-print.h and gimple-pretty-print.h. * cgraphunit.c: Include tree-pretty-print.h and gimple-pretty-print.h. * dwarf2out.c: Include tree-pretty-print.h. * except.c: Include tree-pretty-print.h. * gimple-pretty-print.c: Include tree-pretty-print.h and gimple-pretty-print.h. * gimplify.c: Include tree-pretty-print.h. * graphite-poly.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-cp.c: Include tree-pretty-print.h. * ipa-inline.c: Include gimple-pretty-print.h. * ipa-prop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-pure-const.c: Include gimple-pretty-print.h. * ipa-struct-reorg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-type-escape.c: Include tree-pretty-print.h. * print-rtl.c: Include tree-pretty-print.h. * print-tree.c: Include gimple-pretty-print.h. * sese.c: Include tree-pretty-print.h. * tree-affine.c: Include tree-pretty-print.h. * tree-browser.c: Include tree-pretty-print.h. * tree-call-cdce.c: Include gimple-pretty-print.h. * tree-cfg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-chrec.c: Include tree-pretty-print.h. * tree-data-ref.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-dfa.c: Include tree-pretty-print.h. * tree-if-conv.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-inline.c: Include tree-pretty-print.h. * tree-into-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-nrv.c: Include tree-pretty-print.h. * tree-object-size.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-outof-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-parloops.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-predcom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-scalar-evolution.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-sra.c: Include tree-pretty-print.h. * tree-ssa-address.c: Include tree-pretty-print.h. * tree-ssa-alias.c: Include tree-pretty-print.h. * tree-ssa-ccp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-coalesce.c: Include tree-pretty-print.h. * tree-ssa-copy.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-copyrename.c: Include tree-pretty-print.h. * tree-ssa-dce.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dse.c: Include gimple-pretty-print.h. * tree-ssa-forwprop.c: Include tree-pretty-print.h. * tree-ssa-ifcombine.c: Include tree-pretty-print.h. * tree-ssa-live.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-im.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivcanon.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivopts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-niter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-prefetch.c: Include tree-pretty-print.h. * tree-ssa-math-opts.c: Include gimple-pretty-print.h. * tree-ssa-operands.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-phiprop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-pre.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-propagate.c: Include gimple-pretty-print.h. * tree-ssa-reassoc.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sccvn.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sink.c: Include gimple-pretty-print.h. * tree-ssa-ter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-uninit.c: Include gimple-pretty-print.h. * tree-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-stdarg.c: Include gimple-pretty-print.h. * tree-switch-conversion.c: Include gimple-pretty-print.h. * tree-tailcall.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-data-refs.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop-manip.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-patterns.c: Include gimple-pretty-print.h. * tree-vect-slp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-stmts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vectorizer.c: Include tree-pretty-print.h. * tree-vrp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * value-prof.c: Include tree-pretty-print.h and gimple-pretty-print.h. * var-tracking.c: Include tree-pretty-print.h. * Makefile.in (OBJS-common): Add tree-diagnostic.o. (tree-diagnostic.o): New dependencies. (c-objc-common.o, c-pretty-print.o, langhooks.o, tree.o, tree-inline.o, print-tree.o, stor-layout.o, tree-ssa-uninit.o, tree-ssa.o, tree-into-ssa.o, tree-ssa-ter.o, tree-ssa-coalesce.o, tree-outof-ssa.o, tree-ssa-forwprop.o, tree-ssa-phiprop.o, tree-ssa-ifcombine.o, tree-nrv.o, tree-ssa-copy.o, tree-ssa-propagate.o, tree-ssa-dom.o, tree-ssa-uncprop.o, tree-ssa-live.o, tree-ssa-copyrename.o, tree-ssa-pre.o, tree-ssa-sccvn.o, tree-vrp.o, tree-cfg.o, tree-tailcall.o, tree-ssa-sink.o, tree-if-conv.o, tree-dfa.o, tree-ssa-operands.o, tree-ssa-address.o, tree-ssa-loop-niter.o, tree-ssa-loop-ivcanon.o, tree-ssa-loop-prefetch.o, tree-predcom.o, tree-ssa-loop-ivopts.o, tree-affine.o, tree-ssa-loop-im.o, tree-ssa-math-opts.o, tree-ssa-alias.o, tree-ssa-reassoc.o, gimplify.o, tree-browser.o, tree-chrec.o, tree-scalar-evolution.o, tree-data-ref.o, sese.o, graphite-poly.o, tree-vect-loop.o, tree-vect-loop-manip.o, tree-vect-patterns.o, tree-vect-slp.o, tree-vect-stmts.o, tree-vect-data-refs.o, tree-vectorizer.o, tree-parloops.o, tree-stdarg.o, tree-object-size.o, gimple-pretty-print.o, tree-pretty-print.o, diagnostic.o, toplev.o, print-rtl.o, except.o, dwarf2out.o, cgraphunit.o, ipa-prop.o, ipa-cp.o, ipa-inline.o, ipa-pure-const.o, ipa-type-escape.o, ipa-struct-reorg.o, tree-ssa-dce.o, tree-call-cdce.o, tree-ssa-ccp.o, tree-sra.o, tree-switch-conversion.o, var-tracking.o, value-prof.o, cfgexpand.o, pretty-print.o): Update dependencies. cp: * error.c: Include tree-diagnostic.h and tree-pretty-print.h. (cp_print_error_function): Use diagnostic_abstract_origin macro. (cp_printer): Handle %K here using percent_K_format. * cxx-pretty-print.c: Include tree-pretty-print.h. * Make-lang.in (cp/error.o, cp/cxx-pretty-print.o): Update dependencies. From-SVN: r159685
2010-05-22 00:34:26 +02:00
case 'K':
percent_K_format (text);
return true;
default:
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
return false;
}
pretty-print.h (pp_base): Remove. * pretty-print.h (pp_base): Remove. Adjust dependent macros. * diagnostic.h (diagnostic_flush_buffer): Adjust. * pretty-print.c (pp_formatted_text_data): Likewise. (pp_indent): Rename from pp_base_indent. (pp_format): Rename from pp_base_format. (pp_output_formatted_text): Rename from pp_base_output_formatted_text. (pp_format_verbatim): Rename from pp_base_format_verbatim. (pp_flush): Rename from pp_base_flush. (pp_set_line_maximum_length): Rename from pp_base_set_line_maximum_length. (pp_clear_output_area): Rename from pp_base_clear_output_area. (pp_set_prefix): Rename from pp_base_set_prefix. (pp_destroy_prefix): Rename from pp_base_destroy_prefix. (pp_emit_prefix): Rename from pp_base_emit_prefix. (pp_append_text): Rename from pp_base_append_text. (pp_formatted_text): Rename from pp_base_formatted_text. (pp_last_position_in_text): Rename from pp_base_last_position_in_text. (pp_remaining_character_count_for_line): Rename from pp_base_remaining_character_count_for_line. (pp_newline): Rename from pp_base_newline. (pp_character): Rename from pp_base_character. (pp_string): Rename from pp_base_string. (pp_maybe_space): Rename from pp_base_maybe_space. * asan.c (asan_pp_string): Adjust. (asan_emit_stack_protection): Likewise. (asan_add_global): Likewise. * sched-vis.c (str_pattern_slim): Adjust pretty printer function call. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-pretty-print.c (pp_tree_identifier): Rename from pp_base_tree_identifier. * tree-pretty-print.h (pp_tree_identifier): Remove macro definition. Declare as function. c/ * c-objc-common.c (c_initialize_diagnostics): Don't call pp_base. c-family/ * c-pretty-print.h (c_pretty_printer): Derive from pretty_printer. (pp_base): Remove. (pp_c_base): Likewise. Adjust users. * c-pretty-print.c (pp_c_maybe_whitespace): Adjust. (pp_c_whitespace): Do not call pp_base. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_star): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_complement): Likewise. (pp_c_exclamation): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_ws_string): Likewise. (pp_c_identifier): Likewise. (pp_c_statement): Likewise. (print_c_tree): Likewise. cp/ * cxx-pretty-print.h (pp_c_base): Remove. (cxx_pretty_printer): Derive from c_pretty_printer. Adjust macros using pp_c_base. * cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise. (pp_cxx_colon_colon): Likewise. (pp_cxx_separate_with): Likewise. (pp_cxx_storage_class_specifier): Do not call pp_c_base. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_constant): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_cast_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_expression): Likewise. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Likewise. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): Likewise. (pp_cxx_parameter_declaration_clause): Likewise. (pp_cxx_direct_declarator): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_statement): Likewise. (pp_cxx_pretty_printer_init): Tidy. * error.c (init_error): Do not use pp_base. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_global_iord): Likewise. (dump_decl): Likewise. (dump_function_decl): Likewise. (dump_ref_qualifier): Likewise. (reinit_cxx_pp): Likewise. (decl_as_dwarf_string): Likewise. (lang_decl_dwarf_name): Likewise. (type_to_string): Likewise. (cv_to_string): Likewise. (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (print_instantiation_context): Likewise. (cp_printer): Likewise. From-SVN: r201479
2013-08-05 06:00:57 +02:00
pp_string (pp, result);
pretty-print.h (PP_NL_ARGMAX): New. gcc: * pretty-print.h (PP_NL_ARGMAX): New. (text_info): Add locus. (struct chunk_info): New. (output_buffer): Add formatted_obstack, chunk_obstack, and cur_chunk_array. Change obstack to a pointer. (pp_wrapping_mode_t, pp_wrapping_mode, pp_set_verbatim_wrapping): New. (struct pretty_print_info): Replace ideal_maximum_length and prefixing_rule with wrapping. (pp_line_cutoff, pp_prefixing_rule): Update to match. Update prototypes and wrapper macros throughout. * pretty-print.c (pp_formatted_text_data, pp_append_r) (pp_base_clear_output_area, pp_construct, pp_base_formatted_text) (pp_base_last_position_in_text, pp_base_newline, pp_base_character): Update for changes to pp structure. (pp_base_prepare_to_format, pp_base_format_text): Delete. (pp_base_format, pp_base_output_formatted_text): New functions. (pp_base_format_verbatim): Use pp_set_verbatim_wrapping. (pp_verbatim): Clear text.locus. (pp_printf): Likewise. Use pp_format and pp_output_formatted_text. * c-objc-common.c (c_tree_printer): Update function signature. * diagnostic.c (diagnostic_initialize): Update for changes to pp structure. (diagnostic_report_diagnostic): Call pp_format and then pp_output_formatted_text. (verbatim): Clear text.locus. * diagnostic.h (diagnostic_prefixing_rule, diagnostic_line_cutoff): Update for changes to pp structure. * c-lang.c: No need to include c-pretty-print.h. * Makefile.in: Remove bogus line containing only a tab. (c-lang.o): Update dependencies. * toplev.c (announce_function): Don't use verbatim. (default_tree_printer): Update signature. * objc/objc-lang.c: No need to include c-pretty-print.h. * objc/Make-lang.in: Update dependencies. gcc/cp: * cp-lang.c: No need to include cxx-pretty-print.h. * error.c (cp_printer): Update signature. No need to process flags. (print_instantiation_partial_context): Output last newline with pp_base_newline. * Make-lang.in: Update dependencies. gcc/objcp: * objcp-lang.c: No need to include cxx-pretty-print.h. * Make-lang.in: Update dependencies. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r101481
2005-07-01 01:09:06 +02:00
if (set_locus && t != NULL)
Reimplement diagnostic_show_locus, introducing rich_location classes gcc/ChangeLog: * diagnostic-color.c (color_dict): Eliminate "caret"; add "range1" and "range2". (parse_gcc_colors): Update comment to describe default GCC_COLORS. * diagnostic-core.h (warning_at_rich_loc): New declaration. (error_at_rich_loc): New declaration. (permerror_at_rich_loc): New declaration. (inform_at_rich_loc): New declaration. * diagnostic-show-locus.c (adjust_line): Delete. (struct point_state): New struct. (class colorizer): New class. (class layout_point): New class. (class layout_range): New class. (struct line_bounds): New. (class layout): New class. (colorizer::colorizer): New ctor. (colorizer::~colorizer): New dtor. (layout::layout): New ctor. (layout::print_source_line): New method. (layout::print_annotation_line): New method. (layout::get_state_at_point): New method. (layout::get_x_bound_for_row): New method. (diagnostic_show_locus): Reimplement in terms of class layout. (diagnostic_print_caret_line): Delete. * diagnostic.c (diagnostic_initialize): Replace MAX_LOCATIONS_PER_MESSAGE with rich_location::MAX_RANGES. (diagnostic_set_info_translated): Convert param from location_t to rich_location *. Eliminate calls to set_location on the message in favor of storing the rich_location ptr there. (diagnostic_set_info): Convert param from location_t to rich_location *. (diagnostic_build_prefix): Break out array into... (diagnostic_kind_color): New variable. (diagnostic_get_color_for_kind): New function. (diagnostic_report_diagnostic): Colorize the option_text using the color for the severity. (diagnostic_append_note): Update for change in signature of diagnostic_set_info. (diagnostic_append_note_at_rich_loc): New function. (emit_diagnostic): Update for change in signature of diagnostic_set_info. (inform): Likewise. (inform_at_rich_loc): New function. (inform_n): Update for change in signature of diagnostic_set_info. (warning): Likewise. (warning_at): Likewise. (warning_at_rich_loc): New function. (warning_n): Update for change in signature of diagnostic_set_info. (pedwarn): Likewise. (permerror): Likewise. (permerror_at_rich_loc): New function. (error): Update for change in signature of diagnostic_set_info. (error_n): Likewise. (error_at): Likewise. (error_at_rich_loc): New function. (sorry): Update for change in signature of diagnostic_set_info. (fatal_error): Likewise. (internal_error): Likewise. (internal_error_no_backtrace): Likewise. (source_range::debug): New function. * diagnostic.h (struct diagnostic_info): Eliminate field "override_column". Add field "richloc". (struct diagnostic_context): Add field "colorize_source_p". (diagnostic_override_column): Delete. (diagnostic_set_info): Convert param from location_t to rich_location *. (diagnostic_set_info_translated): Likewise. (diagnostic_append_note_at_rich_loc): New function. (diagnostic_num_locations): New function. (diagnostic_expand_location): Get the location from the rich_location. (diagnostic_print_caret_line): Delete. (diagnostic_get_color_for_kind): New declaration. * genmatch.c (linemap_client_expand_location_to_spelling_point): New. (error_cb): Update for change in signature of "error" callback. (fatal_at): Likewise. (warning_at): Likewise. * input.c (linemap_client_expand_location_to_spelling_point): New. * pretty-print.c (text_info::set_range): New method. (text_info::get_location): New method. * pretty-print.h (MAX_LOCATIONS_PER_MESSAGE): Eliminate this macro. (struct text_info): Eliminate "locations" array in favor of "m_richloc", a rich_location *. (textinfo::set_location): Add a "caret_p" param, and reimplement in terms of a call to set_range. (textinfo::get_location): Eliminate inline implementation in favor of an out-of-line reimplementation. (textinfo::set_range): New method. * rtl-error.c (diagnostic_for_asm): Update for change in signature of diagnostic_set_info. * tree-diagnostic.c (default_tree_printer): Update for new "caret_p" param for textinfo::set_location. * tree-pretty-print.c (percent_K_format): Likewise. gcc/c-family/ChangeLog: * c-common.c (c_cpp_error): Convert parameter from location_t to rich_location *. Eliminate the "column_override" parameter and the call to diagnostic_override_column. Update the "done_lexing" clause to set range 0 on the rich_location, rather than overwriting a location_t. * c-common.h (c_cpp_error): Convert parameter from location_t to rich_location *. Eliminate the "column_override" parameter. gcc/c/ChangeLog: * c-decl.c (warn_defaults_to): Update for change in signature of diagnostic_set_info. * c-errors.c (pedwarn_c99): Likewise. (pedwarn_c90): Likewise. * c-objc-common.c (c_tree_printer): Update for new "caret_p" param for textinfo::set_location. gcc/cp/ChangeLog: * error.c (cp_printer): Update for new "caret_p" param for textinfo::set_location. (pedwarn_cxx98): Update for change in signature of diagnostic_set_info. gcc/fortran/ChangeLog: * cpp.c (cb_cpp_error): Convert parameter from location_t to rich_location *. Eliminate the "column_override" parameter. * error.c (gfc_warning): Update for change in signature of diagnostic_set_info. (gfc_format_decoder): Update handling of %C/%L for changes to struct text_info. (gfc_diagnostic_starter): Use richloc when determining whether to print one locus or two. When handling a location that will involve a call to diagnostic_show_locus, only attempt to print the locus for the primary location, and don't call into diagnostic_print_caret_line. (gfc_warning_now_at): Update for change in signature of diagnostic_set_info. (gfc_warning_now): Likewise. (gfc_error_now): Likewise. (gfc_fatal_error): Likewise. (gfc_error): Likewise. (gfc_internal_error): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic-test-show-locus-bw.c: New file. * gcc.dg/plugin/diagnostic-test-show-locus-color.c: New file. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: New file. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the above. * lib/gcc-dg.exp: Load multiline.exp. libcpp/ChangeLog: * errors.c (cpp_diagnostic): Update for change in signature of "error" callback. (cpp_diagnostic_with_line): Likewise, calling override_column on the rich_location. * include/cpplib.h (struct cpp_callbacks): Within "error" callback, convert param from source_location to rich_location *, and drop column_override param. * include/line-map.h (struct source_range): New struct. (struct location_range): New struct. (class rich_location): New class. (linemap_client_expand_location_to_spelling_point): New declaration. * line-map.c (rich_location::rich_location): New ctors. (rich_location::lazily_expand_location): New method. (rich_location::override_column): New method. (rich_location::add_range): New methods. (rich_location::set_range): New method. From-SVN: r229884
2015-11-06 20:50:50 +01:00
text->set_location (0, location_of (t), true);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
return true;
top level: * errors.h (warning, error, fatal, internal_error): Don't mark with ATTRIBUTE_PRINTF_n. * toplev.h (internal_error, fatal_io_error, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, error_for_asm, warning_for_asm): Likewise. cp: * Make-lang.in (CXX_OBJS): Take out cp/errfn.o. (cp/errfn.o): Delete rule. (cp/error.o): Depend on flags.h. * errfn.c: Delete file. * cp-tree.h: Declare warn_deprecated. Remove definitions of TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning, cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and internal_error respectively. Make cp_deprecated into a macro. Don't define cp_printer typedef or declare cp_printers. * error.c: Include flags.h. Delete: struct tree_formatting_info, print_function_argument_list, print_declaration, print_expression, print_function_declaration, print_function_parameter, print_type_id, print_cv_qualifier_seq, print_type_specifier_seq, print_simple_type_specifier, print_elaborated_type_specifier, print_rest_of_abstract_declarator, print_parameter_declaration_clause, print_exception_specification, print_nested_name_specifier, and definition of cp_printers. (locate_error): New function. (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and rewritten in terms of locate_error and diagnostic.c. (cp_tree_printer): Rename cp_printer; wire up to *_to_string instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. po: * POTFILES.in: Remove cp/errfn.c. From-SVN: r45765
2001-09-24 02:27:33 +02:00
#undef next_tree
#undef next_tcode
#undef next_lang
#undef next_int
}
Implement WG21 N2672, Initializer List proposed wording gcc/cp/ChangeLog: 2008-07-02 Jason Merrill <jason@redhat.com> Implement WG21 N2672, Initializer List proposed wording * cp-tree.h (enum cp_tree_index): Add CPTI_INIT_LIST_TYPE. (struct lang_type_class): Add has_list_ctor bitfield. (TYPE_HAS_LIST_CTOR): New macro. (BRACE_ENCLOSED_INITIALIZER_P): Expect init_list_type_node. (CONSTRUCTOR_IS_DIRECT_INIT): New macro. (LOOKUP_NO_NARROWING): New macro. (LOOKUP_NO_COPY_CTOR_CONVERSION): New macro. * parser.c (cp_parse_braced_list): Split out from... (cp_parser_initializer_clause): ...here. (cp_parser_postfix_expression): Build up CONSTRUCTOR for compound literal here. (cp_lexer_next_token_is_not_keyword): New fn. (cp_parser_parenthesized_expression_list): Handle { }. (cp_parser_new_expression, cp_parser_new_initializer): Likewise. (cp_parser_assignment_expression, cp_parser_condition): Likewise. (cp_parser_jump_statement, cp_parser_simple_declaration): Likewise. (cp_parser_mem_initializer, cp_parser_init_declarator): Likewise. (cp_parser_initializer, cp_parser_functional_cast): Likewise. (cp_parser_omp_for_loop, cp_parser_cache_group): Likewise. (cp_parser_save_member_function_body): Likewise. * call.c (conversion_kind): Add ck_list, ck_aggr. (struct conversion): Add check_narrowing bitfield, conversion list. (build_list_conv): New fn. (build_aggr_conv): New fn. (implicit_conversion): Call them. (standard_conversion): Set check_narrowing if appropriate. (add_function_candidate): Handle LOOKUP_NO_COPY_CTOR_CONVERSION. (build_user_type_conversion_1): When converting from an init list, we allow additional conversions except when calling a copy ctor. (convert_like_real): Calling an explicit ctor for an init list is ill-formed. Handle ck_list and ck_addr. Check narrowing. (build_new_method_call): If CONSTRUCTOR_IS_DIRECT_INIT is set and class doesn't have a list ctor, break the {} into a TREE_LIST. (compare_ics): ck_list is better than other UDCs. (set_up_extended_ref_temp): Split out from initialize_reference. (is_std_init_list): New fn. (is_list_ctor): New fn. * decl.c (cxx_init_decl_processing): Create init_list_type_node. (reshape_init_array_1): Pass it to build_constructor. (reshape_init_class): Ditto. (initialize_artificial_var): Pass the appropriate type. (build_aggr_init_full_exprs): Split out from... (check_initializer): ...here. Handle new semantics. (build_init_list_var_init): New subroutine of check_initializer. (grokdeclarator): Converting constructors can have more than one parm. (grok_special_member_properties): Set TYPE_HAS_LIST_CTOR. * init.c (expand_default_init): Only do digest_init for aggregates. * rtti.c (tinfo_base_init): Pass init_list_type_node to build_constructor_from_list. (generic_initializer, ptr_initializer): Ditto. (ptm_initializer, class_initializer): Ditto. (get_pseudo_ti_init): Ditto. * error.c (dump_type): Handle init_list_type_node. (maybe_warn_cpp0x): New fn. (maybe_varn_variadic_templates): Call it. * cvt.c (ocp_convert): Handle conversion from { }. * tree.c (build_array_of_n_type): New fn. * typeck2.c (store_init_value): Use init_list_type_node. (digest_init): Likewise. (check_narrowing): New fn. * semantics.c: (finish_compound_literal): Take CONSTRUCTOR instead of vector of constructor elts. Handle non-aggregate types. Make constant literals static. * pt.c: (tsubst_copy_and_build): Adjust. (unify): Handle { }. * name-lookup.c (arg_assoc_type): Handle init_list_type_node. gcc/ChangeLog: 2008-07-02 Jason Merrill <jason@redhat.com> * tree.c (ctor_to_list): New fn. * tree.h: Declare it. (CONSTRUCTOR_ELT): New macro. (CONSTRUCTOR_NELTS): New macro. libstdc++-v3/ChangeLog: 2008-07-02 Jason Merrill <jason@redhat.com> * libsupc++/initializer_list: New file. * include/bits/stl_map.h (insert(initializer_list)): New method. From-SVN: r137361
2008-07-02 17:38:50 +02:00
/* Warn about the use of C++0x features when appropriate. */
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
void
maybe_warn_cpp0x (cpp0x_warn_str str)
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
{
Remove macros that implicitly use input_location gcc/ * input.h (input_line): Remove. (input_filename): Likewise. (in_system_header): Likewise. * tree.h (EXPR_LOC_OR_HERE): Remove. * config/bfin/bfin.c (output_file_start): Remove use of input_filename macro. * builtins.c (c_strlen): Remove use of EXPR_LOC_OR_HERE macro. * gimplify.c (internal_get_tmp_var): Likewise. EXPR_LOC_OR_HERE macro. (shortcut_cond_expr): Likewise. * tree-diagnostic.c (diagnostic_report_current_function): Remove use of input_filename macro. * tree.c (get_file_function_name): Likewise. gcc/ada * gcc-interface/utils2.c (build_call_raise): Remove use of input_line macro. (build_call_raise_range): Likewise. (build_call_raise_column): Likewise. gcc/c-family * c-common.c (unsafe_conversion_p): Remove use of EXPR_LOC_OR_HERE macro. (conversion_warning): Likewise. (warnings_for_convert_and_check): Likewise. (warn_for_collisions_1): Likewise. (shorten_compare): Likewise, and remove use of in_system_header macro, using the location from the former. * c-lex.c (dump_one_header): Remove use of input_filename macro. (cb_def_pragma): Remove use of in_system_header macro. (lex_string): Likewise. * c-pragma.c (handle_pragma_float_const_decimal64): Likewise. gcc/c * c-decl.c (define_label, shadow_tag_warned) (check_bitfield_type_and_width, grokdeclarator, grokparms, store_parm_decls_newstyle, store_parm_decls_oldstyle) (declspecs_add_type): Remove use of in_system_header macro. * c-parser.c (c_parser_unary_expression): Likewise. * c-typeck.c (store_init_value, process_init_element) (c_start_case): Likewise. * c-decl.c (build_enumerator): Remove use of EXPR_LOC_OR_HERE macro. * c-parser.c (c_parser_set_source_position_from_token): Remove reference to in_system_header from comment. gcc/cp * call.c (build_integral_nontype_arg_conv): Remove use of EXPR_LOC_OR_HERE macro. (convert_like_real): Likewise. (convert_arg_to_ellipsis): Likewise. (build_cxx_call): Likewise. (perform_implicit_conversion_flags): Likewise. (initialize_reference): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_reference): Likewise. (ocp_convert): Likewise. (convert_to_void): Likewise. * decl.c (pop_label): Update comment. (pop_switch): Remove use of EXPR_LOC_OR_HERE macro. (check_tag_decl): Remove use of in_system_header macro. (make_rtl_for_nonlocal_decl): Remove use of input_filename macro. (compute_array_index_type): Remove use of in_system_header macro. (grokdeclarator): Likewise. * error.c (dump_global_iord): Remove use of input_filename macro. (location_of): Remove use of EXPR_LOC_OR_HERE macro. (maybe_warn_cpp0x): Remove use of in_system_header macro. * init.c (build_new_1): Remove use of EXPR_LOC_OR_HERE macro. * lex.c (handle_pragma_interface): Remove use of input_filename macro. (handle_pragma_implementation): Likewise. (cxx_make_type): Likewise. (in_main_input_context): Likewise. * name-lookup.c (push_binding_level): Remove use of input_line macro. (leave_scope): Likewise. (resume_scope): Likewise. * parser.c (cp_parser_unqualified_id): Remove use of in_system_header macro. (cp_parser_cast_expression): Likewise. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_exception_specification_opt): Likewise. * pt.c (unify_arg_conversion): Remove use of EXPR_LOC_OR_HERE macro. (convert_nontype_argument): Likewise. (push_tinst_level): Remove use of in_system_header macro. (tsubst_copy_and_build): Remove use of EXPR_LOC_OR_HERE macros. (do_decl_instantiation): Remove use of in_system_header macro. (do_type_instantiation): Likewise. * semantics.c (finish_call_expr): Remove use of EXPR_LOC_OR_HERE macro. (begin_class_definition): Remove use of input_filename macro. (cxx_eval_call_expression): Remove use of EXPR_LOC_OR_HERE macro. (cxx_eval_constant_expression): Likewise. (potential_constant_expression_1): Likewise. * typeck.c (decay_conversion): Likewise. (rationalize_conditional_expr): Likewise. (build_x_compound_expr_from_list): Likewise. (convert_for_assignment): Likewise. * typeck2.c (check_narrowing): Likewise. gcc/fortran * trans.c (trans_runtime_error_vararg): Remove use of input_line macro. gcc/java * class.c (maybe_layout_super_class): Update comment. * decl.c (java_add_stmt): Remove use of input_filename macro. * jcf-parse.c (set_source_filename): Remove use of input_filename macro. (parse_class_file): Remove use of input_line and input_filename macros. (java_parse_file): Remove use of input_filename macro. From-SVN: r205262
2013-11-22 15:18:13 +01:00
if ((cxx_dialect == cxx98) && !in_system_header_at (input_location))
/* We really want to suppress this warning in system headers,
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
because libstdc++ uses variadic templates even when we aren't
in C++0x mode. */
switch (str)
{
case CPP0X_INITIALIZER_LISTS:
pedwarn (input_location, 0,
"extended initializer lists "
"only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_EXPLICIT_CONVERSION:
pedwarn (input_location, 0,
"explicit conversion operators "
"only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_VARIADIC_TEMPLATES:
pedwarn (input_location, 0,
"variadic templates "
"only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_LAMBDA_EXPR:
pedwarn (input_location, 0,
"lambda expressions "
"only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_AUTO:
pedwarn (input_location, 0,
"C++11 auto only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_SCOPED_ENUMS:
pedwarn (input_location, 0,
"scoped enums only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_DEFAULTED_DELETED:
pedwarn (input_location, 0,
"defaulted and deleted functions "
"only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_INLINE_NAMESPACES:
re PR c/44774 (-Werror=edantic) 2012-04-22 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c/44774 gcc/ * doc/invoke.texi (pedantic): Rename to Wpedantic. * common.opt (Wpedantic): New. (pedantic): Alias Wpedantic. * diagnostic.c (warning_at): Likewise. * c-decl.c (diagnose_mismatched_decls): Likewise. (build_array_declarator): Likewise. (mark_forward_parm_decls): (check_bitfield_type_and_width): Likewise. (grokdeclarator): Likewise. (grokfield): Likewise. (finish_struct): Likewise. (build_enumerator): Likewise. (store_parm_decls_oldstyle): Likewise. (declspecs_add_qual): Likewise. (declspecs_add_type): Likewise. (finish_declspecs): Likewise. * c-typeck.c (composite_type): Likewise. (comp_target_types): Likewise. (build_array_ref): Likewise. (pointer_diff): Likewise. (build_unary_op): Likewise. (build_conditional_expr): Likewise. (build_c_cast): Likewise. (convert_for_assignment): Likewise. (maybe_warn_string_init): Likewise. (digest_init): Likewise. (pop_init_level): Likewise. (set_init_index): Likewise. (c_finish_goto_label): Likewise. (c_finish_return): Likewise. (do_case): Likewise. (build_binary_op): Likewise. * c-parser.c (static): Likewise. (c_parser_external_declaration): Likewise. (c_parser_declaration_or_fndef): Likewise. (c_parser_static_assert_declaration_no_se): Likewise. (c_parser_enum_specifier): Likewise. (c_parser_struct_or_union_specifier): Likewise. (c_parser_struct_declaration): Likewise. (c_parser_alignas_specifier): Likewise. (c_parser_braced_init): Likewise. (c_parser_initelt): Likewise. (c_parser_compound_statement_nostart): Likewise. (c_parser_conditional_expression): Likewise. (c_parser_alignof_expression): Likewise. (c_parser_postfix_expression): Likewise. (c_parser_postfix_expression_after_paren_): Likewise. (c_parser_objc_class_instance_variables): Likewise. (c_parser_objc_method_definition): Likewise. (c_parser_objc_methodprotolist): Likewise. c-family/ * c.opt (Wpedantic): New. (pedantic): Alias Wpedantic. * c-opts.c (c_common_handle_option): Replace -pedantic with -Wpedantic. (c_common_post_options): Likewise. (sanitize_cpp_opts): Likewise. * c-lex.c (interpret_float): Likewise. * c-format.c (check_format_types): Likewise. * c-common.c (pointer_int_sum): Likewise. (c_sizeof_or_alignof_type): Likewise. (c_add_case_label): Likewise. (c_do_switch_warnings): Likewise. * c-pragma.c (handle_pragma_float_const_decimal64): Likewise. cp/ * typeck.c (composite_pointer_type): Likewise. (cxx_sizeof_or_alignof_type): Likewise. (cp_build_array_ref): Likewise. (cp_build_function_call_vec): Likewise. (cp_build_addr_expr_1): Likewise. (convert_member_func_to_ptr): Likewise. * decl.c (check_tag_decl): Likewise. (check_static_variable_definition): Likewise. (compute_array_index_type): Likewise. (create_array_type_for_decl): Likewise. (grokdeclarator): Likewise. (grok_op_properties): Likewise. * error.c (maybe_warn_cpp0x): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (convert_template_argument): Likewise. (do_decl_instantiation): Likewise. (do_type_instantiation): Likewise. * parser.c (cp_parser_primary_expression): Likewise. (cp_parser_postfix_expression): Likewise. (cp_parser_unary_expression): Likewise. (cp_parser_question_colon_clause): Likewise. (cp_parser_lambda_introducer): Likewise. (cp_parser_lambda_declarator_opt): Likewise. (cp_parser_compound_statement): Likewise. (cp_parser_jump_statement): Likewise. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_member_declaration): Likewise. * call.c (build_conditional_expr_1): Likewise. * friend.c (make_friend_class): Likewise. * name-lookup.c (pushdecl_maybe_friend_1): Likewise. From-SVN: r186681
2012-04-22 21:17:47 +02:00
pedwarn (input_location, OPT_Wpedantic,
"inline namespaces "
"only available with -std=c++11 or -std=gnu++11");
Implement C++11 user-defined literals. libcpp/ * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix, cpp_userdef_string_remove_type, cpp_userdef_string_add_type, cpp_userdef_char_remove_type, cpp_userdef_char_add_type, cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New. (cpp_classify_number): Classify unrecognized tokens as user-defined literals. * include/cpplib.h: Add new tokens for user-defined literals. * init.c: Add new preprocessor flag (cxx11). * lex.c: (lex_string, lex_raw_string): Handle user-defined literals including concatenation and promotion with suffixes. c-family/ * c-common.c (build_userdef_literal): New. * c-common.def: New tree code. * c-common.h (tree_userdef_literal): New tree struct and accessors. * c-lex.c (interpret_float): Add suffix parm. (c_lex_with_flags): Build literal tokens. cp/ * cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree. * cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator name tools. New tree code for user-defined literals. * cxx-pretty-print.h: (pp_cxx_userdef_literal) New. * cxx-pretty-print.c: (pp_cxx_userdef_literal) New. (pp_cxx_primary_expression, pp_cxx_expression): Use it. * decl.c: (cp_tree_node_structure): Return new tree code. (duplicate_decls): Check for raw vs. template operator conflicts. (grokfndecl, grokdeclarator): New checks for literal operators. * error.c: (dump_expr): Warn about user-defined literals in C++98 mode. (dump_function_name): Pretty printing. * mangle.c: (write_literal_operator_name): New. (write_unqualified_id, write_unqualified_name): Use it. * parser.c: (cp_parser_operator): Handle operator"". (cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal, cp_parser_userdef_string_literal): New. (cp_parser_primary_expression): Handle new user-defined literal tokens with new functions. * semantics.c: (potential_constant_expression_1): Add user-defined literals. * typeck.c (check_raw_literal_operator, check_literal_operator_args): New. From-SVN: r180536
2011-10-26 21:30:59 +02:00
break;
case CPP0X_OVERRIDE_CONTROLS:
pedwarn (input_location, 0,
"override controls (override/final) "
"only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_NSDMI:
pedwarn (input_location, 0,
"non-static data member initializers "
"only available with -std=c++11 or -std=gnu++11");
break;
Implement C++11 user-defined literals. libcpp/ * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix, cpp_userdef_string_remove_type, cpp_userdef_string_add_type, cpp_userdef_char_remove_type, cpp_userdef_char_add_type, cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New. (cpp_classify_number): Classify unrecognized tokens as user-defined literals. * include/cpplib.h: Add new tokens for user-defined literals. * init.c: Add new preprocessor flag (cxx11). * lex.c: (lex_string, lex_raw_string): Handle user-defined literals including concatenation and promotion with suffixes. c-family/ * c-common.c (build_userdef_literal): New. * c-common.def: New tree code. * c-common.h (tree_userdef_literal): New tree struct and accessors. * c-lex.c (interpret_float): Add suffix parm. (c_lex_with_flags): Build literal tokens. cp/ * cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree. * cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator name tools. New tree code for user-defined literals. * cxx-pretty-print.h: (pp_cxx_userdef_literal) New. * cxx-pretty-print.c: (pp_cxx_userdef_literal) New. (pp_cxx_primary_expression, pp_cxx_expression): Use it. * decl.c: (cp_tree_node_structure): Return new tree code. (duplicate_decls): Check for raw vs. template operator conflicts. (grokfndecl, grokdeclarator): New checks for literal operators. * error.c: (dump_expr): Warn about user-defined literals in C++98 mode. (dump_function_name): Pretty printing. * mangle.c: (write_literal_operator_name): New. (write_unqualified_id, write_unqualified_name): Use it. * parser.c: (cp_parser_operator): Handle operator"". (cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal, cp_parser_userdef_string_literal): New. (cp_parser_primary_expression): Handle new user-defined literal tokens with new functions. * semantics.c: (potential_constant_expression_1): Add user-defined literals. * typeck.c (check_raw_literal_operator, check_literal_operator_args): New. From-SVN: r180536
2011-10-26 21:30:59 +02:00
case CPP0X_USER_DEFINED_LITERALS:
pedwarn (input_location, 0,
"user-defined literals "
"only available with -std=c++11 or -std=gnu++11");
Implement C++11 user-defined literals. libcpp/ * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix, cpp_userdef_string_remove_type, cpp_userdef_string_add_type, cpp_userdef_char_remove_type, cpp_userdef_char_add_type, cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New. (cpp_classify_number): Classify unrecognized tokens as user-defined literals. * include/cpplib.h: Add new tokens for user-defined literals. * init.c: Add new preprocessor flag (cxx11). * lex.c: (lex_string, lex_raw_string): Handle user-defined literals including concatenation and promotion with suffixes. c-family/ * c-common.c (build_userdef_literal): New. * c-common.def: New tree code. * c-common.h (tree_userdef_literal): New tree struct and accessors. * c-lex.c (interpret_float): Add suffix parm. (c_lex_with_flags): Build literal tokens. cp/ * cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree. * cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator name tools. New tree code for user-defined literals. * cxx-pretty-print.h: (pp_cxx_userdef_literal) New. * cxx-pretty-print.c: (pp_cxx_userdef_literal) New. (pp_cxx_primary_expression, pp_cxx_expression): Use it. * decl.c: (cp_tree_node_structure): Return new tree code. (duplicate_decls): Check for raw vs. template operator conflicts. (grokfndecl, grokdeclarator): New checks for literal operators. * error.c: (dump_expr): Warn about user-defined literals in C++98 mode. (dump_function_name): Pretty printing. * mangle.c: (write_literal_operator_name): New. (write_unqualified_id, write_unqualified_name): Use it. * parser.c: (cp_parser_operator): Handle operator"". (cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal, cp_parser_userdef_string_literal): New. (cp_parser_primary_expression): Handle new user-defined literal tokens with new functions. * semantics.c: (potential_constant_expression_1): Add user-defined literals. * typeck.c (check_raw_literal_operator, check_literal_operator_args): New. From-SVN: r180536
2011-10-26 21:30:59 +02:00
break;
case CPP0X_DELEGATING_CTORS:
pedwarn (input_location, 0,
"delegating constructors "
"only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_INHERITING_CTORS:
pedwarn (input_location, 0,
"inheriting constructors "
"only available with -std=c++11 or -std=gnu++11");
break;
PR c++/53528 C++11 attribute support This patch implements the c++-11 generalized attributes, described in the N2761 paper[1]. The idea is to modify the front-end to accept the new attribute syntax (including alignas expressions) and to build an internal representation similar to the one we already have for GNU attributes. This lets us re-use our existing GNU attribute mechanisms to support the generalized c++11 attributes. The patch does change the existing internal representation to support scoped attribute (aka attributes with namespaces), which is a concept that doesn't exist in GNU attributes. I have thus put all existing GNU extension attributes into the "gnu" namespace. For instance, in C++-11, the "unused" attribute would be represented as "[[gnu::unused]]". Because there is no syntax for scoped attributes in C, writting "__attribute__((unused))" unconditionnally refers to the "unused" attribute in the "gnu" namespace. Note that this patch follows a conservative understanding of the specification by disallowing attributes appertaining to types, unless they apply to a type definition. Tested on x86_64-unknown-linux-gnu and powerpc64-unknown-linux-gnu. [1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf gcc/ * plugin.h (register_scoped_attributes): Declare new function. * tree.h (enu attribute_flags::ATTR_FLAG_CXX_11): New flag. (lookup_scoped_attribute_spec, cxx_11_attribute_p) (get_attribute_name, get_attribute_namespace): Declare new functions. (struct attribute_spec): Remove const qualifier from the members. * tree.c (comp_type_attributes, private_lookup_attribute) (lookup_ident_attribute, remove_attribute, merge_attribute) (attribute_hash_list, attribute_list_contained): Use get_attribute_name. * attribs.c (decl_attributes): Don't crash on error_mark_node. Forbid c++11 attributes appertaining to type-specifiers. (attribute_hash): Remove global variable. (attributes_table): New global variable. (find_attribute_namespace, register_scoped_attribute): New static functions. (register_scoped_attributes, lookup_scoped_attribute_spec) (cxx11_attribute_p, get_attribute_name, get_attribute_namespace): New public functions. (init_attributes): Register all the GNU attributes into the "gnu" namespace. (register_attribute): Use register_scoped_attribute to register the attribute into the "gnu" namespace. (lookup_attribute_spec): Use lookup_scoped_attribute_spec to lookup the attribute in the "gnu" namespace. (decl_attributes): Use new get_attribute_namespace and lookup_scoped_attribute_spec to consider attribute namespaces when looking up attributes. When operating in c++-11 mode, pass flag ATTR_FLAG_CXX11 to the spec handler. gcc/c-family/ * c-common.h (bitfield_p, cxx_fundamental_alignment_p): Declare new functions. * c-common.c (check_cxx_fundamental_alignment_constraints): New static function. (handle_aligned_attribute): In choose strictest alignment among many. Use new check_cxx_fundamental_alignment_constraints. (handle_transparent_union_attribute): In c++11 attribute syntax, don't look through typedefs. gcc/cp/ * cp-tree.h (enum cpp0x_warn_str::CPP0X_ATTRIBUTES): New member. (enum cp_decl_spec::ds_std_attribute): New enumerator. (struct cp_decl_specifier_seq::std_attributes): New field. (cxx_alignas_expr, warn_misplaced_attr_for_class_type): Declare new functions. (check_tag_decl): Take an extra parameter for explicit instantiations. * decl.c (warn_misplaced_attr_for_class_type): Extract from ... (check_tag_decl): ... here. Add check for c++11 attributes being applied to an explicit instantiation. Take an extra parameter for explicit instantiations. (grokdeclarator): Make sure a c++11 attribute after an array declarator appertains to the array, an attribute after a function declarator appertains to the function type, an attribute after a declarator-id appertains to the entity being declared, and an attribute after a pointer declarator appertains to the pointer. * decl2.c (is_late_template_attribute): Use get_attribute_name. * error.c (maybe_warn_cpp0x): Support CPP0X_GENERALIZED_ATTRIBUTES. * parser.c (cp_next_tokens_can_be_attribute_p) (cp_next_tokens_can_be_gnu_attribute_p) (cp_next_tokens_can_be_std_attribute_p) (cp_nth_tokens_can_be_attribute_p) (cp_nth_tokens_can_be_gnu_attribute_p) (cp_nth_tokens_can_be_std_attribute_p) (cp_parser_gnu_attribute_list, cp_parser_std_attribute) (cp_parser_std_attribute_spec, cp_parser_std_attribute_spec_seq) (cp_parser_attributes_opt, cp_parser_std_attribute_list): New static functions. (cp_parser_gnu_attributes_opt): Replace cp_parser_attributes_opt. (cp_parser_gnu_attribute_list): Replace cp_parser_attribute_list. (cp_parser_postfix_expression): Disallow "[[" tokens here. (cp_parser_label_for_labeled_statement): Use take an extra parameter for attributes. (cp_parser_block_declaration): Use cp_nth_tokens_can_be_std_attribute_p here. (cp_parser_decl_specifier_seq): Likewise. Store C++11 attributes that appears in in decl specifiers in cp_decl_specifier_seq::std_attributes. declaration. Emit proper warning about misplaced c++11 attributes for class type. (cp_parser_explicit_instantiation): Adjust call to check_tag_decl. (cp_parser_init_declarator): Parsing attributes here is no more a GNU extension in c++-11. (cp_parser_type_specifier_seq): Use cp_next_tokens_can_be_attribute_p. (cp_parser_direct_declarator): Likewise. Hang c++11 attributes following the declarator to its syntactic construct. It'll later be applied to the proper appertaining entity by grokdeclarator. (cp_parser_ptr_operator): Likewise. (make_declarator): Initialize cp_declarator::std_attribute. (make_pointer_declarator, make_reference_declarator) (make_ptrmem_declarator, cp_parser_make_indirect_declarator): Take attributes that appertain to the pointer/reference in argument. (cp_parser_ptr_operator): Take an out parameter for c++11 attributes. Update comments. (cp_parser_new_declarator_opt) (cp_parser_conversion_declarator_opt): Adjust. (cp_parser_declarator): Likewise. Handle C++11 attributes. Rename attributes to gnu_attribute for better legibility. (cp_parser_simple_declaration): Update comment. (cp_parser_class_specifier_1): Parse GNU attributes specifically (cp_parser_enum_specifier): Accept only gnu attributes after the specifier. (cp_parser_member_declaration): Don't clear attributes -- intended for the entity being declared -- too early because check_tag_decl needs them. (cp_parser_statement): Update comment. Parse optional c++11 attributes at the beginning of the relevant kind of statements and ignore them, for now, unless when calling cp_parser_label_for_labeled_statement. (cp_parser_label_for_labeled_statement): Take c++11 attributes in parameter. * semantics.c (potential_constant_expression_1): Likewise. * typeck.c (fundamental_alignment_p, cxx_alignas_expr): New public functions. gcc/testsuite/ * g++.dg/cpp0x/gen-attrs-1.C: New test. * g++.dg/cpp0x/gen-attrs-2.C: Likewise. * g++.dg/cpp0x/gen-attrs-2-1.C: Likewise. * g++.dg/cpp0x/gen-attrs-3.C: Likewise. * g++.dg/cpp0x/gen-attrs-4.C: Likewise. * g++.dg/cpp0x/gen-attrs-5.C: Likewise. * g++.dg/cpp0x/gen-attrs-6.C: Likewise. * g++.dg/cpp0x/gen-attrs-7.C: Likewise. * g++.dg/cpp0x/gen-attrs-8.C: Likewise. * g++.dg/cpp0x/gen-attrs-9.C: Likewise. * g++.dg/cpp0x/gen-attrs-10.C: Likewise. * g++.dg/cpp0x/gen-attrs-11.C: Likewise. * g++.dg/cpp0x/gen-attrs-12.C: Likewise. * g++.dg/cpp0x/gen-attrs-13.C: Likewise. * g++.dg/cpp0x/gen-attrs-14.C: Likewise. * g++.dg/cpp0x/gen-attrs-15.C: Likewise. * g++.dg/cpp0x/gen-attrs-16.C: Likewise. * g++.dg/cpp0x/gen-attrs-17.C: Likewise. * g++.dg/cpp0x/gen-attrs-18.C: Likewise. * g++.dg/cpp0x/gen-attrs-19.C: Likewise. * g++.dg/cpp0x/gen-attrs-20.C: Likewise. * g++.dg/cpp0x/gen-attrs-21.C: Likewise. * g++.dg/cpp0x/gen-attrs-22.C: Likewise. * g++.dg/cpp0x/gen-attrs-23.C: Likewise. * g++.dg/cpp0x/gen-attrs-24.C: Likewise. * g++.dg/cpp0x/gen-attrs-25.C: Likewise. * g++.dg/cpp0x/gen-attrs-26.C: Likewise. * g++.dg/cpp0x/gen-attrs-27.C: Likewise. * g++.dg/cpp0x/gen-attrs-28.C: Likewise. * g++.dg/cpp0x/gen-attrs-29.C: Likewise. * g++.dg/cpp0x/gen-attrs-30.C: Likewise. * g++.dg/cpp0x/gen-attrs-31.C: Likewise. * g++.dg/cpp0x/gen-attrs-32.C: Likewise. * g++.dg/cpp0x/gen-attrs-33.C: Likewise. * g++.dg/cpp0x/gen-attrs-34.C: Likewise. * g++.dg/cpp0x/gen-attrs-35.C: Likewise. * g++.dg/cpp0x/gen-attrs-36.C: Likewise. * g++.dg/cpp0x/gen-attrs-36-1.C: Likewise. * g++.dg/cpp0x/gen-attrs-37.C: Likewise. * g++.dg/cpp0x/gen-attrs-38.C: Likewise. * g++.dg/cpp0x/gen-attrs-39.C: Likewise. * g++.dg/cpp0x/gen-attrs-39-1.C: Likewise. * g++.dg/cpp0x/gen-attrs-40.C: Likewise. * g++.dg/cpp0x/gen-attrs-41.C: Likewise. * g++.dg/cpp0x/gen-attrs-42.C: Likewise. * g++.dg/cpp0x/gen-attrs-43.C: Likewise. * g++.dg/cpp0x/gen-attrs-44.C: Likewise. * g++.dg/cpp0x/gen-attrs-45.C: Likewise. * g++.dg/cpp0x/gen-attrs-46.C: Likewise. * g++.dg/cpp0x/gen-attrs-47.C: Likewise. * g++.dg/cpp0x/gen-attrs-47-1.C: Likewise. * g++.dg/cpp0x/gen-attrs-48.C: Likewise. * g++.dg/cpp0x/gen-attrs-49.C: Likewise. * g++.dg/cpp0x/gen-attrs-50.C: Likewise. * g++.dg/cpp0x/gen-attrs-51.C: Likewise. * g++.dg/cpp0x/gen-attrs-52.C: Likewise. * g++.dg/cpp0x/gen-attrs-53.C: Likewise. From-SVN: r192199
2012-10-08 11:29:05 +02:00
case CPP0X_ATTRIBUTES:
pedwarn (input_location, 0,
"c++11 attributes "
"only available with -std=c++11 or -std=gnu++11");
break;
Implement N2439 (ref-qualifiers for 'this') Implement N2439 (ref-qualifiers for 'this') * cp-tree.h (FUNCTION_REF_QUALIFIED): New. (FUNCTION_RVALUE_QUALIFIED): New. (FUNCTION_OR_METHOD_TYPE_CHECK): New. (cpp0x_warn_str): Add CPP0X_REF_QUALIFIER. (cp_ref_qualifier): New enum. (cp_declarator): Add ref_qualifier. * parser.c (cp_parser_ref_qualifier_seq_opt): New. (cp_parser_direct_declarator): Use it. (make_call_declarator): Adjust. (cp_parser_lambda_declarator_opt): Adjust. * call.c (add_function_candidate): Handle ref-qualifier overload resolution semantics. (standard_conversion): Adjust. * class.c (add_method, same_signature_p): Compare ref-qualifiers. * decl.c (grokdeclarator): Handle ref-qualifiers. (grokfndecl): Check for invalid ref-qualifiers. (static_fn_type, revert_static_member_fn): Adjust. * decl2.c (build_memfn_type): Handle ref-qualifiers. (check_classfn): Check them. (cp_reconstruct_complex_type): Retain them. * error.c (dump_ref_qualifier): New. (dump_type_suffix, dump_function_decl): Use it. (maybe_warn_cpp0x): Handle CPP0X_REF_QUALIFIER. * pt.c (tsubst, tsubst_function_type): Instantiate ref-quals. (unify): Retain them. * tree.c (cp_check_qualified_type): New. (cp_build_qualified_type_real): Keep exception spec and ref-qual. (build_ref_qualified_type): New. (strip_typedefs, build_exception_variant): Keep ref-qualifier. (cp_build_type_attribute_variant): Keep ref-qualifier. * typeck.c (merge_types): Keep ref-qualifier. (structural_comptypes): Compare ref-qualifier. (type_memfn_rqual): New. (apply_memfn_quals): Take ref-qual argument. * typeck2.c (build_m_component_ref): Check ref-qualifier. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r197315
2013-04-01 21:04:59 +02:00
case CPP0X_REF_QUALIFIER:
pedwarn (input_location, 0,
"ref-qualifiers "
"only available with -std=c++11 or -std=gnu++11");
Implement N2439 (ref-qualifiers for 'this') Implement N2439 (ref-qualifiers for 'this') * cp-tree.h (FUNCTION_REF_QUALIFIED): New. (FUNCTION_RVALUE_QUALIFIED): New. (FUNCTION_OR_METHOD_TYPE_CHECK): New. (cpp0x_warn_str): Add CPP0X_REF_QUALIFIER. (cp_ref_qualifier): New enum. (cp_declarator): Add ref_qualifier. * parser.c (cp_parser_ref_qualifier_seq_opt): New. (cp_parser_direct_declarator): Use it. (make_call_declarator): Adjust. (cp_parser_lambda_declarator_opt): Adjust. * call.c (add_function_candidate): Handle ref-qualifier overload resolution semantics. (standard_conversion): Adjust. * class.c (add_method, same_signature_p): Compare ref-qualifiers. * decl.c (grokdeclarator): Handle ref-qualifiers. (grokfndecl): Check for invalid ref-qualifiers. (static_fn_type, revert_static_member_fn): Adjust. * decl2.c (build_memfn_type): Handle ref-qualifiers. (check_classfn): Check them. (cp_reconstruct_complex_type): Retain them. * error.c (dump_ref_qualifier): New. (dump_type_suffix, dump_function_decl): Use it. (maybe_warn_cpp0x): Handle CPP0X_REF_QUALIFIER. * pt.c (tsubst, tsubst_function_type): Instantiate ref-quals. (unify): Retain them. * tree.c (cp_check_qualified_type): New. (cp_build_qualified_type_real): Keep exception spec and ref-qual. (build_ref_qualified_type): New. (strip_typedefs, build_exception_variant): Keep ref-qualifier. (cp_build_type_attribute_variant): Keep ref-qualifier. * typeck.c (merge_types): Keep ref-qualifier. (structural_comptypes): Compare ref-qualifier. (type_memfn_rqual): New. (apply_memfn_quals): Take ref-qual argument. * typeck2.c (build_m_component_ref): Check ref-qualifier. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r197315
2013-04-01 21:04:59 +02:00
break;
default:
Implement C++11 user-defined literals. libcpp/ * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix, cpp_userdef_string_remove_type, cpp_userdef_string_add_type, cpp_userdef_char_remove_type, cpp_userdef_char_add_type, cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New. (cpp_classify_number): Classify unrecognized tokens as user-defined literals. * include/cpplib.h: Add new tokens for user-defined literals. * init.c: Add new preprocessor flag (cxx11). * lex.c: (lex_string, lex_raw_string): Handle user-defined literals including concatenation and promotion with suffixes. c-family/ * c-common.c (build_userdef_literal): New. * c-common.def: New tree code. * c-common.h (tree_userdef_literal): New tree struct and accessors. * c-lex.c (interpret_float): Add suffix parm. (c_lex_with_flags): Build literal tokens. cp/ * cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree. * cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator name tools. New tree code for user-defined literals. * cxx-pretty-print.h: (pp_cxx_userdef_literal) New. * cxx-pretty-print.c: (pp_cxx_userdef_literal) New. (pp_cxx_primary_expression, pp_cxx_expression): Use it. * decl.c: (cp_tree_node_structure): Return new tree code. (duplicate_decls): Check for raw vs. template operator conflicts. (grokfndecl, grokdeclarator): New checks for literal operators. * error.c: (dump_expr): Warn about user-defined literals in C++98 mode. (dump_function_name): Pretty printing. * mangle.c: (write_literal_operator_name): New. (write_unqualified_id, write_unqualified_name): Use it. * parser.c: (cp_parser_operator): Handle operator"". (cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal, cp_parser_userdef_string_literal): New. (cp_parser_primary_expression): Handle new user-defined literal tokens with new functions. * semantics.c: (potential_constant_expression_1): Add user-defined literals. * typeck.c (check_raw_literal_operator, check_literal_operator_args): New. From-SVN: r180536
2011-10-26 21:30:59 +02:00
gcc_unreachable ();
}
Implement WG21 N2672, Initializer List proposed wording gcc/cp/ChangeLog: 2008-07-02 Jason Merrill <jason@redhat.com> Implement WG21 N2672, Initializer List proposed wording * cp-tree.h (enum cp_tree_index): Add CPTI_INIT_LIST_TYPE. (struct lang_type_class): Add has_list_ctor bitfield. (TYPE_HAS_LIST_CTOR): New macro. (BRACE_ENCLOSED_INITIALIZER_P): Expect init_list_type_node. (CONSTRUCTOR_IS_DIRECT_INIT): New macro. (LOOKUP_NO_NARROWING): New macro. (LOOKUP_NO_COPY_CTOR_CONVERSION): New macro. * parser.c (cp_parse_braced_list): Split out from... (cp_parser_initializer_clause): ...here. (cp_parser_postfix_expression): Build up CONSTRUCTOR for compound literal here. (cp_lexer_next_token_is_not_keyword): New fn. (cp_parser_parenthesized_expression_list): Handle { }. (cp_parser_new_expression, cp_parser_new_initializer): Likewise. (cp_parser_assignment_expression, cp_parser_condition): Likewise. (cp_parser_jump_statement, cp_parser_simple_declaration): Likewise. (cp_parser_mem_initializer, cp_parser_init_declarator): Likewise. (cp_parser_initializer, cp_parser_functional_cast): Likewise. (cp_parser_omp_for_loop, cp_parser_cache_group): Likewise. (cp_parser_save_member_function_body): Likewise. * call.c (conversion_kind): Add ck_list, ck_aggr. (struct conversion): Add check_narrowing bitfield, conversion list. (build_list_conv): New fn. (build_aggr_conv): New fn. (implicit_conversion): Call them. (standard_conversion): Set check_narrowing if appropriate. (add_function_candidate): Handle LOOKUP_NO_COPY_CTOR_CONVERSION. (build_user_type_conversion_1): When converting from an init list, we allow additional conversions except when calling a copy ctor. (convert_like_real): Calling an explicit ctor for an init list is ill-formed. Handle ck_list and ck_addr. Check narrowing. (build_new_method_call): If CONSTRUCTOR_IS_DIRECT_INIT is set and class doesn't have a list ctor, break the {} into a TREE_LIST. (compare_ics): ck_list is better than other UDCs. (set_up_extended_ref_temp): Split out from initialize_reference. (is_std_init_list): New fn. (is_list_ctor): New fn. * decl.c (cxx_init_decl_processing): Create init_list_type_node. (reshape_init_array_1): Pass it to build_constructor. (reshape_init_class): Ditto. (initialize_artificial_var): Pass the appropriate type. (build_aggr_init_full_exprs): Split out from... (check_initializer): ...here. Handle new semantics. (build_init_list_var_init): New subroutine of check_initializer. (grokdeclarator): Converting constructors can have more than one parm. (grok_special_member_properties): Set TYPE_HAS_LIST_CTOR. * init.c (expand_default_init): Only do digest_init for aggregates. * rtti.c (tinfo_base_init): Pass init_list_type_node to build_constructor_from_list. (generic_initializer, ptr_initializer): Ditto. (ptm_initializer, class_initializer): Ditto. (get_pseudo_ti_init): Ditto. * error.c (dump_type): Handle init_list_type_node. (maybe_warn_cpp0x): New fn. (maybe_varn_variadic_templates): Call it. * cvt.c (ocp_convert): Handle conversion from { }. * tree.c (build_array_of_n_type): New fn. * typeck2.c (store_init_value): Use init_list_type_node. (digest_init): Likewise. (check_narrowing): New fn. * semantics.c: (finish_compound_literal): Take CONSTRUCTOR instead of vector of constructor elts. Handle non-aggregate types. Make constant literals static. * pt.c: (tsubst_copy_and_build): Adjust. (unify): Handle { }. * name-lookup.c (arg_assoc_type): Handle init_list_type_node. gcc/ChangeLog: 2008-07-02 Jason Merrill <jason@redhat.com> * tree.c (ctor_to_list): New fn. * tree.h: Declare it. (CONSTRUCTOR_ELT): New macro. (CONSTRUCTOR_NELTS): New macro. libstdc++-v3/ChangeLog: 2008-07-02 Jason Merrill <jason@redhat.com> * libsupc++/initializer_list: New file. * include/bits/stl_map.h (insert(initializer_list)): New method. From-SVN: r137361
2008-07-02 17:38:50 +02:00
}
/* Warn about the use of variadic templates when appropriate. */
void
maybe_warn_variadic_templates (void)
{
maybe_warn_cpp0x (CPP0X_VARIADIC_TEMPLATES);
re PR c++/20599 (variadic template support) 2007-03-09 Douglas Gregor <doug.gregor@gmail.com> PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. From-SVN: r122788
2007-03-10 02:58:58 +01:00
}
/* Issue an ISO C++98 pedantic warning at LOCATION, conditional on
option OPT with text GMSGID. Use this function to report
diagnostics for constructs that are invalid C++98, but valid
C++0x. */
bool
pedwarn_cxx98 (location_t location, int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
bool ret;
Source range tracking in libcpp and C FE, with bit-packing optimization This patch combines: [PATCH 05/10] Add ranges to libcpp tokens (via ad-hoc data, unoptimized) [PATCH 06/10] Track expression ranges in C frontend [PATCH 07/10] Add plugin to recursively dump the source-ranges in a tree (v2) [PATCH 08/10] Wire things up so that libcpp users get token underlines [PATCH 09/10] Delay some resolution of ad-hoc locations, preserving ranges [PATCH 10/10] Compress short ranges into source_location [PATCH] libcpp: add examples to source_location description along with fixes for the nits identified during review. gcc/ChangeLog: * Makefile.in (OBJS): Add gcc-rich-location.o. * diagnostic.c (diagnostic_append_note): Pass line_table to rich_location ctor. (emit_diagnostic): Likewise. (inform): Likewise. (inform_n): Likewise. (warning): Likewise. (warning_at): Likewise. (warning_n): Likewise. (pedwarn): Likewise. (permerror): Likewise. (error): Likewise. (error_n): Likewise. (error_at): Likewise. (sorry): Likewise. (fatal_error): Likewise. (internal_error): Likewise. (internal_error_no_backtrace): Likewise. (source_range::debug): Likewise. * gcc-rich-location.c: New file. * gcc-rich-location.h: New file. * genmatch.c (fatal_at): Pass line_table to rich_location ctor. (warning_at): Likewise. * gimple.h (gimple_set_block): Use set_block function. * input.c (dump_line_table_statistics): Dump stats on how many ranges were optimized vs how many needed ad-hoc table. (write_digit_row): Add "map" param; use its range_bits to calculate the per-character offset. (dump_location_info): Print the range and column bits for each ordinary map. Use the range bits to calculate the per-character offset. Pass the map as a new param to the various calls to write_digit_row. Eliminate uses of ORDINARY_MAP_NUMBER_OF_COLUMN_BITS. * print-tree.c (print_node): Print any source range information. * rtl-error.c (diagnostic_for_asm): Likewise. * toplev.c (general_init): Initialize line_table's default_range_bits. * tree-cfg.c (move_block_to_fn): Likewise. (move_block_to_fn): Likewise. * tree-inline.c (copy_phis_for_bb): Likewise. * tree.c (tree_set_block): Likewise. (get_pure_location): New function. (set_source_range): New functions. (set_block): New function. (set_source_range): New functions. * tree.h (CAN_HAVE_RANGE_P): New. (EXPR_LOCATION_RANGE): New. (EXPR_HAS_RANGE): New. (get_expr_source_range): New inline function. (DECL_LOCATION_RANGE): New. (set_source_range): New decls. (get_decl_source_range): New inline function. gcc/ada/ChangeLog: * gcc-interface/trans.c (Sloc_to_locus): Add line_table param when calling linemap_position_for_line_and_column. gcc/c-family/ChangeLog: * c-common.c (c_fully_fold_internal): Capture existing souce_range, and store it on the result. * c-opts.c (c_common_init_options): Set global_dc->colorize_source_p. gcc/c/ChangeLog: * c-decl.c (warn_defaults_to): Pass line_table to rich_location ctor. * c-errors.c (pedwarn_c99): Likewise. (pedwarn_c90): Likewise. * c-parser.c (set_c_expr_source_range): New functions. (c_token::get_range): New method. (c_token::get_finish): New method. (c_parser_expr_no_commas): Call set_c_expr_source_range on the ret based on the range from the start of the LHS to the end of the RHS. (c_parser_conditional_expression): Likewise, based on the range from the start of the cond.value to the end of exp2.value. (c_parser_binary_expression): Call set_c_expr_source_range on the stack values for TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR. (c_parser_cast_expression): Call set_c_expr_source_range on ret based on the cast_loc through to the end of the expr. (c_parser_unary_expression): Likewise, based on the op_loc through to the end of op. (c_parser_sizeof_expression) Likewise, based on the start of the sizeof token through to either the closing paren or the end of expr. (c_parser_postfix_expression): Likewise, using the token range, or from the open paren through to the close paren for parenthesized expressions. (c_parser_postfix_expression_after_primary): Likewise, for various kinds of expression. * c-tree.h (struct c_expr): Add field "src_range". (c_expr::get_start): New method. (c_expr::get_finish): New method. (set_c_expr_source_range): New decls. * c-typeck.c (parser_build_unary_op): Call set_c_expr_source_range on ret for prefix unary ops. (parser_build_binary_op): Likewise, running from the start of arg1.value through to the end of arg2.value. gcc/cp/ChangeLog: * error.c (pedwarn_cxx98): Pass line_table to rich_location ctor. gcc/fortran/ChangeLog: * error.c (gfc_warning): Pass line_table to rich_location ctor. (gfc_warning_now_at): Likewise. (gfc_warning_now): Likewise. (gfc_error_now): Likewise. (gfc_fatal_error): Likewise. (gfc_error): Likewise. (gfc_internal_error): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/diagnostic-token-ranges.c: New file. * gcc.dg/diagnostic-tree-expr-ranges-2.c: New file. * gcc.dg/plugin/diagnostic-test-expressions-1.c: New file. * gcc.dg/plugin/diagnostic-test-show-trees-1.c: New file. * gcc.dg/plugin/diagnostic_plugin_show_trees.c: New file. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (get_loc): Add line_table param when calling linemap_position_for_line_and_column. (test_show_locus): Pass line_table to rich_location ctors. (plugin_init): Remove setting of global_dc->colorize_source_p. * gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c: New file. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add diagnostic_plugin_test_tree_expression_range.c, diagnostic-test-expressions-1.c, diagnostic_plugin_show_trees.c, and diagnostic-test-show-trees-1.c. libcpp/ChangeLog: * errors.c (cpp_diagnostic): Pass pfile->line_table to rich_location ctor. (cpp_diagnostic_with_line): Likewise. * include/cpplib.h (struct cpp_token): Update comment for src_loc to indicate that the range of the token is "baked into" the source_location. * include/line-map.h (source_location): Update the descriptive comment to reflect the packing scheme for short ranges, adding worked examples of location encoding. (struct line_map_ordinary): Drop field "column_bits" in favor of field "m_column_and_range_bits"; add field "m_range_bits". (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Delete. (location_adhoc_data): Add source_range field. (struct line_maps): Add fields "default_range_bits", "num_optimized_ranges" and "num_unoptimized_ranges". (get_combined_adhoc_loc): Add source_range param. (get_range_from_loc): New declaration. (pure_location_p): New prototype. (COMBINE_LOCATION_DATA): Add source_range param. (SOURCE_LINE): Update for renaming of column_bits. (SOURCE_COLUMN): Likewise. Shift the column right by the map's range_bits. (LAST_SOURCE_LINE_LOCATION): Update for renaming of column_bits. (linemap_position_for_line_and_column): Add line_maps * params. (rich_location::rich_location): Likewise. * lex.c (_cpp_lex_direct): Capture the range of the token, baking it into token->src_loc via a call to COMBINE_LOCATION_DATA. * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): Reduce from 1U << 17 to 1U << 12. (location_adhoc_data_hash): Add the src_range into the hash value. (location_adhoc_data_eq): Require equality of the src_range values. (can_be_stored_compactly_p): New function. (get_combined_adhoc_loc): Add src_range param, and store it, via a bit-packing scheme for short ranges, otherwise within the lookaside table. Remove the requirement that data is non-NULL. (get_range_from_adhoc_loc): New function. (get_range_from_loc): New function. (pure_location_p): New function. (linemap_add): Ensure that start_location has zero for the range_bits, unless we're past LINE_MAP_MAX_LOCATION_WITH_COLS. Initialize range_bits to zero. Assert that the start_location is "pure". (linemap_line_start): Assert that the column_and_range_bits >= range_bits. Update determinination of whether we need to start a new map using the effective column bits, without the range bits. Use the set's default_range_bits in new maps, apart from those with column_bits == 0, which should also have 0 range_bits. Increase the column bits for new maps by the range bits. When adding lines to an existing map, use set->highest_line directly rather than offsetting highest by SOURCE_COLUMN. Add assertions to sanity-check the return value. (linemap_position_for_column): Offset to_column by range_bits. Update set->highest_location if necessary. (linemap_position_for_line_and_column): Add line_maps * param. Update the calculation to offset the column by range_bits, and conditionalize it on being <= LINE_MAP_MAX_LOCATION_WITH_COLS. Bound it by LINEMAPS_MACRO_LOWEST_LOCATION. Update set->highest_location if necessary. (linemap_position_for_loc_and_offset): Handle ad-hoc locations; pass "set" to linemap_position_for_line_and_column. (linemap_macro_map_loc_unwind_toward_spelling): Add line_maps param. Handle ad-hoc locations. (linemap_location_in_system_header_p): Pass on "set" to call to linemap_macro_map_loc_unwind_toward_spelling. (linemap_macro_loc_to_spelling_point): Retain ad-hoc locations. Pass on "set" to call to linemap_macro_map_loc_unwind_toward_spelling. (linemap_resolve_location): Retain ad-hoc locations. Pass on "set" to call to linemap_macro_map_loc_unwind_toward_spelling. (linemap_unwind_toward_expansion): Pass on "set" to call to linemap_macro_map_loc_unwind_toward_spelling. (linemap_expand_location): Extract the data pointer before extracting the location. (rich_location::rich_location): Add line_maps param; use it to extract the range from the source_location. * location-example.txt: Regenerate, showing new representation. From-SVN: r230331
2015-11-13 17:29:59 +01:00
rich_location richloc (line_table, location);
va_start (ap, gmsgid);
Reimplement diagnostic_show_locus, introducing rich_location classes gcc/ChangeLog: * diagnostic-color.c (color_dict): Eliminate "caret"; add "range1" and "range2". (parse_gcc_colors): Update comment to describe default GCC_COLORS. * diagnostic-core.h (warning_at_rich_loc): New declaration. (error_at_rich_loc): New declaration. (permerror_at_rich_loc): New declaration. (inform_at_rich_loc): New declaration. * diagnostic-show-locus.c (adjust_line): Delete. (struct point_state): New struct. (class colorizer): New class. (class layout_point): New class. (class layout_range): New class. (struct line_bounds): New. (class layout): New class. (colorizer::colorizer): New ctor. (colorizer::~colorizer): New dtor. (layout::layout): New ctor. (layout::print_source_line): New method. (layout::print_annotation_line): New method. (layout::get_state_at_point): New method. (layout::get_x_bound_for_row): New method. (diagnostic_show_locus): Reimplement in terms of class layout. (diagnostic_print_caret_line): Delete. * diagnostic.c (diagnostic_initialize): Replace MAX_LOCATIONS_PER_MESSAGE with rich_location::MAX_RANGES. (diagnostic_set_info_translated): Convert param from location_t to rich_location *. Eliminate calls to set_location on the message in favor of storing the rich_location ptr there. (diagnostic_set_info): Convert param from location_t to rich_location *. (diagnostic_build_prefix): Break out array into... (diagnostic_kind_color): New variable. (diagnostic_get_color_for_kind): New function. (diagnostic_report_diagnostic): Colorize the option_text using the color for the severity. (diagnostic_append_note): Update for change in signature of diagnostic_set_info. (diagnostic_append_note_at_rich_loc): New function. (emit_diagnostic): Update for change in signature of diagnostic_set_info. (inform): Likewise. (inform_at_rich_loc): New function. (inform_n): Update for change in signature of diagnostic_set_info. (warning): Likewise. (warning_at): Likewise. (warning_at_rich_loc): New function. (warning_n): Update for change in signature of diagnostic_set_info. (pedwarn): Likewise. (permerror): Likewise. (permerror_at_rich_loc): New function. (error): Update for change in signature of diagnostic_set_info. (error_n): Likewise. (error_at): Likewise. (error_at_rich_loc): New function. (sorry): Update for change in signature of diagnostic_set_info. (fatal_error): Likewise. (internal_error): Likewise. (internal_error_no_backtrace): Likewise. (source_range::debug): New function. * diagnostic.h (struct diagnostic_info): Eliminate field "override_column". Add field "richloc". (struct diagnostic_context): Add field "colorize_source_p". (diagnostic_override_column): Delete. (diagnostic_set_info): Convert param from location_t to rich_location *. (diagnostic_set_info_translated): Likewise. (diagnostic_append_note_at_rich_loc): New function. (diagnostic_num_locations): New function. (diagnostic_expand_location): Get the location from the rich_location. (diagnostic_print_caret_line): Delete. (diagnostic_get_color_for_kind): New declaration. * genmatch.c (linemap_client_expand_location_to_spelling_point): New. (error_cb): Update for change in signature of "error" callback. (fatal_at): Likewise. (warning_at): Likewise. * input.c (linemap_client_expand_location_to_spelling_point): New. * pretty-print.c (text_info::set_range): New method. (text_info::get_location): New method. * pretty-print.h (MAX_LOCATIONS_PER_MESSAGE): Eliminate this macro. (struct text_info): Eliminate "locations" array in favor of "m_richloc", a rich_location *. (textinfo::set_location): Add a "caret_p" param, and reimplement in terms of a call to set_range. (textinfo::get_location): Eliminate inline implementation in favor of an out-of-line reimplementation. (textinfo::set_range): New method. * rtl-error.c (diagnostic_for_asm): Update for change in signature of diagnostic_set_info. * tree-diagnostic.c (default_tree_printer): Update for new "caret_p" param for textinfo::set_location. * tree-pretty-print.c (percent_K_format): Likewise. gcc/c-family/ChangeLog: * c-common.c (c_cpp_error): Convert parameter from location_t to rich_location *. Eliminate the "column_override" parameter and the call to diagnostic_override_column. Update the "done_lexing" clause to set range 0 on the rich_location, rather than overwriting a location_t. * c-common.h (c_cpp_error): Convert parameter from location_t to rich_location *. Eliminate the "column_override" parameter. gcc/c/ChangeLog: * c-decl.c (warn_defaults_to): Update for change in signature of diagnostic_set_info. * c-errors.c (pedwarn_c99): Likewise. (pedwarn_c90): Likewise. * c-objc-common.c (c_tree_printer): Update for new "caret_p" param for textinfo::set_location. gcc/cp/ChangeLog: * error.c (cp_printer): Update for new "caret_p" param for textinfo::set_location. (pedwarn_cxx98): Update for change in signature of diagnostic_set_info. gcc/fortran/ChangeLog: * cpp.c (cb_cpp_error): Convert parameter from location_t to rich_location *. Eliminate the "column_override" parameter. * error.c (gfc_warning): Update for change in signature of diagnostic_set_info. (gfc_format_decoder): Update handling of %C/%L for changes to struct text_info. (gfc_diagnostic_starter): Use richloc when determining whether to print one locus or two. When handling a location that will involve a call to diagnostic_show_locus, only attempt to print the locus for the primary location, and don't call into diagnostic_print_caret_line. (gfc_warning_now_at): Update for change in signature of diagnostic_set_info. (gfc_warning_now): Likewise. (gfc_error_now): Likewise. (gfc_fatal_error): Likewise. (gfc_error): Likewise. (gfc_internal_error): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic-test-show-locus-bw.c: New file. * gcc.dg/plugin/diagnostic-test-show-locus-color.c: New file. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: New file. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the above. * lib/gcc-dg.exp: Load multiline.exp. libcpp/ChangeLog: * errors.c (cpp_diagnostic): Update for change in signature of "error" callback. (cpp_diagnostic_with_line): Likewise, calling override_column on the rich_location. * include/cpplib.h (struct cpp_callbacks): Within "error" callback, convert param from source_location to rich_location *, and drop column_override param. * include/line-map.h (struct source_range): New struct. (struct location_range): New struct. (class rich_location): New class. (linemap_client_expand_location_to_spelling_point): New declaration. * line-map.c (rich_location::rich_location): New ctors. (rich_location::lazily_expand_location): New method. (rich_location::override_column): New method. (rich_location::add_range): New methods. (rich_location::set_range): New method. From-SVN: r229884
2015-11-06 20:50:50 +01:00
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
(cxx_dialect == cxx98) ? DK_PEDWARN : DK_WARNING);
diagnostic.option_index = opt;
ret = report_diagnostic (&diagnostic);
va_end (ap);
return ret;
}
/* Issue a diagnostic that NAME cannot be found in SCOPE. DECL is what
we found when we tried to do the lookup. LOCATION is the location of
the NAME identifier. */
void
qualified_name_lookup_error (tree scope, tree name,
tree decl, location_t location)
{
if (scope == error_mark_node)
; /* We already complained. */
else if (TYPE_P (scope))
{
if (!COMPLETE_TYPE_P (scope))
error_at (location, "incomplete type %qT used in nested name specifier",
scope);
else if (TREE_CODE (decl) == TREE_LIST)
{
error_at (location, "reference to %<%T::%D%> is ambiguous",
scope, name);
print_candidates (decl);
}
else
error_at (location, "%qD is not a member of %qT", name, scope);
}
else if (scope != global_namespace)
{
error_at (location, "%qD is not a member of %qD", name, scope);
if (!suggest_alternative_in_explicit_scope (location, name, scope))
suggest_alternatives_for (location, name, false);
}
else
{
error_at (location, "%<::%D%> has not been declared", name);
suggest_alternatives_for (location, name, true);
}
}