gcc/gcc/cp/cp-tree.h

7102 lines
281 KiB
C
Raw Permalink Normal View History

1994-02-24 02:02:37 +01:00
/* Definitions for C++ parsing and type checking.
Copyright (C) 1987-2017 Free Software Foundation, Inc.
c-common.c (decl_attributes): Set DECL_SIZE_UNIT. * c-common.c (decl_attributes): Set DECL_SIZE_UNIT. * c-decl.c (duplicate_decls, finish_enum): Likewise. (finish_decl): Remove -Wlarger-than code from here. * flags.h (id_clash_len): Now int. (larger_than_size): Now HOST_WIDE_INT. * fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed. Clean up checking to see if in table. (make_bit_field_ref): Remove extra parm to bitsize_int. * ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT. * print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT. * stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size and for computing size of decl. * stor-layout.c (layout_decl): Set DECL_SIZE_UNIT. Move -Wlarger-than code to here. (layout_record): Remove extra arg to bitsize_int. Set TYPE_BINFO_SIZE_UNIT. (layout_union): Remove extra arg to bitsize_int. Use proper type for size of QUAL_UNION. (layout_type): Remove extra arg to bitsize_int. * toplev.c (id_clash_len): Now int. (larger_than_size): Now HOST_WIDE_INT. (decode_W_option): Clean up id-clash and larger-than- cases. * tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts. (expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined. * tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New. (struct tree_decl): New field size_unit. (size_int_wide): No HIGH operand; NUMBER is now signed. (size_int_2): Deleted. (size_int, bitsize_int): Don't use it and rework args. * varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT. * ch/decl.c (layout_enum): Set DECL_SIZE_UNIT. * ch/satisfy.c (safe_satisfy_decl): Likewise. * cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise. (avoid_overlap, build_base_field): Likewise. (build_base_field, build_base_fields, is_empty_class): Test DECL_SIZE with integer_zero. (layout_class_type): Set CLASSTYPE_SIZE_UNIT. * cp/cp-tree.h (struct lang_type): New field size_unit. (CLASSTYPE_SIZE_UNIT): New macro. * cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT. (cp_finish_decl): Delete -Wlarger-than processing. * cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT. * cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT. * cp/tree.c (make_binfo): binfo vector is one entry longer. (walk_tree): Walk DECL_SIZE_UNIT. * f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT. (ffecom_transform_common_, ffecom_transform_equiv_): Likewise. (duplicate_decls): Likewise. (ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int. (finish_decl): Delete -Wlarger-than processing. * java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT. * java/constants.c (build_constants_constructor): Likewise. From-SVN: r32068
2000-02-20 02:11:00 +01:00
Contributed by Michael Tiemann (tiemann@cygnus.com)
1994-02-24 02:02:37 +01:00
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
#ifndef GCC_CP_TREE_H
#define GCC_CP_TREE_H
function.h: Flatten file. 2014-10-16 Andrew MacLeod <amacleod@redhat.com> * function.h: Flatten file. Remove includes, adjust prototypes to reflect only what is in function.h. (enum direction, struct args_size, struct locate_and_pad_arg_data, ADD_PARM_SIZE, SUB_PARM_SIZE, ARGS_SIZE_TREE, ARGS_SIZE_RTX): Relocate from expr.h. (ASLK_REDUCE_ALIGN, ASLK_RECORD_PAD): Relocate from rtl.h. (optimize_function_for_size_p, optimize_function_for_speed_p): Move prototypes to predict.h. (init_varasm_status): Move prototype to varasm.h. * expr.h: Adjust include files. (enum direction, struct args_size, struct locate_and_pad_arg_data, ADD_PARM_SIZE, SUB_PARM_SIZE, ARGS_SIZE_TREE, ARGS_SIZE_RTX): Move to function.h. (locate_and_pad_parm): Move prototype to function.h. * rtl.h: (assign_stack_local, ASLK_REDUCE_ALIGN, ASLK_RECORD_PAD, assign_stack_local_1, assign_stack_temp, assign_stack_temp_for_type, assign_temp, reposition_prologue_and_epilogue_notes, prologue_epilogue_contains, sibcall_epilogue_contains, update_temp_slot_address, maybe_copy_prologue_epilogue_insn, set_return_jump_label): Move prototypes to function.h. * predict.h (optimize_function_for_size_p, optimize_function_for_speed_p): Relocate prototypes from function.h. * shrink-wrap.h (emit_return_into_block, active_insn_between, convert_jumps_to_returns, emit_return_for_exit): Move prototypes to function.h. * varasm.h (init_varasm_status): Relocate prototype from function.h. * genattrtab.c (write_header): Add predict.h to include list. * genconditions.c (write_header): Add predict.h to include list. * genemit.c (main): Adjust header file includes. * gengtype.c (ifiles): Add flattened function.h header files. * genoutput.c (output_prologue): Add predict.h to include list. * genpreds.c (write_insn_preds_c): Adjust header file includes. * genrecog.c (write_header): Add flattened function.h header files. * alias.c: Adjust include files. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgrtl.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbxout.c: Likewise. * ddg.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dojump.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * explow.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * function.c: Likewise. * gcse.c: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-streamer.h: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lcm.c: Likewise. * loop-invariant.c: Likewise. * lra-assigns.c: Likewise. * lra-coalesce.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * passes.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regrename.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtlanal.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * statistics.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * symtab.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-profile.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-propagate.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-stdarg.c: Likewise. * tree-tailcall.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * valtrack.c: Likewise. * varasm.c: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * testsuite/g++.dg/plugin/pragma_plugin.c: Adjust include files. * config/aarch64/aarch64.c: Add flattened includes from function.h. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/arm.c: Likewise. * config/avr/avr-log.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/cr16/cr16.c: Likewise. * config/cris/cris.c: Likewise. * config/darwin.c: Likewise. * config/epiphany/epiphany.c: Likewise. * config/epiphany/mode-switch-use.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/h8300/h8300.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/microblaze/microblaze.c: Likewise. * config/mips/mips.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/msp430/msp430.c: Likewise. * config/nds32/nds32-cost.c: Likewise. * config/nds32/nds32-fp-as-gp.c: Likewise. * config/nds32/nds32-intrinsic.c: Likewise. * config/nds32/nds32-isr.c: Likewise. * config/nds32/nds32-md-auxiliary.c: Likewise. * config/nds32/nds32-memory-manipulation.c: Likewise. * config/nds32/nds32-pipelines-auxiliary.c: Likewise. * config/nds32/nds32-predicates.c: Likewise. * config/nds32/nds32.c: Likewise. * config/nios2/nios2.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/rl78/rl78.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390.c: Likewise. * config/score/score.c: Likewise. * config/sh/sh.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/tilegx/tilegx.c: Likewise. * config/tilepro/tilepro.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/xtensa/xtensa.c: Likewise. 2014-10-16 Andrew MacLeod <amacleod@redhat.com> * ada/gcc-interface/misc.c: Adjust include files. 2014-10-16 Andrew MacLeod <amacleod@redhat.com> * c/c-decl.c: Adjust include files. 2014-10-16 Andrew MacLeod <amacleod@redhat.com> * c-family/c-pragma.c: Adjust include files. * c-family/c-semantics.c: Likewise. 2014-10-16 Andrew MacLeod <amacleod@redhat.com> * cp/cp-tree.h: Adjust include files. 2014-10-16 Andrew MacLeod <amacleod@redhat.com> * fortran/f95-lang.c: Adjust include files. * fortran/trans-decl.c: Likewise. 2014-10-16 Andrew MacLeod <amacleod@redhat.com> * java/class.c: Adjust include files. * java/resource.c: Likewise. 2014-10-16 Andrew MacLeod <amacleod@redhat.com> * objc/objc-act.c: Adjust include files. From-SVN: r216337
2014-10-16 18:37:19 +02:00
#include "tm.h"
#include "hard-reg-set.h"
#include "function.h"
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
/* In order for the format checking to accept the C++ front end
diagnostic framework extensions, you must include this file before
toplev.h: Do not include diagnostic-core.h. 2010-07-08 Manuel López-Ibáñez <manu@gcc.gnu.org> * toplev.h: Do not include diagnostic-core.h. Include diagnostic-core.h in every file that includes toplev.h. * c-tree.h: Do not include toplev.h. * pretty-print.h: Update comment. * Makefile.in: Update dependencies. * alias.c: Include diagnostic-core.h in every file that includes toplev.h. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/pe.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/cris/cris.c: Likewise. * config/crx/crx.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/h8300/h8300.c: Likewise. * config/host-darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/netware.c: Likewise. * config/i386/nwld.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68hc11/m68hc11.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/picochip/picochip.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390.c: Likewise. * config/score/score.c: Likewise. * config/score/score3.c: Likewise. * config/score/score7.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-base.c: Likewise. * config/sh/symbian-c.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sol2-c.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * convert.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbxout.c: Likewise. * ddg.c: Likewise. * dominance.c: Likewise. * emit-rtl.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * gimple-low.c: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * implicit-zee.c: Likewise. * integrate.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-iv.c: Likewise. * lto-opts.c: Likewise. * lto-symtab.c: Likewise. * main.c: Likewise. * modulo-sched.c: Likewise. * optabs.c: Likewise. * params.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtlanal.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * simplify-rtx.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * targhooks.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-nomudflap.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-phinodes.c: Likewise. * tree-profile.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * varasm.c: Likewise. * vec.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. c-family/ * c-common.h: Include diagnostic-core.h. Error if already included. * c-semantics.c: Do not define GCC_DIAG_STYLE here. cp/ * cp-tree.h: Do not include toplev.h. java/ * boehm.c: Include diagnostic-core.h in every file that includes toplev.h. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. ada/ * gcc-interface/utils.c: Include diagnostic-core.h in every file that includes toplev.h. lto/ * lto-coff.c: Include diagnostic-core.h in every file that includes toplev.h. * lto-elf.c: Likewise. * lto-lang.c: Likewise. * lto-macho.c: Likewise. From-SVN: r161943
2010-07-08 06:22:54 +02:00
diagnostic-core.h, not after. We override the definition of GCC_DIAG_STYLE
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
in c-common.h. */
#undef GCC_DIAG_STYLE
#define GCC_DIAG_STYLE __gcc_cxxdiag__
toplev.h: Do not include diagnostic-core.h. 2010-07-08 Manuel López-Ibáñez <manu@gcc.gnu.org> * toplev.h: Do not include diagnostic-core.h. Include diagnostic-core.h in every file that includes toplev.h. * c-tree.h: Do not include toplev.h. * pretty-print.h: Update comment. * Makefile.in: Update dependencies. * alias.c: Include diagnostic-core.h in every file that includes toplev.h. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/pe.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/cris/cris.c: Likewise. * config/crx/crx.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/h8300/h8300.c: Likewise. * config/host-darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/netware.c: Likewise. * config/i386/nwld.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68hc11/m68hc11.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/picochip/picochip.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390.c: Likewise. * config/score/score.c: Likewise. * config/score/score3.c: Likewise. * config/score/score7.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-base.c: Likewise. * config/sh/symbian-c.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sol2-c.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * convert.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbxout.c: Likewise. * ddg.c: Likewise. * dominance.c: Likewise. * emit-rtl.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * gimple-low.c: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * implicit-zee.c: Likewise. * integrate.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-iv.c: Likewise. * lto-opts.c: Likewise. * lto-symtab.c: Likewise. * main.c: Likewise. * modulo-sched.c: Likewise. * optabs.c: Likewise. * params.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtlanal.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * simplify-rtx.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * targhooks.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-nomudflap.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-phinodes.c: Likewise. * tree-profile.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * varasm.c: Likewise. * vec.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. c-family/ * c-common.h: Include diagnostic-core.h. Error if already included. * c-semantics.c: Do not define GCC_DIAG_STYLE here. cp/ * cp-tree.h: Do not include toplev.h. java/ * boehm.c: Include diagnostic-core.h in every file that includes toplev.h. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. ada/ * gcc-interface/utils.c: Include diagnostic-core.h in every file that includes toplev.h. lto/ * lto-coff.c: Include diagnostic-core.h in every file that includes toplev.h. * lto-elf.c: Likewise. * lto-lang.c: Likewise. * lto-macho.c: Likewise. From-SVN: r161943
2010-07-08 06:22:54 +02:00
#if defined(GCC_DIAGNOSTIC_CORE_H) || defined (GCC_C_COMMON_H)
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
#error \
In order for the format checking to accept the C++ front end diagnostic \
toplev.h: Do not include diagnostic-core.h. 2010-07-08 Manuel López-Ibáñez <manu@gcc.gnu.org> * toplev.h: Do not include diagnostic-core.h. Include diagnostic-core.h in every file that includes toplev.h. * c-tree.h: Do not include toplev.h. * pretty-print.h: Update comment. * Makefile.in: Update dependencies. * alias.c: Include diagnostic-core.h in every file that includes toplev.h. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/pe.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/cris/cris.c: Likewise. * config/crx/crx.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/h8300/h8300.c: Likewise. * config/host-darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/netware.c: Likewise. * config/i386/nwld.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68hc11/m68hc11.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/picochip/picochip.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390.c: Likewise. * config/score/score.c: Likewise. * config/score/score3.c: Likewise. * config/score/score7.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-base.c: Likewise. * config/sh/symbian-c.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sol2-c.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * convert.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbxout.c: Likewise. * ddg.c: Likewise. * dominance.c: Likewise. * emit-rtl.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * gimple-low.c: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * implicit-zee.c: Likewise. * integrate.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-iv.c: Likewise. * lto-opts.c: Likewise. * lto-symtab.c: Likewise. * main.c: Likewise. * modulo-sched.c: Likewise. * optabs.c: Likewise. * params.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtlanal.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * simplify-rtx.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * targhooks.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-nomudflap.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-phinodes.c: Likewise. * tree-profile.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * varasm.c: Likewise. * vec.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. c-family/ * c-common.h: Include diagnostic-core.h. Error if already included. * c-semantics.c: Do not define GCC_DIAG_STYLE here. cp/ * cp-tree.h: Do not include toplev.h. java/ * boehm.c: Include diagnostic-core.h in every file that includes toplev.h. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. ada/ * gcc-interface/utils.c: Include diagnostic-core.h in every file that includes toplev.h. lto/ * lto-coff.c: Include diagnostic-core.h in every file that includes toplev.h. * lto-elf.c: Likewise. * lto-lang.c: Likewise. * lto-macho.c: Likewise. From-SVN: r161943
2010-07-08 06:22:54 +02:00
framework extensions, you must include this file before diagnostic-core.h and \
c-common.h, not after.
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
#endif
c-common.c: Move to c-family/. gcc/ChangeLog: * c-common.c: Move to c-family/. * c-common.def: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-format.h : Likewise. * c-gimplify.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c.opt: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pragma.h: Likewise. * c-pretty-print.c: Likewise. * c-pretty-print.h: Likewise. * c-semantics.c: Likewise. * stub-objc.c: Likewise. * gengtype.c (get_file_langdir): Special-case files in c-family/. (get_output_file_with_visibility): Fix name for c-common.h. * c-config-lang.in: Update paths in gtfiles for files in c-family/. * c-tree.h: Update include path for moved files. * c-lang.c: Likewise. * c-lang.h: Likewise. * c-parser.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-objc-common.c: Likewise. * configure.ac: Make sure c-family/ exists in the build directory. * configure: Regenerate. * Makefile.in: Update paths for moved files. Regroup files per location and update dependencies. Move generated_files down after ALL_GTFILES_H. * config/spu/spu-c.c: Update paths for moved files. * config/mep/mep-pragma.c: Likewise. * config/darwin-c.c: Likewise. * config/i386/msformat-c.c: Likewise. * config/i386/i386-c.c: Likewise. * config/avr/avr-c.c: Likewise. * config/sol2-c.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/arm-c.c: Likewise. * config/h8300/h8300.c: Likewise. * config/v850/v850-c.c: Likewise. * config/t-darwin: Fix dependencies for moved files. * config/t-sol2: Fix dependencies for moved files. * config/mep/t-mep: Fix dependencies for moved files. * config/ia64/t-ia64: Fix dependencies for moved files. * config/rs6000/t-rs6000: Fix dependencies for moved files. * config/v850/t-v850: Fix dependencies for moved files. * config/v850/t-v850e: Fix dependencies for moved files. * config/m32c/m32c-pragma.c * po/exgettext: Look in c-family/ also. c-family/ChangeLog: * c-common.c: Include gt-c-family-c-common.h. * c-pragma.c: Include gt-c-family-c-pragma.h. objc/ChangeLog: * objc-act.c: Update include path for moved files. * objc-lang.c: Likewise. * config-lang.in: Update paths in gtfiles for files in c-family/. objcp/ChangeLog: * objcp-lang.c: Update include path for moved files. * config-lang.in: Update paths in gtfiles for files in c-family/. cp/ChangeLog: * typeck.c: Update include path for moved files. * decl.c: Likewise. * rtti.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * pt.c: Likewise. * semantics.c: Likewise. * cxx-pretty-print.h: Likewise. * decl2.c: Likewise. * parser.c: Likewise. * cp-objcp-common.c: Likewise. * cp-tree.h: Likewise. * name-lookup.c: Likewise. * lex.c: Likewise. * name-lookup.h: Likewise. * config-lang.in: Update paths in gtfiles for files in c-family/. * Make-lang.in: Likewise. From-SVN: r160330
2010-06-05 22:33:22 +02:00
#include "c-family/c-common.h"
toplev.h: Do not include diagnostic-core.h. 2010-07-08 Manuel López-Ibáñez <manu@gcc.gnu.org> * toplev.h: Do not include diagnostic-core.h. Include diagnostic-core.h in every file that includes toplev.h. * c-tree.h: Do not include toplev.h. * pretty-print.h: Update comment. * Makefile.in: Update dependencies. * alias.c: Include diagnostic-core.h in every file that includes toplev.h. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/pe.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/cris/cris.c: Likewise. * config/crx/crx.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/h8300/h8300.c: Likewise. * config/host-darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/netware.c: Likewise. * config/i386/nwld.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68hc11/m68hc11.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/picochip/picochip.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390.c: Likewise. * config/score/score.c: Likewise. * config/score/score3.c: Likewise. * config/score/score7.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-base.c: Likewise. * config/sh/symbian-c.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sol2-c.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * convert.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbxout.c: Likewise. * ddg.c: Likewise. * dominance.c: Likewise. * emit-rtl.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * gimple-low.c: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * implicit-zee.c: Likewise. * integrate.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-iv.c: Likewise. * lto-opts.c: Likewise. * lto-symtab.c: Likewise. * main.c: Likewise. * modulo-sched.c: Likewise. * optabs.c: Likewise. * params.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtlanal.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * simplify-rtx.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * targhooks.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-nomudflap.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-phinodes.c: Likewise. * tree-profile.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * varasm.c: Likewise. * vec.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. c-family/ * c-common.h: Include diagnostic-core.h. Error if already included. * c-semantics.c: Do not define GCC_DIAG_STYLE here. cp/ * cp-tree.h: Do not include toplev.h. java/ * boehm.c: Include diagnostic-core.h in every file that includes toplev.h. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. ada/ * gcc-interface/utils.c: Include diagnostic-core.h in every file that includes toplev.h. lto/ * lto-coff.c: Include diagnostic-core.h in every file that includes toplev.h. * lto-elf.c: Likewise. * lto-lang.c: Likewise. * lto-macho.c: Likewise. From-SVN: r161943
2010-07-08 06:22:54 +02:00
#include "diagnostic.h"
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
/* A tree node, together with a location, so that we can track locations
(and ranges) during parsing.
The location is redundant for node kinds that have locations,
but not all node kinds do (e.g. constants, and references to
params, locals, etc), so we stash a copy here. */
class cp_expr
{
public:
cp_expr () :
m_value (NULL), m_loc (UNKNOWN_LOCATION) {}
cp_expr (tree value) :
m_value (value), m_loc (EXPR_LOCATION (m_value)) {}
cp_expr (tree value, location_t loc):
m_value (value), m_loc (loc) {}
cp_expr (const cp_expr &other) :
m_value (other.m_value), m_loc (other.m_loc) {}
/* Implicit conversions to tree. */
operator tree () const { return m_value; }
tree & operator* () { return m_value; }
tree & operator-> () { return m_value; }
tree get_value () const { return m_value; }
location_t get_location () const { return m_loc; }
location_t get_start () const
{
source_range src_range = get_range_from_loc (line_table, m_loc);
return src_range.m_start;
}
location_t get_finish () const
{
source_range src_range = get_range_from_loc (line_table, m_loc);
return src_range.m_finish;
}
void set_location (location_t loc)
{
protected_set_expr_location (m_value, loc);
m_loc = loc;
}
void set_range (location_t start, location_t finish)
{
set_location (make_location (m_loc, start, finish));
}
private:
tree m_value;
location_t m_loc;
};
inline bool
operator == (const cp_expr &lhs, tree rhs)
{
return lhs.get_value () == rhs;
}
#include "name-lookup.h"
/* Usage of TREE_LANG_FLAG_?:
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
COND_EXPR_IS_VEC_DELETE (in COND_EXPR).
DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR).
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
CLEANUP_P (in TRY_BLOCK)
AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF, SCOPE_REF)
PAREN_STRING_LITERAL (in STRING_CST)
CP_DECL_THREAD_LOCAL_P (in VAR_DECL)
KOENIG_LOOKUP_P (in CALL_EXPR)
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
STATEMENT_LIST_NO_SCOPE (in STATEMENT_LIST).
EXPR_STMT_STMT_EXPR_RESULT (in EXPR_STMT)
STMT_EXPR_NO_SCOPE (in STMT_EXPR)
BIND_EXPR_TRY_BLOCK (in BIND_EXPR)
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_ENUM_P (in TYPENAME_TYPE)
builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, [...]): New. gcc/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. * cgraph.h (enum cgraph_simd_clone_arg_type): Add SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP, SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP. (struct cgraph_simd_clone_arg): Adjust comment. * coretypes.h (struct gomp_ordered): New forward decl. * gimple.c (gimple_build_omp_critical): Add CLAUSES argument, set critical clauses to it. (gimple_build_omp_ordered): Return gomp_ordered * instead of gimple *. Add CLAUSES argument, set ordered clauses to it. (gimple_copy): Unshare clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimple.def (GIMPLE_OMP_ORDERED): Change from GSS_OMP to GSS_OMP_SINGLE_LAYOUT, move it after GIMPLE_OMP_TEAMS. * gimple.h (enum gf_mask): Add GF_OMP_TASK_TASKLOOP. Add another bit to GF_OMP_FOR_KIND_MASK mask. Add GF_OMP_FOR_KIND_TASKLOOP, renumber GF_OMP_FOR_KIND_CILKFOR and GF_OMP_FOR_KIND_OACC_LOOP. Adjust GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED and GF_OMP_FOR_COMBINED_INTO. Add another bit to GF_OMP_TARGET_KIND_MASK mask. Add GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, renumber GF_OMP_TARGET_KIND_OACC_{PARALLEL,KERNELS,DATA,UPDATE,ENTER_EXIT_DATA}. (gomp_critical): Add clauses field. (gomp_ordered): New struct. (is_a_helper <gomp_ordered *>::test): New inline. (gimple_build_omp_critical): Add CLAUSES argument. (gimple_build_omp_ordered): Likewise. Return gomp_ordered * instead of gimple *. (gimple_omp_critical_clauses, gimple_omp_critical_clauses_ptr, gimple_omp_critical_set_clauses, gimple_omp_ordered_clauses, gimple_omp_ordered_clauses_ptr, gimple_omp_ordered_set_clauses, gimple_omp_task_taskloop_p, gimple_omp_task_set_taskloop_p): New inline functions. * gimple-pretty-print.c (dump_gimple_omp_for): Handle taskloop. (dump_gimple_omp_target): Handle enter data and exit data. (dump_gimple_omp_block): Don't handle GIMPLE_OMP_ORDERED here. (dump_gimple_omp_critical): Print clauses. (dump_gimple_omp_ordered): New function. (dump_gimple_omp_task): Handle taskloop. (pp_gimple_stmt_1): Use dump_gimple_omp_ordered for GIMPLE_OMP_ORDERED. * gimple-walk.c (walk_gimple_op): Walk clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_0LEN_ARRAY. (enum omp_region_type): Add ORT_COMBINED_TARGET and ORT_NONE. (struct gimplify_omp_ctx): Add loop_iter_var, target_map_scalars_firstprivate, target_map_pointers_as_0len_arrays and target_firstprivatize_array_bases fields. (delete_omp_context): Release loop_iter_var. (gimplify_bind_expr): Handle ORT_NONE. (maybe_fold_stmt): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (is_gimple_stmt): Return true for OMP_TASKLOOP, OMP_TEAMS and OMP_TARGET{,_DATA,_UPDATE,_ENTER_DATA,_EXIT_DATA}. (omp_firstprivatize_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle ctx->target_map_scalars_firstprivate. (omp_add_variable): Handle ORT_NONE. Allow map clause together with data sharing clauses. For data sharing clause with VLA decl on omp target/target data don't add firstprivate for the pointer. Call omp_notice_variable on TYPE_SIZE_UNIT only if it is a DECL_P. (omp_notice_threadprivate_variable): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (omp_notice_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle implicit mapping of pointers as zero length array sections and ctx->target_map_scalars_firstprivate mapping of scalars as firstprivate data sharing. (omp_check_private): Handle omp_member_access_dummy_var vars. (find_decl_expr): New function. (gimplify_scan_omp_clauses): Add CODE argument. For OMP_CLAUSE_IF complain if OMP_CLAUSE_IF_MODIFIER is present and does not match code. Handle OMP_CLAUSE_GANG separately. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. Diagnose linear clause on combined distribute {, parallel for} simd construct, unless it is the loop iterator. Handle struct element GOMP_MAP_FIRSTPRIVATE_POINTER. Handle map clauses with COMPONENT_REF. Initialize ctx->target_map_scalars_firstprivate, ctx->target_firstprivatize_array_bases and ctx->target_map_pointers_as_0len_arrays. Add firstprivate for linear clause even to target region if combined. Remove map clauses with GOMP_MAP_FIRSTPRIVATE_POINTER kind from OMP_TARGET_{,ENTER_,EXIT_}DATA. For GOMP_MAP_FIRSTPRIVATE_POINTER map kind with non-INTEGER_CST OMP_CLAUSE_SIZE firstprivatize the bias. Handle OMP_CLAUSE_DEPEND_{SINK,SOURCE}. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. For linear clause on worksharing loop combined with parallel add shared clause on the parallel. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set DECL_NAME on omp_member_access_dummy_var vars. Add lastprivate clause to outer taskloop if needed. (gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_0LEN_ARRAY. If gimplify_omp_ctxp->target_firstprivatize_array_bases, use GOMP_MAP_FIRSTPRIVATE_POINTER map kind instead of GOMP_MAP_POINTER. (gimplify_adjust_omp_clauses): Add CODE argument. Handle removal of GOMP_MAP_FIRSTPRIVATE_POINTER struct elements for struct not seen in target body. Handle removal of struct mapping if struct is not seen in target body. Remove GOMP_MAP_STRUCT map clause on OMP_TARGET_EXIT_DATA. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Use GOMP_MAP_FIRSTPRIVATE_POINTER instead of GOMP_MAP_POINTER if ctx->target_firstprivatize_array_bases for VLAs. Set OMP_CLAUSE_MAP_PRIVATE if both data sharing and map clause appear together. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. Don't remove map clause if it has map-type-modifier always. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. (gimplify_oacc_cache, gimplify_omp_parallel, gimplify_omp_task): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. (gimplify_omp_for): Likewise. Handle OMP_TASKLOOP. Initialize loop_iter_var. Use OMP_FOR_ORIG_DECLS. Fix handling of lastprivate iterators in doacross loops. (gimplify_omp_workshare): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Use ORT_COMBINED_TARGET for OMP_TARGET_COMBINED. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (gimplify_omp_target_update): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Handle OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. (gimplify_omp_ordered): New function. (gimplify_expr): Handle OMP_TASKLOOP, OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. Use gimplify_omp_ordered for OMP_ORDERED. Gimplify clauses on OMP_CRITICAL. * internal-fn.c (expand_GOMP_SIMD_ORDERED_START, expand_GOMP_SIMD_ORDERED_END): New functions. * internal-fn.def (GOMP_SIMD_ORDERED_START, GOMP_SIMD_ORDERED_END): New internal functions. * omp-builtins.def (BUILT_IN_GOMP_LOOP_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_DOACROSS_POST, BUILT_IN_GOMP_DOACROSS_WAIT, BUILT_IN_GOMP_DOACROSS_ULL_POST, BUILT_IN_GOMP_DOACROSS_ULL_WAIT, BUILT_IN_GOMP_TARGET_ENTER_EXIT_DATA, BUILT_IN_GOMP_TASKLOOP, BUILT_IN_GOMP_TASKLOOP_ULL): New built-ins. (BUILT_IN_GOMP_TASK): Add INT argument to the end. (BUILT_IN_GOMP_TARGET): Rename from GOMP_target to GOMP_target_41, adjust type. (BUILT_IN_GOMP_TARGET_DATA): Rename from GOMP_target_data to GOMP_target_data_41, adjust type. (BUILT_IN_GOMP_TARGET_UPDATE): Rename from GOMP_target_update to GOMP_target_update_41, adjust type. * omp-low.c (struct omp_region): Adjust comments, add ord_stmt field. (struct omp_for_data): Add ordered and simd_schedule fields. (omp_member_access_dummy_var, unshare_and_remap_1, unshare_and_remap, is_taskloop_ctx): New functions. (is_taskreg_ctx): Use is_parallel_ctx and is_task_ctx. (extract_omp_for_data): Handle taskloops and doacross loops and simd schedule modifier. (omp_adjust_chunk_size): New function. (get_ws_args_for): Use it. (lookup_sfield): Change first argument to splay_tree_key, add overload with first argument tree. (maybe_lookup_field): Likewise. (use_pointer_for_field): Handle omp_member_access_dummy_var. (omp_copy_decl_2): If var is TREE_ADDRESSABLE listed in task_shared_vars, clear TREE_ADDRESSABLE on the copy. (build_outer_var_ref): Add LASTPRIVATE argument, handle taskloops and omp_member_access_dummy_var vars. (build_sender_ref): Change first argument to splay_tree_key, add overload with first argument tree. (install_var_field): For mask & 8 use &DECL_UID as key instead of the tree itself. (fixup_child_record_type): Const qualify *.omp_data_i. (scan_sharing_clauses): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE, C/C++ array reductions, OMP_CLAUSE_{IS,USE}_DEVICE_PTR clauses, OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,SIMDLEN,THREADS,SIMD} and OMP_CLAUSE_{NOGROUP,DEFAULTMAP} clauses, OMP_CLAUSE__LOOPTEMP_ clause on taskloop, GOMP_MAP_FIRSTPRIVATE_POINTER, OMP_CLAUSE_MAP_PRIVATE. (create_omp_child_function): Set TREE_READONLY on .omp_data_i. (find_combined_for): Allow searching for different GIMPLE_OMP_FOR kinds. (add_taskreg_looptemp_clauses): New function. (scan_omp_parallel): Use it. (scan_omp_task): Likewise. (finish_taskreg_scan): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. For taskloop, move fields for the first two _LOOPTEMP_ clauses first. (check_omp_nesting_restrictions): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Formatting fixes. Allow the sandwiched taskloop constructs. Type check OMP_CLAUSE_DEPEND_{KIND,SOURCE}. Allow ordered simd inside of simd region. Diagnose depend(source) or depend(sink:...) on target constructs or task/taskloop. (handle_simd_reference): Use get_name. (lower_rec_input_clauses): Likewise. Ignore all OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses on taskloop construct. Allow _LOOPTEMP_ clause on GOMP_TASK. Unshare new_var before passing it to omp_clause_{default,copy}_ctor. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set lastprivate_firstprivate flag for linear that needs copyin and copyout. Use BUILT_IN_ALLOCA_WITH_ALIGN instead of BUILT_IN_ALLOCA. (lower_lastprivate_clauses): For OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE on taskloop lookup decl in outer context. Pass true to build_outer_var_ref lastprivate argument. Handle OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV lastprivate if the decl is global outside of outer taskloop for. (lower_reduction_clauses): Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. (lower_send_clauses): Ignore first two _LOOPTEMP_ clauses in taskloop GOMP_TASK. Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. Handle omp_member_access_dummy_var vars. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Use new lookup_sfield overload. (lower_send_shared_vars): Ignore fields with NULL or FIELD_DECL abstract origin. Handle omp_member_access_dummy_var vars. (expand_parallel_call): Use expand_omp_build_assign. (expand_task_call): Handle taskloop construct expansion. Add REGION argument. Use GOMP_TASK_* defines instead of hardcoded integers. Add priority argument to GOMP_task* calls. Or in GOMP_TASK_FLAG_PRIORITY into flags if priority is present for GOMP_task call. (expand_omp_build_assign): Add prototype. Add AFTER argument, if true emit statements after *GSI_P and continue linking. (expand_omp_taskreg): Adjust expand_task_call caller. (expand_omp_for_init_counts): Rename zero_iter_bb argument to zero_iter1_bb and first_zero_iter to first_zero_iter1, add zero_iter2_bb and first_zero_iter2 arguments, handle computation of counts even for ordered loops. (expand_omp_for_init_vars): Handle GOMP_TASK inner_stmt. (expand_omp_ordered_source, expand_omp_ordered_sink, expand_omp_ordered_source_sink, expand_omp_for_ordered_loops): New functions. (expand_omp_for_generic): Use omp_adjust_chunk_size. Handle linear clauses on worksharing loop. Handle DOACROSS loop expansion. (expand_omp_for_static_nochunk): Handle linear clauses on worksharing loop. Adjust expand_omp_for_init_counts callers. (expand_omp_for_static_chunk): Likewise. Use omp_adjust_chunk_size. (expand_omp_simd): Handle addressable fd->loop.v. Adjust expand_omp_for_init_counts callers. (expand_omp_taskloop_for_outer, expand_omp_taskloop_for_inner): New functions. (expand_omp_for): Call expand_omp_taskloop_for_* for taskloop. Handle doacross loops. (expand_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Pass flags and depend arguments to GOMP_target_{41,update_41,enter_exit_data} libcalls. (expand_omp): Don't expand ordered depend constructs here, record ord_stmt instead for later expand_omp_for_generic. (build_omp_regions_1): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (lower_omp_ordered_clauses): New function. (lower_omp_ordered): Handle OMP_CLAUSE_SIMD, for OMP_CLAUSE_DEPEND don't lower anything. (lower_omp_for_lastprivate): Use last _looptemp_ clause on taskloop for comparison. (lower_omp_for): Handle taskloop constructs. Adjust OMP_CLAUSE_DECL and OMP_CLAUSE_LINEAR_STEP so that expand_omp_for_* can use it during expansion for linear adjustments. (create_task_copyfn): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. (lower_depend_clauses): Assert not seeing sink/source depend kinds. Set TREE_ADDRESSABLE on array. Change first argument from gimple * to tree * pointing to the stmt's clauses. (lower_omp_taskreg): Adjust lower_depend_clauses caller. (lower_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, depend clauses, GOMP_MAP_{RELEASE,ALWAYS_{TO,FROM,TOFROM},FIRSTPRIVATE_POINTER,STRUCT} map kinds, OMP_CLAUSE_{FIRSTPRIVATE,PRIVATE,{IS,USE}_DEVICE_PTR clauses. Always use short kind and 8-bit align shift. (lower_omp_regimplify_p): Use IS_TYPE_OR_DECL_P macro. (struct lower_omp_regimplify_operands_data): New type. (lower_omp_regimplify_operands_p, lower_omp_regimplify_operands): New functions. (lower_omp_1): Use lower_omp_regimplify_operands instead of gimple_regimplify_operands. (make_gimple_omp_edges): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (simd_clone_clauses_extract): Honor OMP_CLAUSE_LINEAR_KIND. (simd_clone_mangle): Mangle the various linear kinds per the new ABI. (simd_clone_adjust_argument_types): Handle SIMD_CLONE_ARG_TYPE_LINEAR_*_CONSTANT_STEP. (simd_clone_init_simd_arrays): Don't do anything for uval. (simd_clone_adjust): Handle SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP. Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP. * omp-low.h (omp_member_access_dummy_var): New prototype. * passes.def (pass_simduid_cleanup): Schedule another copy of the pass after all optimizations. * tree.c (omp_clause_code_name): Add entries for OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (omp_clause_num_ops): Likewise. Bump number of OMP_CLAUSE_REDUCTION arguments to 5 and for OMP_CLAUSE_ORDERED to 1. (walk_tree_1): Adjust for OMP_CLAUSE_ORDERED having 1 argument and OMP_CLAUSE_REDUCTION 5 arguments. Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD} clauses. * tree-core.h (enum omp_clause_linear_kind): New. (struct tree_omp_clause): Change type of map_kind from unsigned char to unsigned int. Add subcode.if_modifier and subcode.linear_kind fields. (enum omp_clause_code): Add OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (OMP_CLAUSE_REDUCTION): Document OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_{SOURCE,SINK}. * tree.def (OMP_FOR): Add OMP_FOR_ORIG_DECLS operand. (OMP_CRITICAL): Move before OMP_SINGLE. Add OMP_CRITICAL_CLAUSES operand. (OMP_ORDERED): Move before OMP_SINGLE. Add OMP_ORDERED_CLAUSES operand. (OMP_TASKLOOP, OMP_TARGET_ENTER_DATA, OMP_TARGET_EXIT_DATA): New tree codes. * tree.h (OMP_BODY): Replace OMP_CRITICAL with OMP_TASKGROUP. (OMP_CLAUSE_SET_MAP_KIND): Cast to unsigned int rather than unsigned char. (OMP_CRITICAL_NAME): Adjust to be 3rd operand instead of 2nd. (OMP_CLAUSE_NUM_TASKS_EXPR): Formatting fix. (OMP_STANDALONE_CLAUSES): Adjust to cover OMP_TARGET_{ENTER,EXIT}_DATA. (OMP_CLAUSE_DEPEND_SINK_NEGATIVE, OMP_TARGET_COMBINED, OMP_CLAUSE_MAP_PRIVATE, OMP_FOR_ORIG_DECLS, OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION, OMP_CRITICAL_CLAUSES, OMP_CLAUSE_PRIVATE_TASKLOOP_IV, OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, OMP_CLAUSE_HINT_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER, OMP_CLAUSE_SHARED_FIRSTPRIVATE, OMP_ORDERED_CLAUSES, OMP_TARGET_ENTER_DATA_CLAUSES, OMP_TARGET_EXIT_DATA_CLAUSES, OMP_CLAUSE_NUM_TASKS_EXPR, OMP_CLAUSE_GRAINSIZE_EXPR, OMP_CLAUSE_PRIORITY_EXPR, OMP_CLAUSE_ORDERED_EXPR): Define. * tree-inline.c (remap_gimple_stmt): Handle clauses on GIMPLE_OMP_ORDERED and GIMPLE_OMP_CRITICAL. For IFN_GOMP_SIMD_ORDERED_{START,END} set has_simduid_loops. * tree-nested.c (convert_nonlocal_omp_clauses): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (convert_local_omp_clauses): Likewise. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_ORDERED_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_DEPEND_{SOURCE,SINK}. Use "delete" for GOMP_MAP_FORCE_DEALLOC. Handle GOMP_MAP_{ALWAYS_{TO,FROM,TOFROM},RELEASE,FIRSTPRIVATE_POINTER,STRUCT}. (dump_generic_node): Handle OMP_TASKLOOP, OMP_TARGET_{ENTER,EXIT}_DATA and clauses on OMP_ORDERED and OMP_CRITICAL. * tree-vectorizer.c (adjust_simduid_builtins): Adjust comment. Remove IFN_GOMP_SIMD_ORDERED_{START,END}. (vectorize_loops): Adjust comments. (pass_simduid_cleanup::execute): Likewise. * tree-vect-stmts.c (vectorizable_simd_clone_call): Handle SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_CONSTANT_STEP. * wide-int.h (wi::gcd): New. gcc/c-family/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-common.c (enum c_builtin_type): Define DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10 and DEF_FUNCTION_TYPE_11. (c_define_builtins): Likewise. * c-common.h (enum c_omp_clause_split): Add C_OMP_CLAUSE_SPLIT_TASKLOOP. (c_finish_omp_critical, c_finish_omp_ordered): Add CLAUSES argument. (c_finish_omp_for): Add ORIG_DECLV argument. * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP as 201511 instead of 201307. * c-omp.c (c_finish_omp_critical): Add CLAUSES argument, set OMP_CRITICAL_CLAUSES to it. (c_finish_omp_ordered): Add CLAUSES argument, set OMP_ORDERED_CLAUSES to it. (c_finish_omp_for): Add ORIG_DECLV argument, set OMP_FOR_ORIG_DECLS to it if OMP_FOR. Clear DECL_INITIAL on the IVs. (c_omp_split_clauses): Handle OpenMP 4.5 combined/composite constructs and new OpenMP 4.5 clauses. Clear OMP_CLAUSE_SCHEDULE_SIMD if not combined with OMP_SIMD. Add verification code. * c-pragma.c (omp_pragmas_simd): Add taskloop. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKLOOP. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_{DEFAULTMAP,GRAINSIZE,HINT,{IS,USE}_DEVICE_PTR} and PRAGMA_OMP_CLAUSE_{LINK,NOGROUP,NUM_TASKS,PRIORITY,SIMD,THREADS}. gcc/c/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-parser.c (c_parser_pragma): Handle PRAGMA_OMP_ORDERED here. (c_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (c_parser_omp_variable_list): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Formatting fixes. (c_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize, c_parser_omp_clause_priority, c_parser_omp_clause_hint, c_parser_omp_clause_defaultmap, c_parser_omp_clause_use_device_ptr, c_parser_omp_clause_is_device_ptr): New functions. (c_parser_omp_clause_ordered): Parse optional parameter. (c_parser_omp_clause_reduction): Handle array reductions. (c_parser_omp_clause_schedule): Parse optional simd modifier. (c_parser_omp_clause_nogroup, c_parser_omp_clause_orderedkind): New functions. (c_parser_omp_clause_linear): Parse linear clause modifiers. (c_parser_omp_clause_depend_sink): New function. (c_parser_omp_clause_depend): Parse source/sink depend kinds. (c_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (c_parser_oacc_all_clauses): Adjust c_parser_omp_clause_if and c_finish_omp_clauses callers. (c_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (c_parser_oacc_cache): Adjust c_finish_omp_clauses caller. (OMP_CRITICAL_CLAUSE_MASK): Define. (c_parser_omp_critical): Parse critical clauses. (c_parser_omp_for_loop): Handle doacross loops, adjust c_finish_omp_for and c_finish_omp_clauses callers. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (c_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (c_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (c_parser_omp_ordered): Add CONTEXT argument, remove LOC argument, parse clauses and if depend clause is found, don't parse a body. (c_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (c_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (c_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (c_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (c_parser_omp_declare_reduction): Use STRIP_NOPS when checking for &omp_priv. (OMP_TASKLOOP_CLAUSE_MASK): Define. (c_parser_omp_taskloop): New function. (c_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (c_parser_cilk_for): Adjust c_finish_omp_clauses callers. * c-tree.h (c_finish_omp_clauses): Add two new arguments. * c-typeck.c (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (c_finish_omp_clauses): Add IS_OMP and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones. gcc/cp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * class.c (finish_struct_1): Call finish_omp_declare_simd_methods. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_TASKLOOP. (cp_genericize_r): Likewise. (cxx_omp_finish_clause): Don't diagnose references. (cxx_omp_disregard_value_expr): New function. * cp-objcp-common.h (LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR): Redefine. * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Document for OMP_TASKLOOP. (DECL_OMP_PRIVATIZED_MEMBER): Define. (finish_omp_declare_simd_methods, push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses, omp_privatize_field, cxx_omp_disregard_value_expr): New prototypes. (finish_omp_clauses): Add two new arguments. (finish_omp_for): Add ORIG_DECLV argument. * parser.c (cp_parser_lambda_body): Call save_omp_privatization_clauses and restore_omp_privatization_clauses. (cp_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (cp_parser_omp_var_list_no_open): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Parse this keyword. Formatting fixes. (cp_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority, cp_parser_omp_clause_hint, cp_parser_omp_clause_defaultmap): New functions. (cp_parser_omp_clause_ordered): Parse optional parameter. (cp_parser_omp_clause_reduction): Handle array reductions. (cp_parser_omp_clause_schedule): Parse optional simd modifier. (cp_parser_omp_clause_nogroup, cp_parser_omp_clause_orderedkind): New functions. (cp_parser_omp_clause_linear): Parse linear clause modifiers. (cp_parser_omp_clause_depend_sink): New function. (cp_parser_omp_clause_depend): Parse source/sink depend kinds. (cp_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_if and finish_omp_clauses callers. (cp_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (OMP_CRITICAL_CLAUSE_MASK): Define. (cp_parser_omp_critical): Parse critical clauses. (cp_parser_omp_for_incr): Use cp_tree_equal if processing_template_decl. (cp_parser_omp_for_loop_init): Return tree instead of bool. Handle non-static data member iterators. (cp_parser_omp_for_loop): Handle doacross loops, adjust finish_omp_for and finish_omp_clauses callers. (cp_omp_split_clauses): Adjust finish_omp_clauses caller. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (cp_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (cp_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (cp_parser_omp_ordered): Add CONTEXT argument, return bool instead of tree, parse clauses and if depend clause is found, don't parse a body. (cp_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (cp_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (cp_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (cp_parser_oacc_cache): Adjust finish_omp_clauses caller. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (cp_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (OMP_TASKLOOP_CLAUSE_MASK): Define. (cp_parser_omp_taskloop): New function. (cp_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (cp_parser_pragma): Handle PRAGMA_OMP_ORDERED here directly, handle PRAGMA_OMP_TASKLOOP, call push_omp_privatization_clauses and pop_omp_privatization_clauses around parsing calls. (cp_parser_cilk_for): Adjust finish_omp_clauses caller. * pt.c (apply_late_template_attributes): Adjust tsubst_omp_clauses and finish_omp_clauses callers. (tsubst_omp_clause_decl): Return NULL if decl is NULL. For TREE_LIST, copy over OMP_CLAUSE_DEPEND_SINK_NEGATIVE bit. Use tsubst_expr instead of tsubst_copy, undo convert_from_reference effects. (tsubst_omp_clauses): Add ALLOW_FIELDS argument. Handle new OpenMP 4.5 clauses. Use tsubst_omp_clause_decl for more clauses. If ALLOW_FIELDS, handle non-static data members in the clauses. Clear OMP_CLAUSE_LINEAR_STEP if it has been cleared before. (omp_parallel_combined_clauses): New variable. (tsubst_omp_for_iterator): Add ORIG_DECLV argument, recur on OMP_FOR_ORIG_DECLS, handle non-static data member iterators. Improve handling of clauses on combined constructs. (tsubst_expr): Call push_omp_privatization_clauses and pop_omp_privatization_clauses around instantiation of certain OpenMP constructs, improve handling of clauses on combined constructs, handle OMP_TASKLOOP, adjust tsubst_omp_for_iterator, tsubst_omp_clauses and finish_omp_for callers, handle clauses on critical and ordered, handle OMP_TARGET_{ENTER,EXIT}_DATA. (instantiate_decl): Call save_omp_privatization_clauses and restore_omp_privatization_clauses around instantiation. (dependent_omp_for_p): Fix up comment typo. Handle SCOPE_REF. * semantics.c (omp_private_member_map, omp_private_member_vec, omp_private_member_ignore_next): New variables. (finish_non_static_data_member): Return dummy decl for privatized non-static data members. (omp_clause_decl_field, omp_clause_printable_decl, omp_note_field_privatization, omp_privatize_field): New functions. (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (finish_omp_reduction_clause): Handle array sections and arrays. Use omp_clause_printable_decl. (finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink): New functions. (finish_omp_clauses): Add ALLOW_FIELDS and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones, handle non-static data members, reject this keyword when not allowed. (push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses): New functions. (handle_omp_for_class_iterator): Handle OMP_TASKLOOP class iterators. Add collapse and ordered arguments. Fix handling of lastprivate iterators in doacross loops. (finish_omp_for): Add ORIG_DECLV argument, handle doacross loops, adjust c_finish_omp_for, handle_omp_for_class_iterator and finish_omp_clauses callers. Fill in OMP_CLAUSE_LINEAR_STEP on simd loops with non-static data member iterators. gcc/fortran/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * f95-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11, DEF_FUNCTION_TYPE_VAR_1): Define. * trans-openmp.c (gfc_trans_omp_clauses): Set OMP_CLAUSE_IF_MODIFIER to ERROR_MARK, OMP_CLAUSE_ORDERED_EXPR to NULL. (gfc_trans_omp_critical): Adjust for addition of clauses. (gfc_trans_omp_ordered): Likewise. * types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. gcc/lto/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * lto-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/jit/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/ada/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * gcc-interface/utils.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/testsuite/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-c++-common/gomp/cancel-1.c (f2): Add map clause to target data. * c-c++-common/gomp/clauses-1.c: New test. * c-c++-common/gomp/clauses-2.c: New test. * c-c++-common/gomp/clauses-3.c: New test. * c-c++-common/gomp/clauses-4.c: New test. * c-c++-common/gomp/declare-target-1.c: New test. * c-c++-common/gomp/declare-target-2.c: New test. * c-c++-common/gomp/depend-3.c: New test. * c-c++-common/gomp/depend-4.c: New test. * c-c++-common/gomp/doacross-1.c: New test. * c-c++-common/gomp/if-1.c: New test. * c-c++-common/gomp/if-2.c: New test. * c-c++-common/gomp/linear-1.c: New test. * c-c++-common/gomp/map-2.c: New test. * c-c++-common/gomp/map-3.c: New test. * c-c++-common/gomp/nesting-1.c (f_omp_parallel, f_omp_target_data): Add map clause to target data. * c-c++-common/gomp/nesting-warn-1.c (f_omp_target): Likewise. * c-c++-common/gomp/ordered-1.c: New test. * c-c++-common/gomp/ordered-2.c: New test. * c-c++-common/gomp/ordered-3.c: New test. * c-c++-common/gomp/pr61486-1.c (foo): Remove linear clause on non-iterator. * c-c++-common/gomp/pr61486-2.c (test, test2): Remove ordered clause and ordered construct where no longer allowed. * c-c++-common/gomp/priority-1.c: New test. * c-c++-common/gomp/reduction-1.c: New test. * c-c++-common/gomp/schedule-simd-1.c: New test. * c-c++-common/gomp/sink-1.c: New test. * c-c++-common/gomp/sink-2.c: New test. * c-c++-common/gomp/sink-3.c: New test. * c-c++-common/gomp/sink-4.c: New test. * c-c++-common/gomp/udr-1.c: New test. * c-c++-common/taskloop-1.c: New test. * c-c++-common/cpp/openmp-define-3.c: Adjust for the new value of _OPENMP macro. * c-c++-common/cilk-plus/PS/body.c (foo): Adjust expected diagnostics. * c-c++-common/goacc-gomp/nesting-fail-1.c (f_acc_parallel, f_acc_kernels, f_acc_data, f_acc_loop): Add map clause to target data. * gcc.dg/gomp/clause-1.c: * gcc.dg/gomp/reduction-1.c: New test. * gcc.dg/gomp/sink-fold-1.c: New test. * gcc.dg/gomp/sink-fold-2.c: New test. * gcc.dg/gomp/sink-fold-3.c: New test. * gcc.dg/vect/vect-simd-clone-15.c: New test. * g++.dg/gomp/clause-1.C (T::test): Remove dg-error on privatization of non-static data members. * g++.dg/gomp/clause-3.C (foo): Remove one dg-error directive. Add some linear clause tests. * g++.dg/gomp/declare-simd-3.C: New test. * g++.dg/gomp/linear-1.C: New test. * g++.dg/gomp/member-1.C: New test. * g++.dg/gomp/member-2.C: New test. * g++.dg/gomp/pr66571-2.C: New test. * g++.dg/gomp/pr67504.C (foo): Add test for ordered clause with dependent argument. * g++.dg/gomp/pr67522.C (foo): Add test for invalid array section in reduction clause. * g++.dg/gomp/reference-1.C: New test. * g++.dg/gomp/sink-1.C: New test. * g++.dg/gomp/sink-2.C: New test. * g++.dg/gomp/sink-3.C: New test. * g++.dg/gomp/task-1.C: Remove both dg-error directives. * g++.dg/gomp/this-1.C: New test. * g++.dg/gomp/this-2.C: New test. * g++.dg/vect/simd-clone-2.cc: New test. * g++.dg/vect/simd-clone-2.h: New test. * g++.dg/vect/simd-clone-3.cc: New test. * g++.dg/vect/simd-clone-4.cc: New test. * g++.dg/vect/simd-clone-4.h: New test. * g++.dg/vect/simd-clone-5.cc: New test. include/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define. (enum gomp_map_kind): Add GOMP_MAP_FIRSTPRIVATE, GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_DELETE, GOMP_MAP_RELEASE, GOMP_MAP_FIRSTPRIVATE_POINTER. (GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Define. (GOMP_TASK_FLAG_UNTIED, GOMP_TASK_FLAG_FINAL, GOMP_TASK_FLAG_MERGEABLE, GOMP_TASK_FLAG_DEPEND, GOMP_TASK_FLAG_PRIORITY, GOMP_TASK_FLAG_UP, GOMP_TASK_FLAG_GRAINSIZE, GOMP_TASK_FLAG_IF, GOMP_TASK_FLAG_NOGROUP, GOMP_TARGET_FLAG_NOWAIT, GOMP_TARGET_FLAG_EXIT_DATA, GOMP_TARGET_FLAG_UPDATE): Define. libgomp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * config/linux/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/linux/doacross.h: New file. * config/posix/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/posix/doacross.h: New file. * env.c: Include gomp-constants.h. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (gomp_max_task_priority_var): New variable. (parse_schedule): Rename run_sched_modifier to run_sched_chunk_size. (handle_omp_display_env): Change _OPENMP value from 201307 to 201511. Print OMP_MAX_TASK_PRIORITY. (initialize_env): Parse OMP_MAX_TASK_PRIORITY. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size and run_sched_modifier to run_sched_chunk_size. (omp_get_max_task_priority, omp_get_initial_device, omp_get_num_places, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums): New functions. * fortran.c (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_): Rename modifier argument to chunk_size. (omp_get_num_places_, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num_, omp_get_partition_num_places_, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device_, omp_get_max_task_priority_): New functions. * libgomp_g.h (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_doacross_ull_post, GOMP_doacross_wait, GOMP_taskloop, GOMP_taskloop_ull, GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data): New prototypes. (GOMP_task): Add prototype argument. * libgomp.h (_LIBGOMP_CHECKING_): Define to 0 if not yet defined. (struct gomp_doacross_work_share): New type. (struct gomp_work_share): Add doacross field. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (enum gomp_task_kind): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. Add comments. (struct gomp_task_depend_entry): Add comments. (struct gomp_task): Likewise. (struct gomp_taskgroup): Likewise. (struct gomp_target_task): New type. (struct gomp_team): Add comment. (gomp_get_place_proc_ids_8, gomp_doacross_init, gomp_doacross_ull_init, gomp_task_maybe_wait_for_dependencies, gomp_create_target_task, gomp_target_task_fn): New prototypes. (struct target_var_desc): New type. (struct target_mem_desc): Adjust comment. Use struct target_var_desc instead of splay_tree_key for list. (REFCOUNT_INFINITY): Define. (struct splay_tree_key_s): Remove copy_from field. (struct gomp_device_descr): Add dev2dev_func field. (enum gomp_map_vars_kind): New enum. (gomp_map_vars): Add one argument. * libgomp.map (OMP_4.5): Export omp_get_max_task_priority, omp_get_max_task_priority_, omp_get_num_places, omp_get_num_places_, omp_get_place_num_procs, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num, omp_get_place_num_, omp_get_partition_num_places, omp_get_partition_num_places_, omp_get_partition_place_nums, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device, omp_get_initial_device_, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr and omp_target_disassociate_ptr. (GOMP_4.0.2): Renamed to ... (GOMP_4.5): ... this. Export GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data, GOMP_taskloop, GOMP_taskloop_ull, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_doacross_static_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_doacross_ull_post and GOMP_doacross_ull_wait. * libgomp.texi: Document omp_get_max_task_priority. Rename modifier argument to chunk_size for omp_set_schedule and omp_get_schedule. Document OMP_MAX_TASK_PRIORITY env var. * loop.c (GOMP_loop_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ordered_runtime_start): Likewise. (gomp_loop_doacross_static_start, gomp_loop_doacross_dynamic_start, gomp_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_parallel_loop_runtime_start): New functions. (GOMP_parallel_loop_runtime): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start): New functions or aliases. * loop_ull.c (GOMP_loop_ull_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ull_ordered_runtime_start): Likewise. (gomp_loop_ull_doacross_static_start, gomp_loop_ull_doacross_dynamic_start, gomp_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start): New functions. (GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start): New functions or aliases. * oacc-mem.c (acc_map_data, present_create_copy, gomp_acc_insert_pointer): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (gomp_acc_remove_pointer): Use copy_from from target_var_desc. * oacc-parallel.c (GOACC_data_start): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (GOACC_parallel_keyed): Likewise. Use copy_from from target_var_desc. * omp.h.in (omp_lock_hint_t): New type. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr): New prototypes. * omp_lib.f90.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New interfaces. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size. * omp_lib.h.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New functions and subroutines. * ordered.c: Include stdarg.h and string.h. (MAX_COLLAPSED_BITS): Define. (gomp_doacross_init, GOMP_doacross_post, GOMP_doacross_wait, gomp_doacross_ull_init, GOMP_doacross_ull_post, GOMP_doacross_ull_wait): New functions. * target.c: Include errno.h. (resolve_device): If device is not initialized, call gomp_init_device on it. (gomp_map_lookup): New function. (gomp_map_vars_existing): Add tgt_var argument, fill it in. Don't bump refcount if REFCOUNT_INFINITY. Handle GOMP_MAP_ALWAYS_TO_P. (get_kind): Rename is_openacc argument to short_mapkind. (gomp_map_pointer): Use gomp_map_lookup. (gomp_map_fields_existing): New function. (gomp_map_vars): Rename is_openacc argument to short_mapkind and is_target to pragma_kind. Handle GOMP_MAP_VARS_ENTER_DATA, handle GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_STRUCT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION. Adjust for tgt->list changed type and copy_from living in there. (gomp_copy_from_async): Adjust for tgt->list changed type and copy_from living in there. (gomp_unmap_vars): Likewise. (gomp_update): Likewise. Rename is_openacc argument to short_mapkind. Don't fail if object is not mapped. (gomp_load_image_to_device): Initialize refcount to REFCOUNT_INFINITY. (gomp_target_fallback): New function. (gomp_get_target_fn_addr): Likewise. (GOMP_target): Adjust gomp_map_vars caller, use gomp_get_target_fn_addr and gomp_target_fallback. (GOMP_target_41): New function. (gomp_target_data_fallback): New function. (GOMP_target_data): Use it, adjust gomp_map_vars caller. (GOMP_target_data_41): New function. (GOMP_target_update): Adjust gomp_update caller. (GOMP_target_update_41): New function. (gomp_exit_data, GOMP_target_enter_exit_data, gomp_target_task_fn, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect_worker, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr, gomp_load_plugin_for_device): New functions. * task.c: Include gomp-constants.h. Include taskloop.c twice to get GOMP_taskloop and GOMP_taskloop_ull definitions. (gomp_task_handle_depend): New function. (GOMP_task): Use it. Add priority argument. Use gomp-constant.h constants instead of hardcoded numbers. Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (gomp_create_target_task): New function. (verify_children_queue, verify_taskgroup_queue, verify_task_queue): New functions. (gomp_task_run_pre): Call verify_*_queue functions. If an upcoming tied task is about to leave the sibling or taskgroup queues in an invalid state, adjust appropriately. Remove taskgroup argument. Add comments. (gomp_task_run_post_handle_dependers): Add comments. (gomp_task_run_post_remove_parent): Likewise. (gomp_barrier_handle_tasks): Adjust gomp_task_run_pre caller. (GOMP_taskwait): Likewise. Add comments. (gomp_task_maybe_wait_for_dependencies): Fix scheduling problem such that the first non parent_depends_on task does not end up at the end of the children queue. (GOMP_taskgroup_start): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (GOMP_taskgroup_end): Adjust gomp_task_run_pre caller. * taskloop.c: New file. * testsuite/lib/libgomp.exp (check_effective_target_offload_device_nonshared_as): New proc. * testsuite/libgomp.c/affinity-2.c: New test. * testsuite/libgomp.c/doacross-1.c: New test. * testsuite/libgomp.c/doacross-2.c: New test. * testsuite/libgomp.c/examples-4/declare_target-1.c (fib_wrapper): Add map clause to target. * testsuite/libgomp.c/examples-4/declare_target-4.c (accum): Likewise. * testsuite/libgomp.c/examples-4/declare_target-5.c (accum): Likewise. * testsuite/libgomp.c/examples-4/device-1.c (main): Likewise. * testsuite/libgomp.c/examples-4/device-3.c (main): Likewise. * testsuite/libgomp.c/examples-4/target_data-3.c (gramSchmidt): Likewise. * testsuite/libgomp.c/examples-4/teams-2.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-3.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-4.c (dotprod): Likewise. * testsuite/libgomp.c/for-2.h (OMPTGT, OMPTO, OMPFROM): Define if not defined. Use those where needed. * testsuite/libgomp.c/for-4.c: New test. * testsuite/libgomp.c/for-5.c: New test. * testsuite/libgomp.c/for-6.c: New test. * testsuite/libgomp.c/linear-1.c: New test. * testsuite/libgomp.c/ordered-4.c: New test. * testsuite/libgomp.c/pr66199-2.c (f2): Adjust for linear clause only allowed on the loop iterator. * testsuite/libgomp.c/pr66199-3.c: New test. * testsuite/libgomp.c/pr66199-4.c: New test. * testsuite/libgomp.c/reduction-7.c: New test. * testsuite/libgomp.c/reduction-8.c: New test. * testsuite/libgomp.c/reduction-9.c: New test. * testsuite/libgomp.c/reduction-10.c: New test. * testsuite/libgomp.c/target-1.c (fn2, fn3, fn4): Add map(tofrom:s). * testsuite/libgomp.c/target-2.c (fn2, fn3, fn4): Likewise. * testsuite/libgomp.c/target-7.c (foo): Add map(h) where needed. * testsuite/libgomp.c/target-11.c: New test. * testsuite/libgomp.c/target-12.c: New test. * testsuite/libgomp.c/target-13.c: New test. * testsuite/libgomp.c/target-14.c: New test. * testsuite/libgomp.c/target-15.c: New test. * testsuite/libgomp.c/target-16.c: New test. * testsuite/libgomp.c/target-17.c: New test. * testsuite/libgomp.c/target-18.c: New test. * testsuite/libgomp.c/target-19.c: New test. * testsuite/libgomp.c/target-20.c: New test. * testsuite/libgomp.c/target-21.c: New test. * testsuite/libgomp.c/target-22.c: New test. * testsuite/libgomp.c/target-23.c: New test. * testsuite/libgomp.c/target-24.c: New test. * testsuite/libgomp.c/target-25.c: New test. * testsuite/libgomp.c/target-26.c: New test. * testsuite/libgomp.c/target-27.c: New test. * testsuite/libgomp.c/taskloop-1.c: New test. * testsuite/libgomp.c/taskloop-2.c: New test. * testsuite/libgomp.c/taskloop-3.c: New test. * testsuite/libgomp.c/taskloop-4.c: New test. * testsuite/libgomp.c++/ctor-13.C: New test. * testsuite/libgomp.c++/doacross-1.C: New test. * testsuite/libgomp.c++/examples-4/declare_target-2.C: Replace offload_device with offload_device_nonshared_as. * testsuite/libgomp.c++/for-12.C: New test. * testsuite/libgomp.c++/for-13.C: New test. * testsuite/libgomp.c++/for-14.C: New test. * testsuite/libgomp.c++/linear-1.C: New test. * testsuite/libgomp.c++/member-1.C: New test. * testsuite/libgomp.c++/member-2.C: New test. * testsuite/libgomp.c++/member-3.C: New test. * testsuite/libgomp.c++/member-4.C: New test. * testsuite/libgomp.c++/member-5.C: New test. * testsuite/libgomp.c++/ordered-1.C: New test. * testsuite/libgomp.c++/reduction-5.C: New test. * testsuite/libgomp.c++/reduction-6.C: New test. * testsuite/libgomp.c++/reduction-7.C: New test. * testsuite/libgomp.c++/reduction-8.C: New test. * testsuite/libgomp.c++/reduction-9.C: New test. * testsuite/libgomp.c++/reduction-10.C: New test. * testsuite/libgomp.c++/reference-1.C: New test. * testsuite/libgomp.c++/simd14.C: New test. * testsuite/libgomp.c++/target-2.C (fn2): Add map(tofrom: s) clause. * testsuite/libgomp.c++/target-5.C: New test. * testsuite/libgomp.c++/target-6.C: New test. * testsuite/libgomp.c++/target-7.C: New test. * testsuite/libgomp.c++/target-8.C: New test. * testsuite/libgomp.c++/target-9.C: New test. * testsuite/libgomp.c++/target-10.C: New test. * testsuite/libgomp.c++/target-11.C: New test. * testsuite/libgomp.c++/target-12.C: New test. * testsuite/libgomp.c++/taskloop-1.C: New test. * testsuite/libgomp.c++/taskloop-2.C: New test. * testsuite/libgomp.c++/taskloop-3.C: New test. * testsuite/libgomp.c++/taskloop-4.C: New test. * testsuite/libgomp.c++/taskloop-5.C: New test. * testsuite/libgomp.c++/taskloop-6.C: New test. * testsuite/libgomp.c++/taskloop-7.C: New test. * testsuite/libgomp.c++/taskloop-8.C: New test. * testsuite/libgomp.c++/taskloop-9.C: New test. * testsuite/libgomp.fortran/affinity1.f90: New test. * testsuite/libgomp.fortran/affinity2.f90: New test. liboffloadmic/ 2015-10-13 Ilya Verbin <ilya.verbin@intel.com> * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New function. * plugin/offload_target_main.cpp (__offload_target_tgt2tgt): New static function, register it in liboffloadmic. From-SVN: r228777
2015-10-13 21:06:23 +02:00
OMP_FOR_GIMPLIFYING_P (in OMP_FOR, OMP_SIMD, OMP_DISTRIBUTE,
and OMP_TASKLOOP)
BASELINK_QUALIFIED_P (in BASELINK)
TARGET_EXPR_IMPLICIT_P (in TARGET_EXPR)
TEMPLATE_PARM_PARAMETER_PACK (in TEMPLATE_PARM_INDEX)
2014-12-04 21:37:14 +01:00
TREE_INDIRECT_USING (in a TREE_LIST of using-directives)
ATTR_IS_DEPENDENT (in the TREE_LIST for an attribute)
ABI_TAG_IMPLICIT (in the TREE_LIST for the argument of abi_tag)
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
CONSTRUCTOR_IS_DIRECT_INIT (in CONSTRUCTOR)
LAMBDA_EXPR_CAPTURES_THIS_P (in LAMBDA_EXPR)
DECLTYPE_FOR_LAMBDA_CAPTURE (in DECLTYPE_TYPE)
VEC_INIT_EXPR_IS_CONSTEXPR (in VEC_INIT_EXPR)
DECL_OVERRIDE_P (in FUNCTION_DECL)
IMPLICIT_CONV_EXPR_DIRECT_INIT (in IMPLICIT_CONV_EXPR)
TRANSACTION_EXPR_IS_STMT (in TRANSACTION_EXPR)
CONVERT_EXPR_VBASE_PATH (in CONVERT_EXPR)
OVL_ARG_DEPENDENT (in OVERLOAD)
PACK_EXPANSION_LOCAL_P (in *_PACK_EXPANSION)
2014-11-26 19:20:25 +01:00
TINFO_HAS_ACCESS_ERRORS (in TEMPLATE_INFO)
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
SIZEOF_EXPR_TYPE_P (in SIZEOF_EXPR)
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
COMPOUND_REQ_NOEXCEPT_P (in COMPOUND_REQ)
WILDCARD_PACK_P (in WILDCARD_DECL)
BLOCK_OUTER_CURLY_BRACE_P (in BLOCK)
FOLD_EXPR_MODOP_P (*_FOLD_EXPR)
IF_STMT_CONSTEXPR_P (IF_STMT)
TEMPLATE_TYPE_PARM_FOR_CLASS (TEMPLATE_TYPE_PARM)
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
TI_PENDING_TEMPLATE_FLAG.
TEMPLATE_PARMS_FOR_INLINE.
DELETE_EXPR_USE_VEC (in DELETE_EXPR).
(TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
ICS_ELLIPSIS_FLAG (in _CONV)
store-layout.c (finish_record_layout): Add free_p parameter. * store-layout.c (finish_record_layout): Add free_p parameter. (layout_type): Pass it. * tree.h (finish_record_layout): Update prototype. * class.c (walk_subobject_offsets): Correct the calculation of offsets for virtual bases. Correct the counting of array elements. (layout_nonempty_base_or_field): Simplify. Correct the calculation of offsets to be propagated through the binfo hierarchy. (build_base_field): Avoid creating a FIELD_DECL for empty bases. Add the FIELD_DECL to TYPE_FIELDS. (build_base_fields): Adjust accordingly. (layout_virtual_bases): Use build_base_field. (end_of_class): Return a tree, not an integer. (warn_about_ambiguous_direct_bases): Rename to ... (warn_about_ambiguous_bases): ... this. (include_empty_classes): New function. (layout_class_type): Create an alternative version of the type to be used when as a base class type. Do not call finish_record_layout until we are done laying out the class. * cp-tree.h (lang_type_class): Remove size, size_unit. Add as_base. (CLASSTYPE_SIZE): Reimplement. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN): Likweise. (CLASSTYPE_USER_ALIGN): Likewise. (CLASSTYPE_AS_BASE): New macro. (DECL_INITIALIZED_P): Likewise. (extract_init): Remove prototype. (build_forced_zero_init): Rename to ... (build_zero_init): ... this. (force_store_init_value): Remove. * decl.c (obscure_complex_init): Remove. (duplicate_decls): Copy DECL_INITIALIZED_P. (check_initializer): Do not leave junk in DECL_INITIAL. (cp_finish_decl): Handle zero-initialization of entities with static storage duration. * expr.c (extract_init): Remove. * init.c (build_forced_zero_init): Remove. (build_zero_init): New function. (build_default_init): Use it. (build_field_list): Skip FIELD_DECLs for base subobjects. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. (synthesize_exception_spec): Likewise. * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P. (regenerate_decl_from_template): To not set DECL_INITIAL for a static data member whose initialization took place in its class. (instantiate_decl): Do not pass an initializer to cp_finish_decl in that situation. * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects. (dfs_unuse_fields): Likewise. * tree.c (pod_type_p): Handle error_mark_node. (zero_init_p): Likewise. * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base subobjects. * typeck2.c (store_init_value): Remove #if 0'd code. (force_store_init_value): Remove. (process_init_constructor): Use build_zero_init. * g++.dg/abi/empty7.C: New test. * g++.dg/init/pm2.C: Likewise. From-SVN: r57654
2002-09-30 18:52:19 +02:00
DECL_INITIALIZED_P (in VAR_DECL)
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 (in TYPENAME_TYPE)
STMT_IS_FULL_EXPR_P (in _STMT)
TARGET_EXPR_LIST_INIT_P (in TARGET_EXPR)
LAMBDA_EXPR_MUTABLE_P (in LAMBDA_EXPR)
DECL_FINAL_P (in FUNCTION_DECL)
QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF)
DECLTYPE_FOR_INIT_CAPTURE (in DECLTYPE_TYPE)
CONSTRUCTOR_NO_IMPLICIT_ZERO (in CONSTRUCTOR)
TINFO_USED_TEMPLATE_ID (in TEMPLATE_INFO)
PACK_EXPANSION_SIZEOF_P (in *_PACK_EXPANSION)
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE)
ICS_THIS_FLAG (in _CONV)
re PR c++/11547 (ICE with const temporaries) PR c++/11547 * cp-tree.h (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P): New macro. (DECL_PRETTY_FUNCTION_P): Use VAR_DECL_CHECK. * decl.c (duplicate_decls): Merge DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. * parser.c (cp_parser_postfix_expression): Adjust call to cp_parser_initializer_list and cp_parser_parenthesized_expression_list. (cp_parser_parenthesized_expression_list): Add non_constant_p. (cp_parser_new_placement): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_direct_new_declarator): Likewise. (cp_parser_conditional_expression): Remove. (cp_parser_constant_expression): Parse an assignment-expression, not a conditional-expression. (cp_parser_simple_declaration): Resolve expression/declaration ambiguity more quickly. (cp_parser_mem_initializer): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_init_declarator): Keep track of whether or not the initializer is a constant-expression. (cp_parser_initializer): Add non_constant_p parameter. (cp_parser_initializer_clause): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_attribute_list): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_functional_cast): Likewise. * pt.c (tsubst_decl): Copy DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. (tsubst_expr): Tweak use of DECL_PRETTY_FUNCTION_P. * semantics.c (finish_id_expression): Use DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. PR c++/11547 * g++.dg/parse/constant3.C: New test. * g++.dg/parse/crash7.C: Likewise. From-SVN: r69493
2003-07-17 06:31:42 +02:00
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST)
TYPENAME_IS_RESOLVING_P (in TYPE_NAME_TYPE)
TARGET_EXPR_DIRECT_INIT_P (in TARGET_EXPR)
Implement return type deduction for normal functions with -std=c++1y. * cp-tree.h (FNDECL_USED_AUTO): New macro. (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P): Remove. (dependent_lambda_return_type_node): Remove. (CPTI_DEPENDENT_LAMBDA_RETURN_TYPE): Remove. (struct language_function): Add x_auto_return_pattern field. (current_function_auto_return_pattern): New. (enum tsubst_flags): Add tf_partial. * decl.c (decls_match): Handle auto return comparison. (duplicate_decls): Adjust error message for auto return. (cxx_init_decl_processing): Remove dependent_lambda_return_type_node. (cp_finish_decl): Don't do auto deduction for functions. (grokdeclarator): Allow auto return without trailing return type in C++1y mode. (check_function_type): Defer checking of deduced return type. (start_preparsed_function): Set current_function_auto_return_pattern. (finish_function): Set deduced return type to void if not previously deduced. * decl2.c (change_return_type): Handle error_mark_node. (mark_used): Always instantiate functions with deduced return type. Complain about use if deduction isn't done. * parser.c (cp_parser_lambda_declarator_opt): Use 'auto' for initial return type. (cp_parser_lambda_body): Don't deduce return type in a template. (cp_parser_conversion_type_id): Allow auto in C++1y. * pt.c (instantiate_class_template_1): Don't mess with LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P. (tsubst_copy_and_build): Likewise. (fn_type_unification, tsubst): Don't reduce the template parm level of 'auto' during deduction. (unify): Compare 'auto' specially. (get_bindings): Change test. (always_instantiate_p): Always instantiate functions with deduced return type. (do_auto_deduction): Handle error_mark_node and lambda context. Don't check for use in initializer. (contains_auto_r): Remove. * search.c (lookup_conversions_r): Handle auto conversion function. * semantics.c (lambda_return_type): Handle null return. Don't mess with dependent_lambda_return_type_node. (apply_deduced_return_type): Rename from apply_lambda_return_type. * typeck.c (merge_types): Handle auto. (check_return_expr): Do auto deduction. * typeck2.c (add_exception_specifier): Fix complain check. From-SVN: r185768
2012-03-24 21:56:08 +01:00
FNDECL_USED_AUTO (in FUNCTION_DECL)
DECLTYPE_FOR_LAMBDA_PROXY (in DECLTYPE_TYPE)
REF_PARENTHESIZED_P (in COMPONENT_REF, INDIRECT_REF, SCOPE_REF)
AGGR_INIT_ZERO_FIRST (in AGGR_INIT_EXPR)
CONSTRUCTOR_MUTABLE_POISON (in CONSTRUCTOR)
3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
ICS_BAD_FLAG (in _CONV)
FN_TRY_BLOCK_P (in TRY_BLOCK)
IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
BIND_EXPR_BODY_BLOCK (in BIND_EXPR)
DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL)
CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE)
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
CALL_EXPR, or FIELD_DECL).
IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
DECL_TINFO_P (in VAR_DECL)
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
FUNCTION_REF_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
Integrated preprocessor. top level: * Makefile.in: Remove all references to c-parse.gperf, c-gperf.h, and c-parse.h. Remove -d from yacc command line generating c-parse.c. Update dependencies. * c-parse.gperf, c-gperf.h: Delete. * c-common.c: Don't define parse_options, cpp_token, yy_cur, yy_lim, or yy_get_token. Don't define get_directive_line if USE_CPPLIB. * c-common.h: Add multiple include guard. Define RID values for every keyword in C, C++, and Objective C. Put all the modifiers first. (struct c_fileinfo, get_fileinfo, dump_time_statistics): New. * c-decl.c (c_decode_option): Handle -lang-objc here. (print_lang_identifier): Handle C_IS_RESERVED_WORD case. (grokdeclarator): Adjust for new RID scheme. (extract_interface_info): New stub. * c-lang.c: Don't declare yy_cur or parse_options. (lang_init_options): Call cpp_init. Don't call cpp_options_init. (lang_init): Don't call check_newline if USE_CPPLIB. * c-lex.c: Don't include c-parse.h. Do include timevar.h. Elide lots of unnecessary code if USE_CPPLIB. Delete code rendered unnecessary by new architecture. Move routines not shared with C++ to c-parse.in. Maintain a local idea of the line number. Handle C++ as well as C. [USE_CPPLIB]: Declare and register callbacks for #ident and for entering/leaving files. (init_c_lex, c_lex): Are now the entry points to this file. (check_newline): Break out directive handling to process_directive. (read_ucs, is_extended_char, utf8_extend_token): Moved here from C++ front end. (readescape, parse_float): Overhaul. (lex_number, lex_string, lex_charconst): Break out of c_lex (n'ee yylex). (get_fileinfo, update_header_times, dump_one_header, dump_time_statistics): New and/or moved here from C++. Support per-file data needed by C++ and per-header timing statistics (C++ only, at the moment). * c-lex.h: Update prototypes. Add multiple include guard. * c-tree.h (struct lang_identifier): Add rid_code field. (C_IS_RESERVED_WORD, C_RID_CODE): New. * c-parse.in: Include c-pragma.h. Remove unnecesary calls to reinit_parse_for_function and/or position_after_white_space. (save_filename, save_lineno): Look ahead before saving. (label -> identifier ':'): Save file and line before shifting ':'. (reservedwords): No need to call get_identifier. (init_parse, finish_parse, yyerror, yylex, yyprint, make_pointer_declarator): Are now here for C/ObjC. (rid_to_yy): Conversion table from RID constants to Yacc codes. * c-pragma.c: Rewrite parsing logic to fit with cpplib's #pragma registry. Provide dummy implementation of that interface if !USE_CPPLIB. * c-pragma.h: Update to match. * flags.h: Add multiple include guard. (flag_detailed_statistics): Moved here from C++. * toplev.c: Define flag_detailed_statistics. * gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * timevar.def (TV_CPP, TV_LEX): New. * timevar.h: Add multiple include guard. * objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * objc/objc-act.c: Don't mention yy_cur or parse_options. Initialize cpplib properly. Force lineno to 0 after first call to check_newline. Don't handle -lang-objc here. Move forget_protocol_qualifiers and remember_protocol_qualifiers here. cp: * Make-lang.in, Makefile.in: Remove all references to input.c, gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS. * gxx.gperf, hash.h, input.c: Delete. * lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is initialized properly. * class.c (fixup_pending_inline): Take a tree, not a struct pending_inline *. All callers changed. (init_class_processing): Set RID_PUBLIC, RID_PRIVATE, RID_PROTECTED entries in ridpointers[] array here. * decl.c (duplicate_decls): Do not refer to struct pending_inline. (record_builtin_type, init_decl_processing): Use RID_MAX not CP_RID_MAX. (grokdeclarator): Use C_IS_RESERVED_WORD. * decl2.c (lang_decode_option): Ignore -lang-c++ for sake of cpplib. (grok_x_components): Do not inspect pending_inlines chain. * cp-tree.h (struct lang_identifier): Add rid_code entry. (C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New. (flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare. (DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME, TIME_IDENTIFIER_FILEINFO): Kill. Update prototypes. * lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a single 32-bit word. * parse.y: Call do_pending_inlines unconditionally. reinit_parse_for_method is now snarf_method. fn.defpen is no longer necessary. Remove unnecessary <itype> annotation on SCOPE. Do not refer to end_of_file or struct pending_inline. * semantics.c (begin_inline_definitions): Call do_pending_inlines unconditionally. * lex.c: Remove all code now shared with C front end. Initialize cpplib properly if USE_CPPLIB. Put reserved words into the get_identifier table. Rewrite pragma handling to work with the registry. Move code to save tokens for later processing to spew.c. * spew.c: Rewrite everything in terms of token streams instead of text. Move routines here from lex.c / input.c as appropriate. GC-mark trees hanging off the pending inlines chain. testsuite: * g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on ERROR markers. * g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line. * gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail. * gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps. * gcc.dg/wtr-suffix-1.c: Correct error regexps. * gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c: Preprocess only. * gcc.dg/cpp/unc4.c: Adjust line number in dg-error line. * gcc.dg/noncompile/const-ll-1.c: Generalize error regexp. From-SVN: r36216
2000-09-07 02:37:14 +02:00
5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
DECL_VTABLE_OR_VTT_P (in VAR_DECL)
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
FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE)
DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL)
TYPE_MARKED_P (in _TYPE)
RANGE_FOR_IVDEP (in RANGE_FOR_STMT)
CALL_EXPR_OPERATOR_SYNTAX (in CALL_EXPR, AGGR_INIT_EXPR)
Usage of TYPE_LANG_FLAG_?:
0: TYPE_DEPENDENT_P
1: TYPE_HAS_USER_CONSTRUCTOR.
2: TYPE_HAS_LATE_RETURN_TYPE (in FUNCTION_TYPE, METHOD_TYPE)
TYPE_PTRMEMFUNC_FLAG (in RECORD_TYPE)
4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
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
5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE)
ENUM_FIXED_UNDERLYING_TYPE_P (in ENUMERAL_TYPE)
AUTO_IS_DECLTYPE (in TEMPLATE_TYPE_PARM)
REFERENCE_VLA_OK (in REFERENCE_TYPE)
6: TYPE_DEPENDENT_P_VALID
Usage of DECL_LANG_FLAG_?:
0: DECL_ERROR_REPORTED (in VAR_DECL).
DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * call.c (equal_functions): Use DECL_LOCAL_FUCNTION_P, not TREE_PERMANENT. * decl.c (pushdecl): Set DECL_LOCAL_FUNCTION_P. * decl2.c (lookup_arg_dependent): Use it. * cp-tree.h (cp_finish_decl): Change prototype. (finish_static_data_member_decl): Likewise. (push_permanent_obstack): Remove declaration. (push_expression_obstack): Likewise. (push_scratch_obstack): Likewise. (DECL_TEMPLATE_PARM_P): Robustify. (SET_DECL_TEMPLATE_PARM_P): New macro. * class.c (add_method): Don't manipulate obstacks. (finish_vtbls): Likewise. * cvt.c (build_up_reference): Adjust calls to cp_finish_decl. * decl.c (binding_for_name): Don't manipulate obstacks. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (implicitly_declare): Likewise. (build_typename_type): Likewise. (start_decl): Likewise. (cp_finish_decl): Likewise. (finish_decl): Likewise. (destroy_local_static): Likewise. (expand_static_init): Likewise. (complete_array_type): Likewise. (grokvardecl): Likewise. (build_ptrmemfnc_type): Likewise. (grokdeclarator): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. (start_enum): Likewise. (finish_enum): Likewise. (start_function): Likewise. (finish_function): Likewise. (start_method): Adjust call to cp_finish_decl. * decl2.c (finish_static_data_member_decl): Don't manipulate obstacks. (grokfield): Likewise. (grokbitfield): Likewise. (get_temp_name): Likewise. (get_sentry): Likewise. (fnish_file): Likewise. (lookup_arg_dependent): Likewise. * except.c (call_eh_info): Likewise. (push_eh_info): Likewise. (do_pop_exception): Likewise. (initialize_handler_parm): Likewise. (expand_end_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * expr.c (extract_scalar_init): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (snarf_defarg): Likewise. (add_defarg_fn): Likewise. (is_global): Simplify. (do_identifier): Don't check TREE_PERMANENT. * method.c (emit_thunk): Don't manipulate obstacks. * parse.y (condition): Adjust call to cp_finish_decl. (primary): Likewise. (initdcl): Likewise. (initdcl0_innards): Likewise. (nomods_initdcl0): Likewise. * pt.c (push_inline_template_parms_recursive): Use SET_DECL_TEMPLATE_PARM_P. (process_template_parm): Likewise. (lookup_template_class): Don't manipulate obstacks. (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_decl): Don't manipulate obstacks. (tsubst_expr): Likewise. (instantiate_template): Likewise. (instantiate_decl): Adjust calls to cp_finish_decl. * rtti.c (call_void_fn): Don't manipulate obstacks. (get_tinfo_var): Likewise. (get_tinfo_fn_unused): Likewise. (build_dynamic_cast_1): Likewise. (expand_si_desc): Likewise. (expand_class_desc): Likewise. (expand_ptr_desc): Likewise. (expand_attr_desc): Likewise. (expand_generic_desc): Likewise. (synthesize_tinfo_fn): Likewise. * search.c (expand_upcast_fixups): Likewise. * semantics.c (finish_asm_stmt): Likewise. (finish_named_return_value): Likewise. (begin_class_definition): Likewise. (finish_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (build_cplus_method_type): Likewise. (reverse_path): Likewise. (copy_template_template_parm): Likewise. (build_expr_ptr_wrapper): Likewise. (push_expression_obstack): Remove. (push_permanent_obstack): Likewise. * typeck.c (mark_addressable): Likewise. From-SVN: r30527
1999-11-14 21:29:06 +01:00
DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL)
DECL_MUTABLE_P (in FIELD_DECL)
DECL_DEPENDENT_P (in USING_DECL)
LABEL_DECL_BREAK (in LABEL_DECL)
1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
DECL_MEMBER_TEMPLATE_P (in TEMPLATE_DECL)
USING_DECL_TYPENAME_P (in USING_DECL)
DECL_VLA_CAPTURE_P (in FIELD_DECL)
DECL_ARRAY_PARAMETER_P (in PARM_DECL)
LABEL_DECL_CONTINUE (in LABEL_DECL)
2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
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
DECL_CONSTRAINT_VAR_P (in a PARM_DECL)
TEMPLATE_DECL_COMPLEX_ALIAS_P (in TEMPLATE_DECL)
DECL_INSTANTIATING_NSDMI_P (in a FIELD_DECL)
3: DECL_IN_AGGR_P.
store-layout.c (finish_record_layout): Add free_p parameter. * store-layout.c (finish_record_layout): Add free_p parameter. (layout_type): Pass it. * tree.h (finish_record_layout): Update prototype. * class.c (walk_subobject_offsets): Correct the calculation of offsets for virtual bases. Correct the counting of array elements. (layout_nonempty_base_or_field): Simplify. Correct the calculation of offsets to be propagated through the binfo hierarchy. (build_base_field): Avoid creating a FIELD_DECL for empty bases. Add the FIELD_DECL to TYPE_FIELDS. (build_base_fields): Adjust accordingly. (layout_virtual_bases): Use build_base_field. (end_of_class): Return a tree, not an integer. (warn_about_ambiguous_direct_bases): Rename to ... (warn_about_ambiguous_bases): ... this. (include_empty_classes): New function. (layout_class_type): Create an alternative version of the type to be used when as a base class type. Do not call finish_record_layout until we are done laying out the class. * cp-tree.h (lang_type_class): Remove size, size_unit. Add as_base. (CLASSTYPE_SIZE): Reimplement. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN): Likweise. (CLASSTYPE_USER_ALIGN): Likewise. (CLASSTYPE_AS_BASE): New macro. (DECL_INITIALIZED_P): Likewise. (extract_init): Remove prototype. (build_forced_zero_init): Rename to ... (build_zero_init): ... this. (force_store_init_value): Remove. * decl.c (obscure_complex_init): Remove. (duplicate_decls): Copy DECL_INITIALIZED_P. (check_initializer): Do not leave junk in DECL_INITIAL. (cp_finish_decl): Handle zero-initialization of entities with static storage duration. * expr.c (extract_init): Remove. * init.c (build_forced_zero_init): Remove. (build_zero_init): New function. (build_default_init): Use it. (build_field_list): Skip FIELD_DECLs for base subobjects. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. (synthesize_exception_spec): Likewise. * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P. (regenerate_decl_from_template): To not set DECL_INITIAL for a static data member whose initialization took place in its class. (instantiate_decl): Do not pass an initializer to cp_finish_decl in that situation. * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects. (dfs_unuse_fields): Likewise. * tree.c (pod_type_p): Handle error_mark_node. (zero_init_p): Likewise. * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base subobjects. * typeck2.c (store_init_value): Remove #if 0'd code. (force_store_init_value): Remove. (process_init_constructor): Use build_zero_init. * g++.dg/abi/empty7.C: New test. * g++.dg/init/pm2.C: Likewise. From-SVN: r57654
2002-09-30 18:52:19 +02:00
4: DECL_C_BIT_FIELD (in a FIELD_DECL)
DECL_ANON_UNION_VAR_P (in a VAR_DECL)
DECL_SELF_REFERENCE_P (in a TYPE_DECL)
DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL)
5: DECL_INTERFACE_KNOWN.
6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
DECL_FIELD_IS_BASE (in FIELD_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
TYPE_DECL_ALIAS_P (in TYPE_DECL)
7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
DECL_THUNK_P (in a member FUNCTION_DECL)
DECL_NORMAL_CAPTURE_P (in FIELD_DECL)
8: DECL_DECLARED_CONSTEXPR_P (in VAR_DECL, FUNCTION_DECL)
cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. (TYPE_BINFO): Likewise. (IS_AGGR_TYPE): Tweak. (SET_IS_AGGR_TYPE): New macro. (CLASS_TYPE_P): Tweak. (lang_type): Group mark bitfields together. Remove linenum. (CLASSTYPE_SOURCE_LINE): Remove macro. (CLASSTYPE_MARKED_N): New macro. (SET_CLASSTYPE_MARKED_N): Likewise. (CLEAR_CLASSTYPE_MARKED_N): Likewise. (CLASS_TYPE_MARKED_*): Use them. (SET_CLASSTYPE_MARKED_*): Likewise. (CLEAR_CLASSTYPE_MARKED_*): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well. (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE. * class.c (class_cache_obstack): New variable. (class_cache_firstobj): Likewise. (finish_struct): Don't set CLASSTYPE_SOURCE_LINE. (pushclass): Free the cache, when appropriate. (popclass): Tidy. (maybe_push_cache_obstack): Use class_cache_obstack. * decl.c (include hash.h). (typename_hash): New function. (typename_compare): Likewise. (build_typename_type): Check the hash table to avoid creating duplicates. (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE. (grokdeclarator): Use CLASS_TYPE_P. (xref_basetypes): Likewise. (start_function): Likewise. Don't put current_class_ref on the permanent obstack. * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO and TYPE_TI_ARGS. * lex.c (note_got_semicolon): Use CLASS_TYPE_P. (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated fields for types other than class types. Do clear TYPE_ALIAS_SET for types other than class types, though. * method.c (build_overload_identifier): Use CLASS_TYPE_P and TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * pt.c (process_template_parm): Don't set CLASSTYPE_GOT_SEMICOLON. (lookup_template_class) Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. Coerce arguments on the momentary obstack. (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (instantiate_class_template): Calculate template arguments on the momentary obstack. Tidy. (tsubst_template_arg_vector): Use make_temp_vec. (tsubst_aggr_type): Put template arguments on the momentary obstack. (tsubst_decl): Likewise. (tsubst): Copy the array bounds index to the permanent obstack before building index types. Use new macros. (unify): Use new macros. (do_type_instantiation): Likewise. * search.c (lookup_fnfields_1): Use new macros. (dfs_pushdecls): Build envelopes on the cache obstack. (dfs_compress_decls): Use new macros. (push_class_decls): Build on the cache obstack. * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON. * sign.c (build_signature_pointer_or_reference_type): Use SET_IS_AGGR_TYPE. * tree.c (make_binfo): Check CLASS_TYPE_P. (copy_template_template_parm): Adjust. (make_temp_vec): Use push_expresion_obstack. * typeck.c (complete_type): Use new macros. (comptypes): Likewise. From-SVN: r23686
1998-11-17 13:51:20 +01:00
Usage of language-independent fields in a language-dependent manner:
Allow indirect primary bases. * cp-tree.h (struct lang_type): Remove vfield_parent. Add primary_base. (CLASSTYPE_VFIELD_PARENT): Remove. (CLASSTYPE_PRIMARY_BINFO): Reimplement. (BINFO_PRIMARY_BINFO): Remove. (CLASSTYPE_HAS_PRIMARY_BASE_P): Reimplement. (BINFO_VBASE_PRIMARY_P): Likewise. (BINFO_PRIMARY_BASE_OF): New macro. (BINFO_INDIRECT_PRIMARY_P): Likewise. (get_primary_binfo): New function. * decl.c (lang_mark_tree): Make lang_type::primary_base. * class.c (vcall_offset_data_s): Rename to ... (vtbl_init_data_s): ... this. Rename primary_p to primary_vtbl_p, and add ctor_vtbl_p. (get_derived_offset): Use get_primary_binfo. (dfs_mark_primary_bases): Adjust handling of virtual primary bases. (mark_primary_bases): Likewise. (set_primary_base): Take a binfo, not an integer, as a representation of the primary base. (indirect_primary_base_p): Remove. (determine_primary_base): Adjust for indirect primary bases. (dfs_find_final_overrider): Fix typo in coment. (update_vtable_entry_for_fn): Use get_primary_binfo. (layout_nonempty_base_or_field): Tweak. (build_base_fields): Adjust for new primary base semantics. (dfs_propagate_binfo_offsets): Remove. (propagate_binfo_offsets): Rewrite. (dfs_set_offset_for_shared_vbases): Remove. (layout_virtual_bases): Don't use it. (layout_class_type): Set CLASSTYPE_SIZE correctly under the new ABI. (finish_struct_1): Set CLASSTYPE_PRIMARY_BINFO, not CLASSTYPE_VFIELD_PARENT. (dfs_get_primary_binfo): New function. (get_primary_binfo): Likewise. (dump_class_hierarchy_r): Tweak printing of primary bases. (build_vtbl_initializer): Fix typo in comments. Use vtbl_init_data. (build_vcall_and_vbase_vtbl_entries): Likewise. (build_vbaes_offset_vtbl_entries): Likewise. (dfs_build_vcall_offset_vtbl_entries): Adjust setting of BV_VCALL_INDEX to handle indirect primary bases. (build_vcall_offset_vtbl_entries): Use vtbl_init_data. (build_rtti_vtbl_entries): Likewise. * search.c (get_shared_vbase_if_not_primary): Tweak. (find_vbase_instance): Likewise. (binfo_for_vtable): Simplify. * tree.c (unshare_base_binfos): Clear BINFO_PRIMARY_BASE_OF. (make_binfo): Make it have 11 entries. From-SVN: r35360
2000-07-31 02:24:44 +02:00
cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. (TYPE_BINFO): Likewise. (IS_AGGR_TYPE): Tweak. (SET_IS_AGGR_TYPE): New macro. (CLASS_TYPE_P): Tweak. (lang_type): Group mark bitfields together. Remove linenum. (CLASSTYPE_SOURCE_LINE): Remove macro. (CLASSTYPE_MARKED_N): New macro. (SET_CLASSTYPE_MARKED_N): Likewise. (CLEAR_CLASSTYPE_MARKED_N): Likewise. (CLASS_TYPE_MARKED_*): Use them. (SET_CLASSTYPE_MARKED_*): Likewise. (CLEAR_CLASSTYPE_MARKED_*): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well. (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE. * class.c (class_cache_obstack): New variable. (class_cache_firstobj): Likewise. (finish_struct): Don't set CLASSTYPE_SOURCE_LINE. (pushclass): Free the cache, when appropriate. (popclass): Tidy. (maybe_push_cache_obstack): Use class_cache_obstack. * decl.c (include hash.h). (typename_hash): New function. (typename_compare): Likewise. (build_typename_type): Check the hash table to avoid creating duplicates. (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE. (grokdeclarator): Use CLASS_TYPE_P. (xref_basetypes): Likewise. (start_function): Likewise. Don't put current_class_ref on the permanent obstack. * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO and TYPE_TI_ARGS. * lex.c (note_got_semicolon): Use CLASS_TYPE_P. (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated fields for types other than class types. Do clear TYPE_ALIAS_SET for types other than class types, though. * method.c (build_overload_identifier): Use CLASS_TYPE_P and TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * pt.c (process_template_parm): Don't set CLASSTYPE_GOT_SEMICOLON. (lookup_template_class) Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. Coerce arguments on the momentary obstack. (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (instantiate_class_template): Calculate template arguments on the momentary obstack. Tidy. (tsubst_template_arg_vector): Use make_temp_vec. (tsubst_aggr_type): Put template arguments on the momentary obstack. (tsubst_decl): Likewise. (tsubst): Copy the array bounds index to the permanent obstack before building index types. Use new macros. (unify): Use new macros. (do_type_instantiation): Likewise. * search.c (lookup_fnfields_1): Use new macros. (dfs_pushdecls): Build envelopes on the cache obstack. (dfs_compress_decls): Use new macros. (push_class_decls): Build on the cache obstack. * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON. * sign.c (build_signature_pointer_or_reference_type): Use SET_IS_AGGR_TYPE. * tree.c (make_binfo): Check CLASS_TYPE_P. (copy_template_template_parm): Adjust. (make_temp_vec): Use push_expresion_obstack. * typeck.c (complete_type): Use new macros. (comptypes): Likewise. From-SVN: r23686
1998-11-17 13:51:20 +01:00
TYPE_ALIAS_SET
This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
forth as a substitute for the mark bits provided in `lang_type'.
At present, only the six low-order bits are used.
c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * dwarf2out.c (add_data_member_location_attribute): Check for TREE_BINFO. * tree.c (tree_node_kinds): Add "binfos". (binfo_lang_slots): New. (make_node_stat): Add TREE_BINFO. (make_tree_binfo_stat): New. (tree_node_structure): Add TREE_BINFO. * tree.def (TREE_BINFO): New. * tree.h (REC_OR_UNION_CHECK): Rename to ... (RECORD_OR_UNION_CHECK): ... here. (NOT_RECORD_OR_UNION_CHECK): New. (TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO. (TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for RECORD_OR_UNION_CHECK. (TYPE_BINFO): Use RECORD_OR_UNION_CHECK. (TYPE_LANG_SLOT_1): New. (BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS, BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD, BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust. (BINFO_ELTS): Remove. (BINFO_LANG_SLOT): New. (struct tree_binfo): New. (binfo_lang_slots): Declare. (enum tree_node_structure_enum): Add TS_BINFO. (union tree_node): Add binfo. (make_tree_binfo_stat): Declare. (make_tree_binfo): New. (enum tree_node_kind): Add binfo_kind. * cp/call.c (enforce_access): Expect TREE_BINFO. * cp/class.c (binfo_ctor_vtable): Check TREE_BINFO. * cp/cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Adjust. (BINFO_LANG_ELTS): Remove. (BINFO_LANG_SLOTS): New. (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (CLASSTYPE_TEMPLATE_INFO): Adjust. * cp/pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case. * cp/search.c (lookup_member): Check TREE_BINFO. * cp/semantics.c (perform_or_defer_access_check): Likewise. (check_accessibility_of_qualified_id): Check deferred_access_no_check. * cp/tree.c (make_binfo): Use make_tree_binfo. * java/class.c (make_class): Use make_tree_binfo. (set_super_info, add_interface_do): Likewise. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO. * objc/objc-act.c (start_class, objc_declare_protocols, start_protocols): Use TYPE_LANG_SLOT_1. * objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename to ... (CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here. (CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE, CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS, PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1. From-SVN: r84110
2004-07-05 11:35:44 +02:00
TYPE_LANG_SLOT_1
cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. (TYPE_BINFO): Likewise. (IS_AGGR_TYPE): Tweak. (SET_IS_AGGR_TYPE): New macro. (CLASS_TYPE_P): Tweak. (lang_type): Group mark bitfields together. Remove linenum. (CLASSTYPE_SOURCE_LINE): Remove macro. (CLASSTYPE_MARKED_N): New macro. (SET_CLASSTYPE_MARKED_N): Likewise. (CLEAR_CLASSTYPE_MARKED_N): Likewise. (CLASS_TYPE_MARKED_*): Use them. (SET_CLASSTYPE_MARKED_*): Likewise. (CLEAR_CLASSTYPE_MARKED_*): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well. (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE. * class.c (class_cache_obstack): New variable. (class_cache_firstobj): Likewise. (finish_struct): Don't set CLASSTYPE_SOURCE_LINE. (pushclass): Free the cache, when appropriate. (popclass): Tidy. (maybe_push_cache_obstack): Use class_cache_obstack. * decl.c (include hash.h). (typename_hash): New function. (typename_compare): Likewise. (build_typename_type): Check the hash table to avoid creating duplicates. (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE. (grokdeclarator): Use CLASS_TYPE_P. (xref_basetypes): Likewise. (start_function): Likewise. Don't put current_class_ref on the permanent obstack. * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO and TYPE_TI_ARGS. * lex.c (note_got_semicolon): Use CLASS_TYPE_P. (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated fields for types other than class types. Do clear TYPE_ALIAS_SET for types other than class types, though. * method.c (build_overload_identifier): Use CLASS_TYPE_P and TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * pt.c (process_template_parm): Don't set CLASSTYPE_GOT_SEMICOLON. (lookup_template_class) Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. Coerce arguments on the momentary obstack. (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (instantiate_class_template): Calculate template arguments on the momentary obstack. Tidy. (tsubst_template_arg_vector): Use make_temp_vec. (tsubst_aggr_type): Put template arguments on the momentary obstack. (tsubst_decl): Likewise. (tsubst): Copy the array bounds index to the permanent obstack before building index types. Use new macros. (unify): Use new macros. (do_type_instantiation): Likewise. * search.c (lookup_fnfields_1): Use new macros. (dfs_pushdecls): Build envelopes on the cache obstack. (dfs_compress_decls): Use new macros. (push_class_decls): Build on the cache obstack. * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON. * sign.c (build_signature_pointer_or_reference_type): Use SET_IS_AGGR_TYPE. * tree.c (make_binfo): Check CLASS_TYPE_P. (copy_template_template_parm): Adjust. (make_temp_vec): Use push_expresion_obstack. * typeck.c (complete_type): Use new macros. (comptypes): Likewise. From-SVN: r23686
1998-11-17 13:51:20 +01:00
For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
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
* Eliminate DECL_FIELD_SIZE. * builtins.c (built_in_class_names, built_in_names): New variables. * c-decl.c (finish_struct): Set specified size in DECL_SIZE. * expr.c (expand_expr, case COMPONENT_REF): Get field size from DECL_SIZE, not DECL_FIELD_SIZE. * print-tree.c (print_node): Remove code that prints extra blank lines in some cases. Properly handle inline and builtin function cases. * stor-layout.c (layout_decl): Get specified size from DEC_SIZE. * tree.h (built_in_class_named, built_in_names): New declarations. (union tree_decl): Rename internal unions to u1 and u2 and change some of their components. Add new field built_in_class. (DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE): Reflect above changes. (DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise. (DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted. * objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE. (encode_field_decl): Likewise; also remove obsolete test for bitfield. * ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name. * ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE. * ch/typeck.c (make_chill_struct_type): Likewise. (apply_decl_field_layout): General cleanup. Set DECL_SIZE instead of DECL_FIELD_SIZE. * cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear DECL_FIELD_SIZE. (check_bitfield_decl, check_field_decls): Set DECL_SIZE, not DECL_FIELD_SIZE. * cp/rtti.c (expand_class_desc): Likewise. * cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name. (THUNK_VCALL_OFFSET): Likewise. (THUNK_DELTA): Reflect changes in ../tree.h. * java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h. (DECL_BIT_INDEX): Use underlying representation. * java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise. From-SVN: r32249
2000-02-29 03:34:48 +01:00
BINFO_VIRTUALS
For a binfo, this is a TREE_LIST. There is an entry for each
virtual function declared either in BINFO or its direct and
indirect primary bases.
The BV_DELTA of each node gives the amount by which to adjust the
`this' pointer when calling the function. If the method is an
overridden version of a base class method, then it is assumed
that, prior to adjustment, the this pointer points to an object
of the base class.
The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable
index of the vcall offset for this entry.
The BV_FN is the declaration for the virtual function itself.
If BV_LOST_PRIMARY is set, it means that this entry is for a lost
primary virtual base and can be left null in the vtable.
Correct many new ABI issues regarding vbase and vcall offset layout. Correct many new ABI issues regarding vbase and vcall offset layout. * cp-tree.h (BINFO_VTABLE): Document. (struct lang_type): Tweak formatting. (BINFO_PRIMARY_BINFO): Add to documentation. (CLASSTYPE_VSIZE): Fix typo in comment. (CLASSTYPE_VBASECLASSES): Update documentation. (BINFO_VBASE_MARKED): Remove. (SET_BINFO_VBASE_MARKED): Likewise. (CLEAR_BINFO_VBASE_MARKED): Likewise. (BINFO_FIELDS_MARKED): Remove. (SET_BINFO_FIELDS_MARKED): Likewise. (CLEAR_BINFO_FIELDS_MARKED): Likewise. (enum access_kind): New enumeration. (num_extra_vtbl_entries): Remove declaration. (size_extra_vtbl_entries): Likewise. (get_vtbl_decl_for_binfo): New function. (dfs_vbase_unmark): Remove declaration. (mark_primary_bases): Likewise. * class.c (SAME_FN): Remove. (struct vcall_offset_data_s): Move definition. (build_vbase_pointer): Use `build', not `build_binary_op', to access the vbase pointer under the new ABI. (build_vtable_entry_ref): Use get_vtbl_decl_for_binfo. (build_primary_vtable): Likewise. (dfs_mark_primary_bases): Move here from search.c. (mark_primary_bases): Likewise. (determine_primary_bases): Under the new ABI, don't make a base class a primary base just because we don't yet have any virtual functions. (layout_vtable_decl): Use get_vtbl_decl_for_binfo. (num_vfun_entries): Remove. (dfs_count_virtuals): Likewise. (num_extra_vtbl_entries): Likewise. (size_extra_vtbl_entries): Likewise. (layout_virtual_bases): Iterate in inheritance graph order under the new ABI. (finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to indicate that a vfield is present. (init_class_processing): Initialize access_public_node, etc., from ak_public, etc. (get_vtbl_decl_for_binfo): New function. (dump_class_hierarchy_r): Likewise. (dump_class_hierarchy): Use it. (finish_vtbls): Build the vtbls in inheritance graph order. (dfs_finish_vtbls): Adjust call to build_vtbl_initializer. (initialize_vtable): Use get_vtbl_decl_for_binfo. (accumulate_vtbl_inits): Add comments explaining why a pre-order walk is required. (dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location where the vptr points, even for primary vtables. (build_vtbl_initializer): Adjust handling of vbase and vcall offsets. (build_vcall_and_vbase_vtable_entries): New function. (dfs_build_vbase_offset_vtbl_entries): Remove. (build_vbase_offset_vtbl_entries): Reimplement. (dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that were already handled in a primary base class vtable. (build_vcall_offset_vtbl_entries): Adjust. (build_rtti_vtbl_entries): Adjust. * decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo. * init.c (expand_virtual_init): Simplify. * repo.c (repo_get_id): Use get_vtbl_decl_for_binfo. * rtti.c (create_pseudo_type_info): Adjust calculation of vptr. * search.c (BINFO_ACCESS): New macro. (SET_BINFO_ACCESS): Likewise. (dfs_access_in_type): Manipulate access_kinds, not access nodes. (access_in_type): Likewise. (dfs_accessible_p): Likewise. (protected_accessible_p): Likewise. (lookup_fnfields_1): Adjust documentation. (dfs_mark_primary_bases): Move to class.c (mark_primary_bases): Likewise. (dfs_vbase_unmark): Remove. (virtual_context): Use BINFO_FOR_VBASE. (dfs_get_vbase_types): Simplify. (dfs_build_inheritance_graph_order): New function. (get_vbase_types): Use it. * tree.c (debug_binfo): Use get_vtbl_decl_for_binfo. * tinfo.cc (get_vbase_offset): New function. (__vmi_class_type_info::do_find_public_src): Use it. (__vmi_class_type_info::do_dyncast): Likewise. (__vmi_class_type_info::do_upcast): Likewise. From-SVN: r32905
2000-04-04 20:13:22 +02:00
BINFO_VTABLE
This is an expression with POINTER_TYPE that gives the value
Correct many new ABI issues regarding vbase and vcall offset layout. Correct many new ABI issues regarding vbase and vcall offset layout. * cp-tree.h (BINFO_VTABLE): Document. (struct lang_type): Tweak formatting. (BINFO_PRIMARY_BINFO): Add to documentation. (CLASSTYPE_VSIZE): Fix typo in comment. (CLASSTYPE_VBASECLASSES): Update documentation. (BINFO_VBASE_MARKED): Remove. (SET_BINFO_VBASE_MARKED): Likewise. (CLEAR_BINFO_VBASE_MARKED): Likewise. (BINFO_FIELDS_MARKED): Remove. (SET_BINFO_FIELDS_MARKED): Likewise. (CLEAR_BINFO_FIELDS_MARKED): Likewise. (enum access_kind): New enumeration. (num_extra_vtbl_entries): Remove declaration. (size_extra_vtbl_entries): Likewise. (get_vtbl_decl_for_binfo): New function. (dfs_vbase_unmark): Remove declaration. (mark_primary_bases): Likewise. * class.c (SAME_FN): Remove. (struct vcall_offset_data_s): Move definition. (build_vbase_pointer): Use `build', not `build_binary_op', to access the vbase pointer under the new ABI. (build_vtable_entry_ref): Use get_vtbl_decl_for_binfo. (build_primary_vtable): Likewise. (dfs_mark_primary_bases): Move here from search.c. (mark_primary_bases): Likewise. (determine_primary_bases): Under the new ABI, don't make a base class a primary base just because we don't yet have any virtual functions. (layout_vtable_decl): Use get_vtbl_decl_for_binfo. (num_vfun_entries): Remove. (dfs_count_virtuals): Likewise. (num_extra_vtbl_entries): Likewise. (size_extra_vtbl_entries): Likewise. (layout_virtual_bases): Iterate in inheritance graph order under the new ABI. (finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to indicate that a vfield is present. (init_class_processing): Initialize access_public_node, etc., from ak_public, etc. (get_vtbl_decl_for_binfo): New function. (dump_class_hierarchy_r): Likewise. (dump_class_hierarchy): Use it. (finish_vtbls): Build the vtbls in inheritance graph order. (dfs_finish_vtbls): Adjust call to build_vtbl_initializer. (initialize_vtable): Use get_vtbl_decl_for_binfo. (accumulate_vtbl_inits): Add comments explaining why a pre-order walk is required. (dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location where the vptr points, even for primary vtables. (build_vtbl_initializer): Adjust handling of vbase and vcall offsets. (build_vcall_and_vbase_vtable_entries): New function. (dfs_build_vbase_offset_vtbl_entries): Remove. (build_vbase_offset_vtbl_entries): Reimplement. (dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that were already handled in a primary base class vtable. (build_vcall_offset_vtbl_entries): Adjust. (build_rtti_vtbl_entries): Adjust. * decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo. * init.c (expand_virtual_init): Simplify. * repo.c (repo_get_id): Use get_vtbl_decl_for_binfo. * rtti.c (create_pseudo_type_info): Adjust calculation of vptr. * search.c (BINFO_ACCESS): New macro. (SET_BINFO_ACCESS): Likewise. (dfs_access_in_type): Manipulate access_kinds, not access nodes. (access_in_type): Likewise. (dfs_accessible_p): Likewise. (protected_accessible_p): Likewise. (lookup_fnfields_1): Adjust documentation. (dfs_mark_primary_bases): Move to class.c (mark_primary_bases): Likewise. (dfs_vbase_unmark): Remove. (virtual_context): Use BINFO_FOR_VBASE. (dfs_get_vbase_types): Simplify. (dfs_build_inheritance_graph_order): New function. (get_vbase_types): Use it. * tree.c (debug_binfo): Use get_vtbl_decl_for_binfo. * tinfo.cc (get_vbase_offset): New function. (__vmi_class_type_info::do_find_public_src): Use it. (__vmi_class_type_info::do_dyncast): Likewise. (__vmi_class_type_info::do_upcast): Likewise. From-SVN: r32905
2000-04-04 20:13:22 +02:00
to which the vptr should be initialized. Use get_vtbl_decl_for_binfo
to extract the VAR_DECL for the complete vtable.
Correct many new ABI issues regarding vbase and vcall offset layout. Correct many new ABI issues regarding vbase and vcall offset layout. * cp-tree.h (BINFO_VTABLE): Document. (struct lang_type): Tweak formatting. (BINFO_PRIMARY_BINFO): Add to documentation. (CLASSTYPE_VSIZE): Fix typo in comment. (CLASSTYPE_VBASECLASSES): Update documentation. (BINFO_VBASE_MARKED): Remove. (SET_BINFO_VBASE_MARKED): Likewise. (CLEAR_BINFO_VBASE_MARKED): Likewise. (BINFO_FIELDS_MARKED): Remove. (SET_BINFO_FIELDS_MARKED): Likewise. (CLEAR_BINFO_FIELDS_MARKED): Likewise. (enum access_kind): New enumeration. (num_extra_vtbl_entries): Remove declaration. (size_extra_vtbl_entries): Likewise. (get_vtbl_decl_for_binfo): New function. (dfs_vbase_unmark): Remove declaration. (mark_primary_bases): Likewise. * class.c (SAME_FN): Remove. (struct vcall_offset_data_s): Move definition. (build_vbase_pointer): Use `build', not `build_binary_op', to access the vbase pointer under the new ABI. (build_vtable_entry_ref): Use get_vtbl_decl_for_binfo. (build_primary_vtable): Likewise. (dfs_mark_primary_bases): Move here from search.c. (mark_primary_bases): Likewise. (determine_primary_bases): Under the new ABI, don't make a base class a primary base just because we don't yet have any virtual functions. (layout_vtable_decl): Use get_vtbl_decl_for_binfo. (num_vfun_entries): Remove. (dfs_count_virtuals): Likewise. (num_extra_vtbl_entries): Likewise. (size_extra_vtbl_entries): Likewise. (layout_virtual_bases): Iterate in inheritance graph order under the new ABI. (finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to indicate that a vfield is present. (init_class_processing): Initialize access_public_node, etc., from ak_public, etc. (get_vtbl_decl_for_binfo): New function. (dump_class_hierarchy_r): Likewise. (dump_class_hierarchy): Use it. (finish_vtbls): Build the vtbls in inheritance graph order. (dfs_finish_vtbls): Adjust call to build_vtbl_initializer. (initialize_vtable): Use get_vtbl_decl_for_binfo. (accumulate_vtbl_inits): Add comments explaining why a pre-order walk is required. (dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location where the vptr points, even for primary vtables. (build_vtbl_initializer): Adjust handling of vbase and vcall offsets. (build_vcall_and_vbase_vtable_entries): New function. (dfs_build_vbase_offset_vtbl_entries): Remove. (build_vbase_offset_vtbl_entries): Reimplement. (dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that were already handled in a primary base class vtable. (build_vcall_offset_vtbl_entries): Adjust. (build_rtti_vtbl_entries): Adjust. * decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo. * init.c (expand_virtual_init): Simplify. * repo.c (repo_get_id): Use get_vtbl_decl_for_binfo. * rtti.c (create_pseudo_type_info): Adjust calculation of vptr. * search.c (BINFO_ACCESS): New macro. (SET_BINFO_ACCESS): Likewise. (dfs_access_in_type): Manipulate access_kinds, not access nodes. (access_in_type): Likewise. (dfs_accessible_p): Likewise. (protected_accessible_p): Likewise. (lookup_fnfields_1): Adjust documentation. (dfs_mark_primary_bases): Move to class.c (mark_primary_bases): Likewise. (dfs_vbase_unmark): Remove. (virtual_context): Use BINFO_FOR_VBASE. (dfs_get_vbase_types): Simplify. (dfs_build_inheritance_graph_order): New function. (get_vbase_types): Use it. * tree.c (debug_binfo): Use get_vtbl_decl_for_binfo. * tinfo.cc (get_vbase_offset): New function. (__vmi_class_type_info::do_find_public_src): Use it. (__vmi_class_type_info::do_dyncast): Likewise. (__vmi_class_type_info::do_upcast): Likewise. From-SVN: r32905
2000-04-04 20:13:22 +02:00
cp-tree.h (scratchalloc): Remove. * cp-tree.h (scratchalloc): Remove. (build_scratch_list): Likewise. * call.c (convert_class_to_reference): Replace build_scratch_list and build_expr_list with build_tree_list. (add_candidate): Replace scratchalloc with expralloc. Note memory leak. (build_user_type_conversion_1): Replace build_scratch_list and build_expr_list with build_tree_list. (build_new_op): Likewise. (build_op_delete_call): Likewise. (convert_like): Likewise. * cvt.c (ocp_convert): Likewise. * decl.c (start_decl): Likewise. (start_function): Likewise. (finish_destructor_body): Likewise. (maybe_build_cleanup_1): Likewise. * decl2.c (reparse_decl_as_expr): Likewise. * init.c (perform_member_init): Likewise. (expand_cleanup_for_base): Likewise. (build_builtin_delete_call): Likewise. (build_new_1): Likewise. (build_delete): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (already_scoped_stmt): Likewise. (nontrivial_exprlist): Likewise. (net_initializer): Likewise. (initlist): Likewise. * parse.c: Regenerated. * rtti.c (build_x_typeid): Likewise. (build_dynamic_cast_1): Likewise. * typeck.c (build_x_compound_expr): Likewise. (build_static_cast): Likewise. (build_modify_expr): Likewise. * cp-tree.h (DECL_VINDEX): Add documentation. * class.c (build_vtable_entry): Likewise. (start_vtable): Add comment. (add_virtual_function): Replace pending_hard_virtuals with overridden_virtuals and pending_virtuals with new_virtuals. Replace redundant assignments with assertions. (check_for_override): Add comment. (check_bases_and_members): Replace pending_hard_virtuals with overridden_virtuals and pending_virtuals with new_virtuals. (create_vtbl_ptr): Likewise. (layout_class_type): Likewise. (finish_struct_1): Likewise. Add comments. From-SVN: r31473
2000-01-17 21:18:43 +01:00
DECL_VINDEX
This field is NULL for a non-virtual function. For a virtual
function, it is eventually set to an INTEGER_CST indicating the
index in the vtable at which this function can be found. When
a virtual function is declared, but before it is known what
function is overridden, this field is the error_mark_node.
cp-tree.h (scratchalloc): Remove. * cp-tree.h (scratchalloc): Remove. (build_scratch_list): Likewise. * call.c (convert_class_to_reference): Replace build_scratch_list and build_expr_list with build_tree_list. (add_candidate): Replace scratchalloc with expralloc. Note memory leak. (build_user_type_conversion_1): Replace build_scratch_list and build_expr_list with build_tree_list. (build_new_op): Likewise. (build_op_delete_call): Likewise. (convert_like): Likewise. * cvt.c (ocp_convert): Likewise. * decl.c (start_decl): Likewise. (start_function): Likewise. (finish_destructor_body): Likewise. (maybe_build_cleanup_1): Likewise. * decl2.c (reparse_decl_as_expr): Likewise. * init.c (perform_member_init): Likewise. (expand_cleanup_for_base): Likewise. (build_builtin_delete_call): Likewise. (build_new_1): Likewise. (build_delete): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (already_scoped_stmt): Likewise. (nontrivial_exprlist): Likewise. (net_initializer): Likewise. (initlist): Likewise. * parse.c: Regenerated. * rtti.c (build_x_typeid): Likewise. (build_dynamic_cast_1): Likewise. * typeck.c (build_x_compound_expr): Likewise. (build_static_cast): Likewise. (build_modify_expr): Likewise. * cp-tree.h (DECL_VINDEX): Add documentation. * class.c (build_vtable_entry): Likewise. (start_vtable): Add comment. (add_virtual_function): Replace pending_hard_virtuals with overridden_virtuals and pending_virtuals with new_virtuals. Replace redundant assignments with assertions. (check_for_override): Add comment. (check_bases_and_members): Replace pending_hard_virtuals with overridden_virtuals and pending_virtuals with new_virtuals. (create_vtbl_ptr): Likewise. (layout_class_type): Likewise. (finish_struct_1): Likewise. Add comments. From-SVN: r31473
2000-01-17 21:18:43 +01:00
Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
cp-tree.h (scratchalloc): Remove. * cp-tree.h (scratchalloc): Remove. (build_scratch_list): Likewise. * call.c (convert_class_to_reference): Replace build_scratch_list and build_expr_list with build_tree_list. (add_candidate): Replace scratchalloc with expralloc. Note memory leak. (build_user_type_conversion_1): Replace build_scratch_list and build_expr_list with build_tree_list. (build_new_op): Likewise. (build_op_delete_call): Likewise. (convert_like): Likewise. * cvt.c (ocp_convert): Likewise. * decl.c (start_decl): Likewise. (start_function): Likewise. (finish_destructor_body): Likewise. (maybe_build_cleanup_1): Likewise. * decl2.c (reparse_decl_as_expr): Likewise. * init.c (perform_member_init): Likewise. (expand_cleanup_for_base): Likewise. (build_builtin_delete_call): Likewise. (build_new_1): Likewise. (build_delete): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (already_scoped_stmt): Likewise. (nontrivial_exprlist): Likewise. (net_initializer): Likewise. (initlist): Likewise. * parse.c: Regenerated. * rtti.c (build_x_typeid): Likewise. (build_dynamic_cast_1): Likewise. * typeck.c (build_x_compound_expr): Likewise. (build_static_cast): Likewise. (build_modify_expr): Likewise. * cp-tree.h (DECL_VINDEX): Add documentation. * class.c (build_vtable_entry): Likewise. (start_vtable): Add comment. (add_virtual_function): Replace pending_hard_virtuals with overridden_virtuals and pending_virtuals with new_virtuals. Replace redundant assignments with assertions. (check_for_override): Add comment. (check_bases_and_members): Replace pending_hard_virtuals with overridden_virtuals and pending_virtuals with new_virtuals. (create_vtbl_ptr): Likewise. (layout_class_type): Likewise. (finish_struct_1): Likewise. Add comments. From-SVN: r31473
2000-01-17 21:18:43 +01:00
the virtual function this one overrides, and whose TREE_CHAIN is
the old DECL_VINDEX. */
/* Language-specific tree checkers. */
#define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
TREE_CHECK2(NODE,VAR_DECL,FUNCTION_DECL)
#define TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK(NODE) \
TREE_CHECK3(NODE,TYPE_DECL,TEMPLATE_DECL,FUNCTION_DECL)
#define TYPE_FUNCTION_OR_TEMPLATE_DECL_P(NODE) \
(TREE_CODE (NODE) == TYPE_DECL || TREE_CODE (NODE) == TEMPLATE_DECL \
|| TREE_CODE (NODE) == FUNCTION_DECL)
#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
TREE_CHECK3(NODE,VAR_DECL,FUNCTION_DECL,PARM_DECL)
#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
#define VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK(NODE) \
TREE_CHECK5(NODE,VAR_DECL,FIELD_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
c-common.h (IF_COND): Moved here from cp/cp-tree.h. * c-common.h (IF_COND): Moved here from cp/cp-tree.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * c-common.def: Added SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * gencheck.c (tree_codes[]): Added '#include "c-common.def"'. * cp/cp-tree.h (IF_COND): Move to c-common.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * cp/cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def. * cp/Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def. (cc1plus$(exeext)): Added $(srcdir)/c-common.def. * cp/lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'. (cplus_tree_code_length[]): Added '#include "c-common.def"'. (cplus_tree_code_name[]): Added '#include "c-common.def"'. From-SVN: r34552
2000-06-14 19:26:18 +02:00
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
#define THUNK_FUNCTION_CHECK(NODE) __extension__ \
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
({ __typeof (NODE) const __t = (NODE); \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
|| !__t->decl_common.lang_specific->u.fn.thunk_p) \
2006-06-06 13:44:09 +02:00
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
__t; })
#else
#define THUNK_FUNCTION_CHECK(NODE) (NODE)
#endif
cp-tree.h (flag_new_abi): Move. * cp-tree.h (flag_new_abi): Move. (flag_use_cxa_atexit): Likewise. (flag_honor_std): Likewise. (flag_rtti): Likewise. (vbase_offsets_in_vtable_p): Define. (vptrs_present_everywhere_p): Likewise. (TYPE_CONTAINS_VPTR_P): Likewise. (dfs_walk_real): Declare. * class.c (build_vbase_pointer_fields): Check vbase_offsets_in_vtable_p. (dfs_build_vbase_offset_vtbl_entries): Record the vbase indices in BINFO_VPTR_FIELD. (build_vbase_offset_vtbl_entries): Simplify. (build_vbase_offset_vtbl_entries): Adjust. (build_vbase_pointer): Add ability to look up vbase offsets in vtable. (start_vtable): New function. (add_virtual_function): Use it. (determine_primary_base): Use TYPE_CONTAINS_VPTR_P. (num_extra_vtbl_entries): Use vbase_offsets_in_vtable_p. (build_vtbl_initializer): Take the type of the complete object as input. Use it to correctly calculate vbase offsets. (dfs_finish_vtbls): Pass the complete type to build_vtbl_initializer. (check_bases_and_members): Use TYPE_CONTAINS_VPTR_P. (create_vtable_ptr): Create a vtable even if there are no new virtual functions, under the new ABI. (finish_struct_1): Likewise. (get_vfield_name): Use TYPE_CONTAINS_VPTR_P. * decl.c (exapnd_static_init): Remove call to preserve_initializer. * decl2.c (mark_vtable_entries): Tweak to handle vbase offsets in vtables. * init.c (initialize_vtbl_ptrs): Initialize them in pre-order. (expand_virtual_init): Use vbase_offsets_in_vtable_p. (construct_virtual_bases): Don't initialize virtual base pointers under the new ABI. (build_aggr_init): Clean up comment. (expand_aggr_init_1): Likewise. * rtti.c (expand_class_desc): Store the virtual function table index where the vbase offset lives in the offset field. * search.c (dfs_walk_real): Make it global. (dfs_debug_mark): Use TYPE_CONTAINS_VPTR_P. * tree.c (make_binfo): Don't clear BINFO_VPTR_FIELD. * tinfo.h (USItype): Make it signed under the new ABI. * tinfo.cc (convert_to_base): New function. Encapsulate base conversion logic here. (__class_type_info::do_upcast): Use it. (__class_type_info::do_dyncast): Likewise. (__class_type_info::do_find_public_subobj): Likewise. From-SVN: r31452
2000-01-17 05:08:01 +01:00
1994-02-24 02:02:37 +01:00
/* Language-dependent contents of an identifier. */
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) lang_identifier {
struct c_common_identifier c_common;
Compile-time improvement: 2/n. * cp-tree.h (struct cxx_binding): New datatype; (struct lang_identifier): Use it. (LOCAL_BINDING_P): Adjust definition. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Likewise. (BINDING_HAS_LEVEL_P): Likewise. (BINDING_VALUE): Likewise. (BINDING_TYPE): Likewise. (IDENTIFIER_VALUE): Likewise. (struct tree_binding): Remove. (TS_CP_BINDING): Likewise. ((union lang_tree_node): Remove field "binding". (cxx_binding_clear): New macro. (binding_for_name): Adjust return type. (qualified_lookup_using_namespace): Adjust prototype. (lookup_using_namespace): Adjust prototype. (cxx_scope_find_binding_for_name): Declare. * cp-tree.def: Remove CPLUS_BINDING definition. * parse.y (parse_scoped_id): Don't type-abuse of 'id'. Allocate temporary cxx_binding on stack. Simplify. * decl.c (push_binding): Adjust local variable type. (add_binding): Likewise. (push_class_binding): Likewise. (pop_binding): Likewise. (poplevel): Likewise. (poplevel_class): Likewise. (free_bindings): Adjust type. (find_binding): Adjust return type, add a third parameter. Remove non-useful assertion now that we use static typing. (cxx_scope_find_binding_for_name): New function. (binding_for_name): Use it. Adjust local variable type. Simplify. (namespace_binding): Simplify. (set_namespace_binding): Likewise. (set_identifier_type_value_with_scope): Adjust local variable type. (lookup_tag): Don't type-abuse of local variable 'old'. (lookup_namespace_name): Likewise. Allocate binding on stack. (select_decl): Adjust prototype. (unqualified_namespace_lookup): Allocate binding on stack. Don't type-abuse of local variable 'val'. (lookup_name_real): Likewise. (maybe_inject_for_scope_var): Adjust local variable type. (cp_tree_node_structure): Remove CPLUS_BINDING case label. (namespace_binding): Adjust logic, simplify. (BINDING_LEVEL): Adjust definition. (push_class_level_binding): Adjust local variable type. (struct cxx_saved_binding): Adjust field 'binding' type. * decl2.c (ambiguous_decl): Adjust prototype. (lookup_using_namespace): Adjust local variable type. (qualified_lookup_using_namespace): Catch type error and correct ensueing logic error. (do_nonmember_using_decl): Adjust local variable type. Allocate temporary cxx_binding on stack. (do_toplevel_using_decl): Adjust local variable type. * ptree.c (cxx_print_cxx_binding): New function. (cxx_print_identifier): Use it. (cxx_print_xnode): Delete CPLUS_BINDING case label. From-SVN: r64405
2003-03-15 17:30:02 +01:00
cxx_binding *namespace_bindings;
cxx_binding *bindings;
1994-02-24 02:02:37 +01:00
tree class_template_info;
tree label_value;
1994-02-24 02:02:37 +01:00
};
/* Return a typed pointer version of T if it designates a
C++ front-end identifier. */
inline lang_identifier*
identifier_p (tree t)
{
if (TREE_CODE (t) == IDENTIFIER_NODE)
return (lang_identifier*) t;
return NULL;
}
Integrated preprocessor. top level: * Makefile.in: Remove all references to c-parse.gperf, c-gperf.h, and c-parse.h. Remove -d from yacc command line generating c-parse.c. Update dependencies. * c-parse.gperf, c-gperf.h: Delete. * c-common.c: Don't define parse_options, cpp_token, yy_cur, yy_lim, or yy_get_token. Don't define get_directive_line if USE_CPPLIB. * c-common.h: Add multiple include guard. Define RID values for every keyword in C, C++, and Objective C. Put all the modifiers first. (struct c_fileinfo, get_fileinfo, dump_time_statistics): New. * c-decl.c (c_decode_option): Handle -lang-objc here. (print_lang_identifier): Handle C_IS_RESERVED_WORD case. (grokdeclarator): Adjust for new RID scheme. (extract_interface_info): New stub. * c-lang.c: Don't declare yy_cur or parse_options. (lang_init_options): Call cpp_init. Don't call cpp_options_init. (lang_init): Don't call check_newline if USE_CPPLIB. * c-lex.c: Don't include c-parse.h. Do include timevar.h. Elide lots of unnecessary code if USE_CPPLIB. Delete code rendered unnecessary by new architecture. Move routines not shared with C++ to c-parse.in. Maintain a local idea of the line number. Handle C++ as well as C. [USE_CPPLIB]: Declare and register callbacks for #ident and for entering/leaving files. (init_c_lex, c_lex): Are now the entry points to this file. (check_newline): Break out directive handling to process_directive. (read_ucs, is_extended_char, utf8_extend_token): Moved here from C++ front end. (readescape, parse_float): Overhaul. (lex_number, lex_string, lex_charconst): Break out of c_lex (n'ee yylex). (get_fileinfo, update_header_times, dump_one_header, dump_time_statistics): New and/or moved here from C++. Support per-file data needed by C++ and per-header timing statistics (C++ only, at the moment). * c-lex.h: Update prototypes. Add multiple include guard. * c-tree.h (struct lang_identifier): Add rid_code field. (C_IS_RESERVED_WORD, C_RID_CODE): New. * c-parse.in: Include c-pragma.h. Remove unnecesary calls to reinit_parse_for_function and/or position_after_white_space. (save_filename, save_lineno): Look ahead before saving. (label -> identifier ':'): Save file and line before shifting ':'. (reservedwords): No need to call get_identifier. (init_parse, finish_parse, yyerror, yylex, yyprint, make_pointer_declarator): Are now here for C/ObjC. (rid_to_yy): Conversion table from RID constants to Yacc codes. * c-pragma.c: Rewrite parsing logic to fit with cpplib's #pragma registry. Provide dummy implementation of that interface if !USE_CPPLIB. * c-pragma.h: Update to match. * flags.h: Add multiple include guard. (flag_detailed_statistics): Moved here from C++. * toplev.c: Define flag_detailed_statistics. * gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * timevar.def (TV_CPP, TV_LEX): New. * timevar.h: Add multiple include guard. * objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * objc/objc-act.c: Don't mention yy_cur or parse_options. Initialize cpplib properly. Force lineno to 0 after first call to check_newline. Don't handle -lang-objc here. Move forget_protocol_qualifiers and remember_protocol_qualifiers here. cp: * Make-lang.in, Makefile.in: Remove all references to input.c, gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS. * gxx.gperf, hash.h, input.c: Delete. * lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is initialized properly. * class.c (fixup_pending_inline): Take a tree, not a struct pending_inline *. All callers changed. (init_class_processing): Set RID_PUBLIC, RID_PRIVATE, RID_PROTECTED entries in ridpointers[] array here. * decl.c (duplicate_decls): Do not refer to struct pending_inline. (record_builtin_type, init_decl_processing): Use RID_MAX not CP_RID_MAX. (grokdeclarator): Use C_IS_RESERVED_WORD. * decl2.c (lang_decode_option): Ignore -lang-c++ for sake of cpplib. (grok_x_components): Do not inspect pending_inlines chain. * cp-tree.h (struct lang_identifier): Add rid_code entry. (C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New. (flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare. (DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME, TIME_IDENTIFIER_FILEINFO): Kill. Update prototypes. * lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a single 32-bit word. * parse.y: Call do_pending_inlines unconditionally. reinit_parse_for_method is now snarf_method. fn.defpen is no longer necessary. Remove unnecessary <itype> annotation on SCOPE. Do not refer to end_of_file or struct pending_inline. * semantics.c (begin_inline_definitions): Call do_pending_inlines unconditionally. * lex.c: Remove all code now shared with C front end. Initialize cpplib properly if USE_CPPLIB. Put reserved words into the get_identifier table. Rewrite pragma handling to work with the registry. Move code to save tokens for later processing to spew.c. * spew.c: Rewrite everything in terms of token streams instead of text. Move routines here from lex.c / input.c as appropriate. GC-mark trees hanging off the pending inlines chain. testsuite: * g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on ERROR markers. * g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line. * gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail. * gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps. * gcc.dg/wtr-suffix-1.c: Correct error regexps. * gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c: Preprocess only. * gcc.dg/cpp/unc4.c: Adjust line number in dg-error line. * gcc.dg/noncompile/const-ll-1.c: Generalize error regexp. From-SVN: r36216
2000-09-07 02:37:14 +02:00
/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
keyword. C_RID_CODE (node) is then the RID_* value of the keyword. */
Integrated preprocessor. top level: * Makefile.in: Remove all references to c-parse.gperf, c-gperf.h, and c-parse.h. Remove -d from yacc command line generating c-parse.c. Update dependencies. * c-parse.gperf, c-gperf.h: Delete. * c-common.c: Don't define parse_options, cpp_token, yy_cur, yy_lim, or yy_get_token. Don't define get_directive_line if USE_CPPLIB. * c-common.h: Add multiple include guard. Define RID values for every keyword in C, C++, and Objective C. Put all the modifiers first. (struct c_fileinfo, get_fileinfo, dump_time_statistics): New. * c-decl.c (c_decode_option): Handle -lang-objc here. (print_lang_identifier): Handle C_IS_RESERVED_WORD case. (grokdeclarator): Adjust for new RID scheme. (extract_interface_info): New stub. * c-lang.c: Don't declare yy_cur or parse_options. (lang_init_options): Call cpp_init. Don't call cpp_options_init. (lang_init): Don't call check_newline if USE_CPPLIB. * c-lex.c: Don't include c-parse.h. Do include timevar.h. Elide lots of unnecessary code if USE_CPPLIB. Delete code rendered unnecessary by new architecture. Move routines not shared with C++ to c-parse.in. Maintain a local idea of the line number. Handle C++ as well as C. [USE_CPPLIB]: Declare and register callbacks for #ident and for entering/leaving files. (init_c_lex, c_lex): Are now the entry points to this file. (check_newline): Break out directive handling to process_directive. (read_ucs, is_extended_char, utf8_extend_token): Moved here from C++ front end. (readescape, parse_float): Overhaul. (lex_number, lex_string, lex_charconst): Break out of c_lex (n'ee yylex). (get_fileinfo, update_header_times, dump_one_header, dump_time_statistics): New and/or moved here from C++. Support per-file data needed by C++ and per-header timing statistics (C++ only, at the moment). * c-lex.h: Update prototypes. Add multiple include guard. * c-tree.h (struct lang_identifier): Add rid_code field. (C_IS_RESERVED_WORD, C_RID_CODE): New. * c-parse.in: Include c-pragma.h. Remove unnecesary calls to reinit_parse_for_function and/or position_after_white_space. (save_filename, save_lineno): Look ahead before saving. (label -> identifier ':'): Save file and line before shifting ':'. (reservedwords): No need to call get_identifier. (init_parse, finish_parse, yyerror, yylex, yyprint, make_pointer_declarator): Are now here for C/ObjC. (rid_to_yy): Conversion table from RID constants to Yacc codes. * c-pragma.c: Rewrite parsing logic to fit with cpplib's #pragma registry. Provide dummy implementation of that interface if !USE_CPPLIB. * c-pragma.h: Update to match. * flags.h: Add multiple include guard. (flag_detailed_statistics): Moved here from C++. * toplev.c: Define flag_detailed_statistics. * gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * timevar.def (TV_CPP, TV_LEX): New. * timevar.h: Add multiple include guard. * objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * objc/objc-act.c: Don't mention yy_cur or parse_options. Initialize cpplib properly. Force lineno to 0 after first call to check_newline. Don't handle -lang-objc here. Move forget_protocol_qualifiers and remember_protocol_qualifiers here. cp: * Make-lang.in, Makefile.in: Remove all references to input.c, gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS. * gxx.gperf, hash.h, input.c: Delete. * lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is initialized properly. * class.c (fixup_pending_inline): Take a tree, not a struct pending_inline *. All callers changed. (init_class_processing): Set RID_PUBLIC, RID_PRIVATE, RID_PROTECTED entries in ridpointers[] array here. * decl.c (duplicate_decls): Do not refer to struct pending_inline. (record_builtin_type, init_decl_processing): Use RID_MAX not CP_RID_MAX. (grokdeclarator): Use C_IS_RESERVED_WORD. * decl2.c (lang_decode_option): Ignore -lang-c++ for sake of cpplib. (grok_x_components): Do not inspect pending_inlines chain. * cp-tree.h (struct lang_identifier): Add rid_code entry. (C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New. (flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare. (DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME, TIME_IDENTIFIER_FILEINFO): Kill. Update prototypes. * lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a single 32-bit word. * parse.y: Call do_pending_inlines unconditionally. reinit_parse_for_method is now snarf_method. fn.defpen is no longer necessary. Remove unnecessary <itype> annotation on SCOPE. Do not refer to end_of_file or struct pending_inline. * semantics.c (begin_inline_definitions): Call do_pending_inlines unconditionally. * lex.c: Remove all code now shared with C front end. Initialize cpplib properly if USE_CPPLIB. Put reserved words into the get_identifier table. Rewrite pragma handling to work with the registry. Move code to save tokens for later processing to spew.c. * spew.c: Rewrite everything in terms of token streams instead of text. Move routines here from lex.c / input.c as appropriate. GC-mark trees hanging off the pending inlines chain. testsuite: * g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on ERROR markers. * g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line. * gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail. * gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps. * gcc.dg/wtr-suffix-1.c: Correct error regexps. * gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c: Preprocess only. * gcc.dg/cpp/unc4.c: Adjust line number in dg-error line. * gcc.dg/noncompile/const-ll-1.c: Generalize error regexp. From-SVN: r36216
2000-09-07 02:37:14 +02:00
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID)
Integrated preprocessor. top level: * Makefile.in: Remove all references to c-parse.gperf, c-gperf.h, and c-parse.h. Remove -d from yacc command line generating c-parse.c. Update dependencies. * c-parse.gperf, c-gperf.h: Delete. * c-common.c: Don't define parse_options, cpp_token, yy_cur, yy_lim, or yy_get_token. Don't define get_directive_line if USE_CPPLIB. * c-common.h: Add multiple include guard. Define RID values for every keyword in C, C++, and Objective C. Put all the modifiers first. (struct c_fileinfo, get_fileinfo, dump_time_statistics): New. * c-decl.c (c_decode_option): Handle -lang-objc here. (print_lang_identifier): Handle C_IS_RESERVED_WORD case. (grokdeclarator): Adjust for new RID scheme. (extract_interface_info): New stub. * c-lang.c: Don't declare yy_cur or parse_options. (lang_init_options): Call cpp_init. Don't call cpp_options_init. (lang_init): Don't call check_newline if USE_CPPLIB. * c-lex.c: Don't include c-parse.h. Do include timevar.h. Elide lots of unnecessary code if USE_CPPLIB. Delete code rendered unnecessary by new architecture. Move routines not shared with C++ to c-parse.in. Maintain a local idea of the line number. Handle C++ as well as C. [USE_CPPLIB]: Declare and register callbacks for #ident and for entering/leaving files. (init_c_lex, c_lex): Are now the entry points to this file. (check_newline): Break out directive handling to process_directive. (read_ucs, is_extended_char, utf8_extend_token): Moved here from C++ front end. (readescape, parse_float): Overhaul. (lex_number, lex_string, lex_charconst): Break out of c_lex (n'ee yylex). (get_fileinfo, update_header_times, dump_one_header, dump_time_statistics): New and/or moved here from C++. Support per-file data needed by C++ and per-header timing statistics (C++ only, at the moment). * c-lex.h: Update prototypes. Add multiple include guard. * c-tree.h (struct lang_identifier): Add rid_code field. (C_IS_RESERVED_WORD, C_RID_CODE): New. * c-parse.in: Include c-pragma.h. Remove unnecesary calls to reinit_parse_for_function and/or position_after_white_space. (save_filename, save_lineno): Look ahead before saving. (label -> identifier ':'): Save file and line before shifting ':'. (reservedwords): No need to call get_identifier. (init_parse, finish_parse, yyerror, yylex, yyprint, make_pointer_declarator): Are now here for C/ObjC. (rid_to_yy): Conversion table from RID constants to Yacc codes. * c-pragma.c: Rewrite parsing logic to fit with cpplib's #pragma registry. Provide dummy implementation of that interface if !USE_CPPLIB. * c-pragma.h: Update to match. * flags.h: Add multiple include guard. (flag_detailed_statistics): Moved here from C++. * toplev.c: Define flag_detailed_statistics. * gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * timevar.def (TV_CPP, TV_LEX): New. * timevar.h: Add multiple include guard. * objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * objc/objc-act.c: Don't mention yy_cur or parse_options. Initialize cpplib properly. Force lineno to 0 after first call to check_newline. Don't handle -lang-objc here. Move forget_protocol_qualifiers and remember_protocol_qualifiers here. cp: * Make-lang.in, Makefile.in: Remove all references to input.c, gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS. * gxx.gperf, hash.h, input.c: Delete. * lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is initialized properly. * class.c (fixup_pending_inline): Take a tree, not a struct pending_inline *. All callers changed. (init_class_processing): Set RID_PUBLIC, RID_PRIVATE, RID_PROTECTED entries in ridpointers[] array here. * decl.c (duplicate_decls): Do not refer to struct pending_inline. (record_builtin_type, init_decl_processing): Use RID_MAX not CP_RID_MAX. (grokdeclarator): Use C_IS_RESERVED_WORD. * decl2.c (lang_decode_option): Ignore -lang-c++ for sake of cpplib. (grok_x_components): Do not inspect pending_inlines chain. * cp-tree.h (struct lang_identifier): Add rid_code entry. (C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New. (flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare. (DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME, TIME_IDENTIFIER_FILEINFO): Kill. Update prototypes. * lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a single 32-bit word. * parse.y: Call do_pending_inlines unconditionally. reinit_parse_for_method is now snarf_method. fn.defpen is no longer necessary. Remove unnecessary <itype> annotation on SCOPE. Do not refer to end_of_file or struct pending_inline. * semantics.c (begin_inline_definitions): Call do_pending_inlines unconditionally. * lex.c: Remove all code now shared with C front end. Initialize cpplib properly if USE_CPPLIB. Put reserved words into the get_identifier table. Rewrite pragma handling to work with the registry. Move code to save tokens for later processing to spew.c. * spew.c: Rewrite everything in terms of token streams instead of text. Move routines here from lex.c / input.c as appropriate. GC-mark trees hanging off the pending inlines chain. testsuite: * g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on ERROR markers. * g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line. * gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail. * gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps. * gcc.dg/wtr-suffix-1.c: Correct error regexps. * gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c: Preprocess only. * gcc.dg/cpp/unc4.c: Adjust line number in dg-error line. * gcc.dg/noncompile/const-ll-1.c: Generalize error regexp. From-SVN: r36216
2000-09-07 02:37:14 +02:00
#define LANG_IDENTIFIER_CAST(NODE) \
((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
struct GTY(()) template_parm_index {
alias.c (struct alias_set_entry): New field has_zero_child. * alias.c (struct alias_set_entry): New field has_zero_child. (mem_in_disjoint_alias_sets_p): Return 0 if set in either ase. (get_alias_set): If language-dependent routine set TYPE_ALIAS_SET, do nothing. Call record_component_aliases for aggregate types. (record_alias_subset): Set has_zero_child. (record_component_aliases, case ARRAY_TYPE): Do nothing if TYPE_NONALIASES_COMPONENT. (record_component_aliases, case RECORD_TYPE): Test DECL_NONADDRESSABLE_P. * c-decl.c (grokdeclarator): Set DECL_NONADDRESSABLE_P instead of TREE_ADDRESSABLE. * calls.c (initialize_argument_information): Only test TYPE_TRANSPARENT_UNION for UNION_TYPE. * function.c (assign_parms): Likewise. * integrate.c (function_cannot_inline_p): Likewise. * stor-layout.c (finish_record_layout): Don't call record_component_aliases. * tree.h (struct tree_int_cst): Use struct tree_common. (struct tree_real_cst, struct tree_string): Likewise. (struct tree_complex, struct tree_identifier): Likewise. (struct tree_list, struct tree_vec, struct tree_exp): Likewise. (struct tree_block, struct tree_type, struct tree_decl): Likewise. (TYPE_TRANSPARENT_UNION): Use UNION_TYPE_CHECK. (TYPE_NONALIASES_COMPONENT): New macro. (TYPE_AMBIENT_BOUNDEDNESS): Use FUNCTION_TYPE_CHECK. (DECL_NONADDRESSABLE_P): New macro. (struct tree_decl): Reorder bits for clarity of how many left; add non_adressable. * cp/cp-tree.h: Use struct tree_common instead of a char array. * cp/decl.c (grokdeclarator): Set DECL_NONADDRESSABLE_P instead of TREE_ADDRESSABLE. From-SVN: r34373
2000-06-03 03:57:46 +02:00
struct tree_common common;
int index;
int level;
int orig_level;
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 decl;
};
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) ptrmem_cst {
alias.c (struct alias_set_entry): New field has_zero_child. * alias.c (struct alias_set_entry): New field has_zero_child. (mem_in_disjoint_alias_sets_p): Return 0 if set in either ase. (get_alias_set): If language-dependent routine set TYPE_ALIAS_SET, do nothing. Call record_component_aliases for aggregate types. (record_alias_subset): Set has_zero_child. (record_component_aliases, case ARRAY_TYPE): Do nothing if TYPE_NONALIASES_COMPONENT. (record_component_aliases, case RECORD_TYPE): Test DECL_NONADDRESSABLE_P. * c-decl.c (grokdeclarator): Set DECL_NONADDRESSABLE_P instead of TREE_ADDRESSABLE. * calls.c (initialize_argument_information): Only test TYPE_TRANSPARENT_UNION for UNION_TYPE. * function.c (assign_parms): Likewise. * integrate.c (function_cannot_inline_p): Likewise. * stor-layout.c (finish_record_layout): Don't call record_component_aliases. * tree.h (struct tree_int_cst): Use struct tree_common. (struct tree_real_cst, struct tree_string): Likewise. (struct tree_complex, struct tree_identifier): Likewise. (struct tree_list, struct tree_vec, struct tree_exp): Likewise. (struct tree_block, struct tree_type, struct tree_decl): Likewise. (TYPE_TRANSPARENT_UNION): Use UNION_TYPE_CHECK. (TYPE_NONALIASES_COMPONENT): New macro. (TYPE_AMBIENT_BOUNDEDNESS): Use FUNCTION_TYPE_CHECK. (DECL_NONADDRESSABLE_P): New macro. (struct tree_decl): Reorder bits for clarity of how many left; add non_adressable. * cp/cp-tree.h: Use struct tree_common instead of a char array. * cp/decl.c (grokdeclarator): Set DECL_NONADDRESSABLE_P instead of TREE_ADDRESSABLE. From-SVN: r34373
2000-06-03 03:57:46 +02:00
struct tree_common common;
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
tree member;
};
typedef struct ptrmem_cst * ptrmem_cst_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
Partial implementation of namespaces. * decl.c (push_namespace): Handle redeclaration error. * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. (IDENTIFIER_NAMESPACE_BINDINGS): New macro. (NAMESPACE_BINDING): New macro. (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. * *.c: Use them. * pt.c (push_template_decl): Use innermost_args. * decl.c (get_unique_name): Tweak from earlier in the name. * cp-tree.def: Add CPLUS_BINDING node. * cp-tree.h (tree_binding): new struct (BINDING_SCOPE, BINDING_VALUE): new macros (current_namespace, global_namespace): declare extern (struct lang_decl_flags): new field in_namespace (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros (DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros (TREE_INDIRECT_USING): new macro * decl2.c (current_namespace, global_namespace): Declare. The value is a NAMESPACE_DECL now, not a TREE_LIST. (is_namespace_ancestor, namespace_ancestor):new static functions. (add_using_namespace, ambiguous_decl): likewise. (lookup_using_namespace): new support function for lookup_name. (qualified_lookup_using_namespace): new support function for do_scoped_id and lookup_namespace_name (get_namespace_id): mark as obsolete. (current_namespace_id): Likewise. (do_namespace_alias): Implement. (do_using_directive): Implement as call to add_using_namespace. * decl.c (binding_for_name): new function. (push_namespace, pop_namespace): implement. (push_decl): don't install a FUNCTION_DECL in the global branch. (lookup_namespace_name): implement using qualified lookup. (lookup_name_real): For global scoping, lookup in global_namespace. For namespace scoping, lookup in given namespace. For unscoped lookup, iterate over namespace, considering using directives. (init_decl_processing): initialize global_namespace. (grokvardecl): Build assembler name as static name for globals. (grokdeclarator): Remove old namespace mangling. (xref_tag): When installing a global binding for the tag, make sure we have an identifier. * method.c (build_overload_nested_name): mangle namespaces. (build_qualified_name): Likewise. (build_decl_overload_real): Likewise. * lex.c (build_lang_decl): set namespace for new declaration to current_namespace. (do_scoped_id): find global names in global or current namespace, or using qualified namespace lookup, depending on context. * init.c (build_member_call): When scope is namespace, use build_x_function_call instead. (build_offset_ref): When scope is namespace, collapse processing to lookup_namespace_name instead. * error.c (dump_decl): Support NAMESPACE_DECL. * decl.c (pushdecl): Bind globals to current namespace. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (xref_tag): Likewise. (start_function): Likewise. * lex.c (do_identifier): Likewise. (identifier_typedecl_value): Likewise. (real_yylex): Likewise. * method.c (do_inline_function_hair): Likewise. * parse.y (unscoped): Likewise. * pt.c (check_explicit_specialization): Likewise. (lookup_template_class): Likewise. * rtti.c (call_void_fn): Likewise. * sig.c (build_sigtable): Likewise. * ptree.c (lang_print_xnode): New function. From-SVN: r18227
1998-02-25 01:49:51 +01:00
#define IDENTIFIER_GLOBAL_VALUE(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
namespace_binding ((NODE), global_namespace)
#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
set_namespace_binding ((NODE), global_namespace, (VAL))
Partial implementation of namespaces. * decl.c (push_namespace): Handle redeclaration error. * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. (IDENTIFIER_NAMESPACE_BINDINGS): New macro. (NAMESPACE_BINDING): New macro. (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. * *.c: Use them. * pt.c (push_template_decl): Use innermost_args. * decl.c (get_unique_name): Tweak from earlier in the name. * cp-tree.def: Add CPLUS_BINDING node. * cp-tree.h (tree_binding): new struct (BINDING_SCOPE, BINDING_VALUE): new macros (current_namespace, global_namespace): declare extern (struct lang_decl_flags): new field in_namespace (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros (DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros (TREE_INDIRECT_USING): new macro * decl2.c (current_namespace, global_namespace): Declare. The value is a NAMESPACE_DECL now, not a TREE_LIST. (is_namespace_ancestor, namespace_ancestor):new static functions. (add_using_namespace, ambiguous_decl): likewise. (lookup_using_namespace): new support function for lookup_name. (qualified_lookup_using_namespace): new support function for do_scoped_id and lookup_namespace_name (get_namespace_id): mark as obsolete. (current_namespace_id): Likewise. (do_namespace_alias): Implement. (do_using_directive): Implement as call to add_using_namespace. * decl.c (binding_for_name): new function. (push_namespace, pop_namespace): implement. (push_decl): don't install a FUNCTION_DECL in the global branch. (lookup_namespace_name): implement using qualified lookup. (lookup_name_real): For global scoping, lookup in global_namespace. For namespace scoping, lookup in given namespace. For unscoped lookup, iterate over namespace, considering using directives. (init_decl_processing): initialize global_namespace. (grokvardecl): Build assembler name as static name for globals. (grokdeclarator): Remove old namespace mangling. (xref_tag): When installing a global binding for the tag, make sure we have an identifier. * method.c (build_overload_nested_name): mangle namespaces. (build_qualified_name): Likewise. (build_decl_overload_real): Likewise. * lex.c (build_lang_decl): set namespace for new declaration to current_namespace. (do_scoped_id): find global names in global or current namespace, or using qualified namespace lookup, depending on context. * init.c (build_member_call): When scope is namespace, use build_x_function_call instead. (build_offset_ref): When scope is namespace, collapse processing to lookup_namespace_name instead. * error.c (dump_decl): Support NAMESPACE_DECL. * decl.c (pushdecl): Bind globals to current namespace. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (xref_tag): Likewise. (start_function): Likewise. * lex.c (do_identifier): Likewise. (identifier_typedecl_value): Likewise. (real_yylex): Likewise. * method.c (do_inline_function_hair): Likewise. * parse.y (unscoped): Likewise. * pt.c (check_explicit_specialization): Likewise. (lookup_template_class): Likewise. * rtti.c (call_void_fn): Likewise. * sig.c (build_sigtable): Likewise. * ptree.c (lang_print_xnode): New function. From-SVN: r18227
1998-02-25 01:49:51 +01:00
#define IDENTIFIER_NAMESPACE_VALUE(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
namespace_binding ((NODE), current_namespace)
#define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
set_namespace_binding ((NODE), current_namespace, (VAL))
Partial implementation of namespaces. * decl.c (push_namespace): Handle redeclaration error. * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. (IDENTIFIER_NAMESPACE_BINDINGS): New macro. (NAMESPACE_BINDING): New macro. (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. * *.c: Use them. * pt.c (push_template_decl): Use innermost_args. * decl.c (get_unique_name): Tweak from earlier in the name. * cp-tree.def: Add CPLUS_BINDING node. * cp-tree.h (tree_binding): new struct (BINDING_SCOPE, BINDING_VALUE): new macros (current_namespace, global_namespace): declare extern (struct lang_decl_flags): new field in_namespace (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros (DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros (TREE_INDIRECT_USING): new macro * decl2.c (current_namespace, global_namespace): Declare. The value is a NAMESPACE_DECL now, not a TREE_LIST. (is_namespace_ancestor, namespace_ancestor):new static functions. (add_using_namespace, ambiguous_decl): likewise. (lookup_using_namespace): new support function for lookup_name. (qualified_lookup_using_namespace): new support function for do_scoped_id and lookup_namespace_name (get_namespace_id): mark as obsolete. (current_namespace_id): Likewise. (do_namespace_alias): Implement. (do_using_directive): Implement as call to add_using_namespace. * decl.c (binding_for_name): new function. (push_namespace, pop_namespace): implement. (push_decl): don't install a FUNCTION_DECL in the global branch. (lookup_namespace_name): implement using qualified lookup. (lookup_name_real): For global scoping, lookup in global_namespace. For namespace scoping, lookup in given namespace. For unscoped lookup, iterate over namespace, considering using directives. (init_decl_processing): initialize global_namespace. (grokvardecl): Build assembler name as static name for globals. (grokdeclarator): Remove old namespace mangling. (xref_tag): When installing a global binding for the tag, make sure we have an identifier. * method.c (build_overload_nested_name): mangle namespaces. (build_qualified_name): Likewise. (build_decl_overload_real): Likewise. * lex.c (build_lang_decl): set namespace for new declaration to current_namespace. (do_scoped_id): find global names in global or current namespace, or using qualified namespace lookup, depending on context. * init.c (build_member_call): When scope is namespace, use build_x_function_call instead. (build_offset_ref): When scope is namespace, collapse processing to lookup_namespace_name instead. * error.c (dump_decl): Support NAMESPACE_DECL. * decl.c (pushdecl): Bind globals to current namespace. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (xref_tag): Likewise. (start_function): Likewise. * lex.c (do_identifier): Likewise. (identifier_typedecl_value): Likewise. (real_yylex): Likewise. * method.c (do_inline_function_hair): Likewise. * parse.y (unscoped): Likewise. * pt.c (check_explicit_specialization): Likewise. (lookup_template_class): Likewise. * rtti.c (call_void_fn): Likewise. * sig.c (build_sigtable): Likewise. * ptree.c (lang_print_xnode): New function. From-SVN: r18227
1998-02-25 01:49:51 +01:00
#define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
c-common.h (IF_COND): Moved here from cp/cp-tree.h. * c-common.h (IF_COND): Moved here from cp/cp-tree.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * c-common.def: Added SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * gencheck.c (tree_codes[]): Added '#include "c-common.def"'. * cp/cp-tree.h (IF_COND): Move to c-common.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * cp/cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def. * cp/Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def. (cc1plus$(exeext)): Added $(srcdir)/c-common.def. * cp/lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'. (cplus_tree_code_length[]): Added '#include "c-common.def"'. (cplus_tree_code_name[]): Added '#include "c-common.def"'. From-SVN: r34552
2000-06-14 19:26:18 +02:00
#define BIND_EXPR_TRY_BLOCK(NODE) \
TREE_LANG_FLAG_0 (BIND_EXPR_CHECK (NODE))
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
/* Used to mark the block around the member initializers and cleanups. */
#define BIND_EXPR_BODY_BLOCK(NODE) \
TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE))
#define FUNCTION_NEEDS_BODY_BLOCK(NODE) \
(DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE) \
|| LAMBDA_FUNCTION_P (NODE))
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
#define STATEMENT_LIST_NO_SCOPE(NODE) \
TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE))
#define STATEMENT_LIST_TRY_BLOCK(NODE) \
TREE_LANG_FLAG_2 (STATEMENT_LIST_CHECK (NODE))
/* Mark the outer curly brace BLOCK. */
#define BLOCK_OUTER_CURLY_BRACE_P(NODE) TREE_LANG_FLAG_0 (BLOCK_CHECK (NODE))
/* Nonzero if this statement should be considered a full-expression,
i.e., if temporaries created during this statement should have
their destructors run at the end of this statement. */
#define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
/* Marks the result of a statement expression. */
#define EXPR_STMT_STMT_EXPR_RESULT(NODE) \
TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE))
/* Nonzero if this statement-expression does not have an associated scope. */
#define STMT_EXPR_NO_SCOPE(NODE) \
TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE))
#define COND_EXPR_IS_VEC_DELETE(NODE) \
TREE_LANG_FLAG_0 (COND_EXPR_CHECK (NODE))
c-common.h (IF_COND): Moved here from cp/cp-tree.h. * c-common.h (IF_COND): Moved here from cp/cp-tree.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * c-common.def: Added SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * gencheck.c (tree_codes[]): Added '#include "c-common.def"'. * cp/cp-tree.h (IF_COND): Move to c-common.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * cp/cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def. * cp/Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def. (cc1plus$(exeext)): Added $(srcdir)/c-common.def. * cp/lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'. (cplus_tree_code_length[]): Added '#include "c-common.def"'. (cplus_tree_code_name[]): Added '#include "c-common.def"'. From-SVN: r34552
2000-06-14 19:26:18 +02:00
/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
sense of `same'. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define same_type_p(TYPE1, TYPE2) \
comptypes ((TYPE1), (TYPE2), COMPARE_STRICT)
c-common.h (IF_COND): Moved here from cp/cp-tree.h. * c-common.h (IF_COND): Moved here from cp/cp-tree.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * c-common.def: Added SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * gencheck.c (tree_codes[]): Added '#include "c-common.def"'. * cp/cp-tree.h (IF_COND): Move to c-common.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * cp/cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def. * cp/Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def. (cc1plus$(exeext)): Added $(srcdir)/c-common.def. * cp/lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'. (cplus_tree_code_length[]): Added '#include "c-common.def"'. (cplus_tree_code_name[]): Added '#include "c-common.def"'. From-SVN: r34552
2000-06-14 19:26:18 +02:00
/* Returns nonzero iff NODE is a declaration for the global function
c-common.h (IF_COND): Moved here from cp/cp-tree.h. * c-common.h (IF_COND): Moved here from cp/cp-tree.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * c-common.def: Added SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * gencheck.c (tree_codes[]): Added '#include "c-common.def"'. * cp/cp-tree.h (IF_COND): Move to c-common.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * cp/cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def. * cp/Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def. (cc1plus$(exeext)): Added $(srcdir)/c-common.def. * cp/lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'. (cplus_tree_code_length[]): Added '#include "c-common.def"'. (cplus_tree_code_name[]): Added '#include "c-common.def"'. From-SVN: r34552
2000-06-14 19:26:18 +02:00
`main'. */
#define DECL_MAIN_P(NODE) \
(DECL_EXTERN_C_FUNCTION_P (NODE) \
c-common.h (IF_COND): Moved here from cp/cp-tree.h. * c-common.h (IF_COND): Moved here from cp/cp-tree.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * c-common.def: Added SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * gencheck.c (tree_codes[]): Added '#include "c-common.def"'. * cp/cp-tree.h (IF_COND): Move to c-common.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * cp/cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def. * cp/Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def. (cc1plus$(exeext)): Added $(srcdir)/c-common.def. * cp/lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'. (cplus_tree_code_length[]): Added '#include "c-common.def"'. (cplus_tree_code_name[]): Added '#include "c-common.def"'. From-SVN: r34552
2000-06-14 19:26:18 +02:00
&& DECL_NAME (NODE) != NULL_TREE \
&& MAIN_NAME_P (DECL_NAME (NODE)) \
&& flag_hosted)
c-common.h (IF_COND): Moved here from cp/cp-tree.h. * c-common.h (IF_COND): Moved here from cp/cp-tree.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * c-common.def: Added SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * gencheck.c (tree_codes[]): Added '#include "c-common.def"'. * cp/cp-tree.h (IF_COND): Move to c-common.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * cp/cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def. * cp/Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def. (cc1plus$(exeext)): Added $(srcdir)/c-common.def. * cp/lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'. (cplus_tree_code_length[]): Added '#include "c-common.def"'. (cplus_tree_code_name[]): Added '#include "c-common.def"'. From-SVN: r34552
2000-06-14 19:26:18 +02:00
/* The overloaded FUNCTION_DECL. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define OVL_FUNCTION(NODE) \
(((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
#define OVL_CHAIN(NODE) TREE_CHAIN (NODE)
/* Polymorphic access to FUNCTION and CHAIN. */
#define OVL_CURRENT(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE))
#define OVL_NEXT(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE)
/* If set, this was imported in a using declaration.
This is not to confuse with being used somewhere, which
is not important for this node. */
#define OVL_USED(NODE) TREE_USED (OVERLOAD_CHECK (NODE))
/* If set, this OVERLOAD was created for argument-dependent lookup
and can be freed afterward. */
#define OVL_ARG_DEPENDENT(NODE) TREE_LANG_FLAG_0 (OVERLOAD_CHECK (NODE))
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) tree_overload {
alias.c (struct alias_set_entry): New field has_zero_child. * alias.c (struct alias_set_entry): New field has_zero_child. (mem_in_disjoint_alias_sets_p): Return 0 if set in either ase. (get_alias_set): If language-dependent routine set TYPE_ALIAS_SET, do nothing. Call record_component_aliases for aggregate types. (record_alias_subset): Set has_zero_child. (record_component_aliases, case ARRAY_TYPE): Do nothing if TYPE_NONALIASES_COMPONENT. (record_component_aliases, case RECORD_TYPE): Test DECL_NONADDRESSABLE_P. * c-decl.c (grokdeclarator): Set DECL_NONADDRESSABLE_P instead of TREE_ADDRESSABLE. * calls.c (initialize_argument_information): Only test TYPE_TRANSPARENT_UNION for UNION_TYPE. * function.c (assign_parms): Likewise. * integrate.c (function_cannot_inline_p): Likewise. * stor-layout.c (finish_record_layout): Don't call record_component_aliases. * tree.h (struct tree_int_cst): Use struct tree_common. (struct tree_real_cst, struct tree_string): Likewise. (struct tree_complex, struct tree_identifier): Likewise. (struct tree_list, struct tree_vec, struct tree_exp): Likewise. (struct tree_block, struct tree_type, struct tree_decl): Likewise. (TYPE_TRANSPARENT_UNION): Use UNION_TYPE_CHECK. (TYPE_NONALIASES_COMPONENT): New macro. (TYPE_AMBIENT_BOUNDEDNESS): Use FUNCTION_TYPE_CHECK. (DECL_NONADDRESSABLE_P): New macro. (struct tree_decl): Reorder bits for clarity of how many left; add non_adressable. * cp/cp-tree.h: Use struct tree_common instead of a char array. * cp/decl.c (grokdeclarator): Set DECL_NONADDRESSABLE_P instead of TREE_ADDRESSABLE. From-SVN: r34373
2000-06-03 03:57:46 +02:00
struct tree_common common;
tree function;
};
tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL... * tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL; call langhook for unknown declaration. (find_decls_types_r): Do not walk DECL_ARGUMENT_FLD. * tree.h (DECL_ARGUMENTS): Update. * print-tree.c (print_node): Update. * tree-core.h (tree_decl_non_common): Remove arguments. (tree_function_decl): Add arguments. * class.c (build_clone): Do not clear assembler names of templates. * decl.c (cp_tree_node_structure): Add TEMPLATE_DECL. * cp-objcp-common.c (cp_tree_size): Add TEMPLATE_DECL as a special case return sizeof (struct tree_decl_non_common) for other decls. (cp_common_init_ts): Do not initialize NAMESPACE_DECL; initialize TEMPLATE_DECL as MARK_TS_DECL_COMMON. * cp/cp-tree.h (tree_template_decl): New structure. (cp_tree_node_structure_enum): Add TS_CP_TEMPLATE_DECL. (union cp_lang_tree_node): Add template_decl. (DECL_TEMPLATE_PARMS, DECL_TEMPLATE_RESULT): Update. * lto/lto.c (mentions_vars_p_decl_non_common): Skip DECL_ARGUMENT_FLD. mentions_vars_p_function): Do DECL_ARGUMENTS. (lto_fixup_prevailing_decls): Update. * objc-act.c (objc_common_tree_size): New function. * objc-act.h (KEYWORD_KEY_NAME, KEYWORD_ARG_NAME): Add type checking. (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): New macro. (METHOD_SEL_NAME, METHOD_SEL_ARGS, METHOD_ADD_ARGS, METHOD_ADD_ARGS_ELLIPSIS_P, METHOD_DEFINITION, METHOD_ENCODING, METHOD_TYPE_ATTRIBUTES, METHOD_PROPERTY_CONTEXT): Add type checking. (METHOD_SEL_ARGS): Use decl_common.size instead of decl_non_common.result. (PROPERTY_NAME, PROPERTY_GETTER_NAME, PROPERTY_SETTER_NAME, PROPERTY_READONLY, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS, PROPERTY_IVAR_NAME, PROPERTY_DYNAMIC, PROPERTY_HAS_NO_GETTER, PROPERTY_HAS_NO_SETTER, PROPERTY_OPTIONAL): Add type checking. (objc_common_tree_size): Declare. * objc/objc-lang.c (LANG_HOOKS_TREE_SIZE): New macro. From-SVN: r212549
2014-07-15 12:17:32 +02:00
struct GTY(()) tree_template_decl {
struct tree_decl_common common;
tree arguments;
tree result;
};
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
/* Returns true iff NODE is a BASELINK. */
#define BASELINK_P(NODE) \
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_CODE (NODE) == BASELINK)
/* The BINFO indicating the base in which lookup found the
BASELINK_FUNCTIONS. */
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
#define BASELINK_BINFO(NODE) \
(((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo)
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
/* The functions referred to by the BASELINK; either a FUNCTION_DECL,
a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR. */
#define BASELINK_FUNCTIONS(NODE) \
(((struct tree_baselink*) BASELINK_CHECK (NODE))->functions)
/* The BINFO in which the search for the functions indicated by this baselink
began. This base is used to determine the accessibility of functions
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
selected by overload resolution. */
#define BASELINK_ACCESS_BINFO(NODE) \
(((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo)
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
/* For a type-conversion operator, the BASELINK_OPTYPE indicates the type
to which the conversion should occur. This value is important if
the BASELINK_FUNCTIONS include a template conversion operator --
the BASELINK_OPTYPE can be used to determine what type the user
requested. */
#define BASELINK_OPTYPE(NODE) \
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_CHAIN (BASELINK_CHECK (NODE)))
/* Nonzero if this baselink was from a qualified lookup. */
#define BASELINK_QUALIFIED_P(NODE) \
TREE_LANG_FLAG_0 (BASELINK_CHECK (NODE))
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) tree_baselink {
struct tree_common common;
tree binfo;
tree functions;
tree access_binfo;
};
/* The different kinds of ids that we encounter. */
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum cp_id_kind
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
{
/* Not an id at all. */
CP_ID_KIND_NONE,
/* An unqualified-id that is not a template-id. */
CP_ID_KIND_UNQUALIFIED,
/* An unqualified-id that is a dependent name. */
CP_ID_KIND_UNQUALIFIED_DEPENDENT,
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
/* An unqualified template-id. */
CP_ID_KIND_TEMPLATE_ID,
/* A qualified-id. */
CP_ID_KIND_QUALIFIED
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
/* The various kinds of C++0x warnings we encounter. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum cpp0x_warn_str
{
/* extended initializer lists */
CPP0X_INITIALIZER_LISTS,
/* explicit conversion operators */
CPP0X_EXPLICIT_CONVERSION,
/* variadic templates */
CPP0X_VARIADIC_TEMPLATES,
/* lambda expressions */
CPP0X_LAMBDA_EXPR,
/* C++0x auto */
CPP0X_AUTO,
/* scoped enums */
CPP0X_SCOPED_ENUMS,
/* defaulted and deleted functions */
CPP0X_DEFAULTED_DELETED,
/* inline namespaces */
CPP0X_INLINE_NAMESPACES,
/* override controls, override/final */
CPP0X_OVERRIDE_CONTROLS,
/* non-static data member initializers */
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
CPP0X_NSDMI,
/* user defined literals */
CPP0X_USER_DEFINED_LITERALS,
/* delegating constructors */
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
CPP0X_DELEGATING_CTORS,
/* inheriting constructors */
CPP0X_INHERITING_CTORS,
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
/* C++11 attributes */
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
CPP0X_ATTRIBUTES,
/* ref-qualified member functions */
CPP0X_REF_QUALIFIER
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
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
/* The various kinds of operation used by composite_pointer_type. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum composite_pointer_operation
{
/* comparison */
CPO_COMPARISON,
/* conversion */
CPO_CONVERSION,
/* conditional expression */
CPO_CONDITIONAL_EXPR
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
/* Possible cases of expression list used by build_x_compound_expr_from_list. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum expr_list_kind {
ELK_INIT, /* initializer */
ELK_MEM_INIT, /* member initializer */
ELK_FUNC_CAST /* functional cast */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
/* Possible cases of implicit bad rhs conversions. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum impl_conv_rhs {
ICR_DEFAULT_ARGUMENT, /* default argument */
ICR_CONVERTING, /* converting */
ICR_INIT, /* initialization */
ICR_ARGPASS, /* argument passing */
ICR_RETURN, /* return */
ICR_ASSIGN /* assignment */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
/* Possible cases of implicit or explicit bad conversions to void. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum impl_conv_void {
ICV_CAST, /* (explicit) conversion to void */
ICV_SECOND_OF_COND, /* second operand of conditional expression */
ICV_THIRD_OF_COND, /* third operand of conditional expression */
ICV_RIGHT_OF_COMMA, /* right operand of comma operator */
ICV_LEFT_OF_COMMA, /* left operand of comma operator */
ICV_STATEMENT, /* statement */
ICV_THIRD_IN_FOR /* for increment expression */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
/* Possible invalid uses of an abstract class that might not have a
specific associated declaration. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum GTY(()) abstract_class_use {
ACU_UNKNOWN, /* unknown or decl provided */
ACU_CAST, /* cast to abstract class */
ACU_NEW, /* new-expression of abstract class */
ACU_THROW, /* throw-expression of abstract class */
ACU_CATCH, /* catch-parameter of abstract class */
ACU_ARRAY, /* array of abstract class */
ACU_RETURN, /* return type of abstract class */
ACU_PARM /* parameter type of abstract class */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
1994-02-24 02:02:37 +01:00
/* Macros for access to language-specific slots in an identifier. */
Partial implementation of namespaces. * decl.c (push_namespace): Handle redeclaration error. * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. (IDENTIFIER_NAMESPACE_BINDINGS): New macro. (NAMESPACE_BINDING): New macro. (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. * *.c: Use them. * pt.c (push_template_decl): Use innermost_args. * decl.c (get_unique_name): Tweak from earlier in the name. * cp-tree.def: Add CPLUS_BINDING node. * cp-tree.h (tree_binding): new struct (BINDING_SCOPE, BINDING_VALUE): new macros (current_namespace, global_namespace): declare extern (struct lang_decl_flags): new field in_namespace (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros (DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros (TREE_INDIRECT_USING): new macro * decl2.c (current_namespace, global_namespace): Declare. The value is a NAMESPACE_DECL now, not a TREE_LIST. (is_namespace_ancestor, namespace_ancestor):new static functions. (add_using_namespace, ambiguous_decl): likewise. (lookup_using_namespace): new support function for lookup_name. (qualified_lookup_using_namespace): new support function for do_scoped_id and lookup_namespace_name (get_namespace_id): mark as obsolete. (current_namespace_id): Likewise. (do_namespace_alias): Implement. (do_using_directive): Implement as call to add_using_namespace. * decl.c (binding_for_name): new function. (push_namespace, pop_namespace): implement. (push_decl): don't install a FUNCTION_DECL in the global branch. (lookup_namespace_name): implement using qualified lookup. (lookup_name_real): For global scoping, lookup in global_namespace. For namespace scoping, lookup in given namespace. For unscoped lookup, iterate over namespace, considering using directives. (init_decl_processing): initialize global_namespace. (grokvardecl): Build assembler name as static name for globals. (grokdeclarator): Remove old namespace mangling. (xref_tag): When installing a global binding for the tag, make sure we have an identifier. * method.c (build_overload_nested_name): mangle namespaces. (build_qualified_name): Likewise. (build_decl_overload_real): Likewise. * lex.c (build_lang_decl): set namespace for new declaration to current_namespace. (do_scoped_id): find global names in global or current namespace, or using qualified namespace lookup, depending on context. * init.c (build_member_call): When scope is namespace, use build_x_function_call instead. (build_offset_ref): When scope is namespace, collapse processing to lookup_namespace_name instead. * error.c (dump_decl): Support NAMESPACE_DECL. * decl.c (pushdecl): Bind globals to current namespace. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (xref_tag): Likewise. (start_function): Likewise. * lex.c (do_identifier): Likewise. (identifier_typedecl_value): Likewise. (real_yylex): Likewise. * method.c (do_inline_function_hair): Likewise. * parse.y (unscoped): Likewise. * pt.c (check_explicit_specialization): Likewise. (lookup_template_class): Likewise. * rtti.c (call_void_fn): Likewise. * sig.c (build_sigtable): Likewise. * ptree.c (lang_print_xnode): New function. From-SVN: r18227
1998-02-25 01:49:51 +01:00
#define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
(LANG_IDENTIFIER_CAST (NODE)->namespace_bindings)
1994-02-24 02:02:37 +01:00
#define IDENTIFIER_TEMPLATE(NODE) \
(LANG_IDENTIFIER_CAST (NODE)->class_template_info)
1994-02-24 02:02:37 +01:00
Compile-time improvement: 2/n. * cp-tree.h (struct cxx_binding): New datatype; (struct lang_identifier): Use it. (LOCAL_BINDING_P): Adjust definition. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Likewise. (BINDING_HAS_LEVEL_P): Likewise. (BINDING_VALUE): Likewise. (BINDING_TYPE): Likewise. (IDENTIFIER_VALUE): Likewise. (struct tree_binding): Remove. (TS_CP_BINDING): Likewise. ((union lang_tree_node): Remove field "binding". (cxx_binding_clear): New macro. (binding_for_name): Adjust return type. (qualified_lookup_using_namespace): Adjust prototype. (lookup_using_namespace): Adjust prototype. (cxx_scope_find_binding_for_name): Declare. * cp-tree.def: Remove CPLUS_BINDING definition. * parse.y (parse_scoped_id): Don't type-abuse of 'id'. Allocate temporary cxx_binding on stack. Simplify. * decl.c (push_binding): Adjust local variable type. (add_binding): Likewise. (push_class_binding): Likewise. (pop_binding): Likewise. (poplevel): Likewise. (poplevel_class): Likewise. (free_bindings): Adjust type. (find_binding): Adjust return type, add a third parameter. Remove non-useful assertion now that we use static typing. (cxx_scope_find_binding_for_name): New function. (binding_for_name): Use it. Adjust local variable type. Simplify. (namespace_binding): Simplify. (set_namespace_binding): Likewise. (set_identifier_type_value_with_scope): Adjust local variable type. (lookup_tag): Don't type-abuse of local variable 'old'. (lookup_namespace_name): Likewise. Allocate binding on stack. (select_decl): Adjust prototype. (unqualified_namespace_lookup): Allocate binding on stack. Don't type-abuse of local variable 'val'. (lookup_name_real): Likewise. (maybe_inject_for_scope_var): Adjust local variable type. (cp_tree_node_structure): Remove CPLUS_BINDING case label. (namespace_binding): Adjust logic, simplify. (BINDING_LEVEL): Adjust definition. (push_class_level_binding): Adjust local variable type. (struct cxx_saved_binding): Adjust field 'binding' type. * decl2.c (ambiguous_decl): Adjust prototype. (lookup_using_namespace): Adjust local variable type. (qualified_lookup_using_namespace): Catch type error and correct ensueing logic error. (do_nonmember_using_decl): Adjust local variable type. Allocate temporary cxx_binding on stack. (do_toplevel_using_decl): Adjust local variable type. * ptree.c (cxx_print_cxx_binding): New function. (cxx_print_identifier): Use it. (cxx_print_xnode): Delete CPLUS_BINDING case label. From-SVN: r64405
2003-03-15 17:30:02 +01:00
/* The IDENTIFIER_BINDING is the innermost cxx_binding for the
identifier. It's PREVIOUS is the next outermost binding. Each
VALUE field is a DECL for the associated declaration. Thus,
cp-tree.def (CPLUS_BINDING): Update documentation. * cp-tree.def (CPLUS_BINDING): Update documentation. * cp-tree.h (LOCAL_BINDING_P): New macro. (lang_identifier): Rename local_value to bindings. (tree_binding): Make `scope' of type `void*', not `tree'. (BINDING_SCOPE): Update documentation. (IDENTIFIER_LOCAL_VALUE): Remove. (IDENTIFIER_CLASS_VALUE): Document. (IDENTIFIER_BINDING): New macro. (IDENTIFIER_VALUE): Likewise. (TIME_IDENTIFIER_TIME): Likewise. (TIME_IDENTIFIER_FILEINFO): Likewise. (IMPLICIT_TYPENAME_P): Likewise. (set_identifier_local_value): Remove. (push_local_binding): New function. (push_class_binding): Likewise. * class.c (pushclass): Update comments; use push_class_binding. * decl.c (set_identifier_local_value_with_scope): Remove. (set_identifier_local_value): Likewise. (push_binding): New function. (pop_binding): Likewise. (binding_level): Update documentation. Remove shadowed. (BINDING_LEVEL): New macro. (free_binding_nodes): New variable. (poplevel): Adjust for new name-lookup scheme. Don't mess up BLOCK_VARs when doing for-scope extension. Remove effectively dead code. (pushlevel_class): Tweak formatting. (poplevel_class): Adjust for new name-lookup scheme. (print_binding_level): Likewise. (store_bindings): Likewise. (pushdecl): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_overloaded_decl): Update comments. Adjust for new name-lookup scheme. (lookup_name_real): Likewise. (lookup_name_current_level): Likewise. (cp_finish_decl): Likewise. (require_complete_types_for_parms): Likewise. Remove misleading #if 0'd code. (grok_parms): Likewise. Don't call require_complete_types_for_parms here. (grok_ctor_properties): Don't treat templates as copy constructors. (grop_op_properties): Or as assignment operators. (start_function): Document. Adjust for new name-lookup scheme. (finish_function): Likewise. * decl2.c (do_local_using_decl): Use push_local_binding. * lex.c (begin_definition_of_inclass_inline): New function, split out from ... (do_pending_inlines): Here, and ... (process_next_inline): Here. (get_time_identifier): Use TIME_IDENTIFIER_* macros. (init_filename_times): Likewise. (extract_interface_info): Likewise. (ste_typedecl_interface_info): Likewise. (check_newline): Likewise. (dump_time_statistics): Likewise. (handle_cp_pragma): Likewise. (do_identifier): Adjust for new name-lookup scheme. * parse.y (function_try_block): Return ctor_initializer_opt value. (fndef): Use it. (fn.defpen): Pass appropriate values to start_function. (pending_inline): Use functor_try_block value, and pass appropriate values to finish_function. * pt.c (is_member_template): Update documentation; remove handling of FUNCTION_DECLs. As per name, this function should deal only in TEMPLATE_DECLs. (decl_template_parm_p): Change name of olddecl parameter to decl. (check_template_shadow): Adjust for new name-lookup scheme. (lookup_template_class): Likewise. (tsubst_decl): Tweak so as not to confuse member templates with copy constructors and assignment operators. (unify): Handle UNION_TYPEs. * ptree.c (print_lang_identifier): Adjust for new name-lookup scheme. (lang_print_xnode): Adjust for new name-lookup scheme. * typeck.c (mark_addressable): Likewise. (c_expand_return): Likewise. From-SVN: r24296
1998-12-13 15:46:07 +01:00
name lookup consists simply of pulling off the node at the front
of the list (modulo oddities for looking up the names of types,
and such.) You can use SCOPE field to determine the scope
that bound the name. */
cp-tree.def (CPLUS_BINDING): Update documentation. * cp-tree.def (CPLUS_BINDING): Update documentation. * cp-tree.h (LOCAL_BINDING_P): New macro. (lang_identifier): Rename local_value to bindings. (tree_binding): Make `scope' of type `void*', not `tree'. (BINDING_SCOPE): Update documentation. (IDENTIFIER_LOCAL_VALUE): Remove. (IDENTIFIER_CLASS_VALUE): Document. (IDENTIFIER_BINDING): New macro. (IDENTIFIER_VALUE): Likewise. (TIME_IDENTIFIER_TIME): Likewise. (TIME_IDENTIFIER_FILEINFO): Likewise. (IMPLICIT_TYPENAME_P): Likewise. (set_identifier_local_value): Remove. (push_local_binding): New function. (push_class_binding): Likewise. * class.c (pushclass): Update comments; use push_class_binding. * decl.c (set_identifier_local_value_with_scope): Remove. (set_identifier_local_value): Likewise. (push_binding): New function. (pop_binding): Likewise. (binding_level): Update documentation. Remove shadowed. (BINDING_LEVEL): New macro. (free_binding_nodes): New variable. (poplevel): Adjust for new name-lookup scheme. Don't mess up BLOCK_VARs when doing for-scope extension. Remove effectively dead code. (pushlevel_class): Tweak formatting. (poplevel_class): Adjust for new name-lookup scheme. (print_binding_level): Likewise. (store_bindings): Likewise. (pushdecl): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_overloaded_decl): Update comments. Adjust for new name-lookup scheme. (lookup_name_real): Likewise. (lookup_name_current_level): Likewise. (cp_finish_decl): Likewise. (require_complete_types_for_parms): Likewise. Remove misleading #if 0'd code. (grok_parms): Likewise. Don't call require_complete_types_for_parms here. (grok_ctor_properties): Don't treat templates as copy constructors. (grop_op_properties): Or as assignment operators. (start_function): Document. Adjust for new name-lookup scheme. (finish_function): Likewise. * decl2.c (do_local_using_decl): Use push_local_binding. * lex.c (begin_definition_of_inclass_inline): New function, split out from ... (do_pending_inlines): Here, and ... (process_next_inline): Here. (get_time_identifier): Use TIME_IDENTIFIER_* macros. (init_filename_times): Likewise. (extract_interface_info): Likewise. (ste_typedecl_interface_info): Likewise. (check_newline): Likewise. (dump_time_statistics): Likewise. (handle_cp_pragma): Likewise. (do_identifier): Adjust for new name-lookup scheme. * parse.y (function_try_block): Return ctor_initializer_opt value. (fndef): Use it. (fn.defpen): Pass appropriate values to start_function. (pending_inline): Use functor_try_block value, and pass appropriate values to finish_function. * pt.c (is_member_template): Update documentation; remove handling of FUNCTION_DECLs. As per name, this function should deal only in TEMPLATE_DECLs. (decl_template_parm_p): Change name of olddecl parameter to decl. (check_template_shadow): Adjust for new name-lookup scheme. (lookup_template_class): Likewise. (tsubst_decl): Tweak so as not to confuse member templates with copy constructors and assignment operators. (unify): Handle UNION_TYPEs. * ptree.c (print_lang_identifier): Adjust for new name-lookup scheme. (lang_print_xnode): Adjust for new name-lookup scheme. * typeck.c (mark_addressable): Likewise. (c_expand_return): Likewise. From-SVN: r24296
1998-12-13 15:46:07 +01:00
#define IDENTIFIER_BINDING(NODE) \
(LANG_IDENTIFIER_CAST (NODE)->bindings)
cp-tree.def (CPLUS_BINDING): Update documentation. * cp-tree.def (CPLUS_BINDING): Update documentation. * cp-tree.h (LOCAL_BINDING_P): New macro. (lang_identifier): Rename local_value to bindings. (tree_binding): Make `scope' of type `void*', not `tree'. (BINDING_SCOPE): Update documentation. (IDENTIFIER_LOCAL_VALUE): Remove. (IDENTIFIER_CLASS_VALUE): Document. (IDENTIFIER_BINDING): New macro. (IDENTIFIER_VALUE): Likewise. (TIME_IDENTIFIER_TIME): Likewise. (TIME_IDENTIFIER_FILEINFO): Likewise. (IMPLICIT_TYPENAME_P): Likewise. (set_identifier_local_value): Remove. (push_local_binding): New function. (push_class_binding): Likewise. * class.c (pushclass): Update comments; use push_class_binding. * decl.c (set_identifier_local_value_with_scope): Remove. (set_identifier_local_value): Likewise. (push_binding): New function. (pop_binding): Likewise. (binding_level): Update documentation. Remove shadowed. (BINDING_LEVEL): New macro. (free_binding_nodes): New variable. (poplevel): Adjust for new name-lookup scheme. Don't mess up BLOCK_VARs when doing for-scope extension. Remove effectively dead code. (pushlevel_class): Tweak formatting. (poplevel_class): Adjust for new name-lookup scheme. (print_binding_level): Likewise. (store_bindings): Likewise. (pushdecl): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_overloaded_decl): Update comments. Adjust for new name-lookup scheme. (lookup_name_real): Likewise. (lookup_name_current_level): Likewise. (cp_finish_decl): Likewise. (require_complete_types_for_parms): Likewise. Remove misleading #if 0'd code. (grok_parms): Likewise. Don't call require_complete_types_for_parms here. (grok_ctor_properties): Don't treat templates as copy constructors. (grop_op_properties): Or as assignment operators. (start_function): Document. Adjust for new name-lookup scheme. (finish_function): Likewise. * decl2.c (do_local_using_decl): Use push_local_binding. * lex.c (begin_definition_of_inclass_inline): New function, split out from ... (do_pending_inlines): Here, and ... (process_next_inline): Here. (get_time_identifier): Use TIME_IDENTIFIER_* macros. (init_filename_times): Likewise. (extract_interface_info): Likewise. (ste_typedecl_interface_info): Likewise. (check_newline): Likewise. (dump_time_statistics): Likewise. (handle_cp_pragma): Likewise. (do_identifier): Adjust for new name-lookup scheme. * parse.y (function_try_block): Return ctor_initializer_opt value. (fndef): Use it. (fn.defpen): Pass appropriate values to start_function. (pending_inline): Use functor_try_block value, and pass appropriate values to finish_function. * pt.c (is_member_template): Update documentation; remove handling of FUNCTION_DECLs. As per name, this function should deal only in TEMPLATE_DECLs. (decl_template_parm_p): Change name of olddecl parameter to decl. (check_template_shadow): Adjust for new name-lookup scheme. (lookup_template_class): Likewise. (tsubst_decl): Tweak so as not to confuse member templates with copy constructors and assignment operators. (unify): Handle UNION_TYPEs. * ptree.c (print_lang_identifier): Adjust for new name-lookup scheme. (lang_print_xnode): Adjust for new name-lookup scheme. * typeck.c (mark_addressable): Likewise. (c_expand_return): Likewise. From-SVN: r24296
1998-12-13 15:46:07 +01:00
/* TREE_TYPE only indicates on local and class scope the current
type. For namespace scope, the presence of a type in any namespace
is indicated with global_type_node, and the real type behind must
be found through lookup. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE)
#define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE)
#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE))
#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
1994-02-24 02:02:37 +01:00
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define IDENTIFIER_LABEL_VALUE(NODE) \
(LANG_IDENTIFIER_CAST (NODE)->label_value)
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \
IDENTIFIER_LABEL_VALUE (NODE) = (VALUE)
1994-02-24 02:02:37 +01:00
/* Nonzero if this identifier is used as a virtual function name somewhere
(optimizes searches). */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE)
1994-02-24 02:02:37 +01:00
/* Nonzero if this identifier is the prefix for a mangled C++ operator
name. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE)
1994-02-24 02:02:37 +01:00
/* Nonzero if this identifier is the name of a type-conversion
operator. */
#define IDENTIFIER_TYPENAME_P(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
TREE_LANG_FLAG_4 (NODE)
1994-02-24 02:02:37 +01:00
/* Nonzero if this identifier is the name of a constructor or
destructor. */
#define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \
TREE_LANG_FLAG_3 (NODE)
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
/* True iff NAME is the DECL_ASSEMBLER_NAME for an entity with vague
linkage which the prelinker has assigned to this translation
unit. */
#define IDENTIFIER_REPO_CHOSEN(NAME) \
(TREE_LANG_FLAG_6 (NAME))
1994-02-24 02:02:37 +01:00
/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
#define C_TYPE_FIELDS_READONLY(TYPE) \
(LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
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
/* The tokens stored in the default argument. */
#define DEFARG_TOKENS(NODE) \
(((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens)
#define DEFARG_INSTANTIATIONS(NODE) \
(((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->instantiations)
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
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY (()) tree_default_arg {
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
struct tree_common common;
struct cp_token_cache *tokens;
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> *instantiations;
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
};
#define DEFERRED_NOEXCEPT_PATTERN(NODE) \
(((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->pattern)
#define DEFERRED_NOEXCEPT_ARGS(NODE) \
(((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->args)
#define DEFERRED_NOEXCEPT_SPEC_P(NODE) \
((NODE) && (TREE_PURPOSE (NODE)) \
&& (TREE_CODE (TREE_PURPOSE (NODE)) == DEFERRED_NOEXCEPT))
#define UNEVALUATED_NOEXCEPT_SPEC_P(NODE) \
(DEFERRED_NOEXCEPT_SPEC_P (NODE) \
&& DEFERRED_NOEXCEPT_PATTERN (TREE_PURPOSE (NODE)) == NULL_TREE)
struct GTY (()) tree_deferred_noexcept {
struct tree_base base;
tree pattern;
tree args;
};
/* The condition associated with the static assertion. This must be
an integral constant expression. */
#define STATIC_ASSERT_CONDITION(NODE) \
(((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->condition)
/* The message associated with the static assertion. This must be a
string constant, which will be emitted as an error message when the
static assert condition is false. */
#define STATIC_ASSERT_MESSAGE(NODE) \
(((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->message)
/* Source location information for a static assertion. */
#define STATIC_ASSERT_SOURCE_LOCATION(NODE) \
(((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->location)
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY (()) tree_static_assert {
struct tree_common common;
tree condition;
tree message;
location_t location;
};
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY (()) tree_argument_pack_select {
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
struct tree_common common;
tree argument_pack;
int index;
};
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
/* The different kinds of traits that we encounter. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum cp_trait_kind
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
{
[multiple changes] 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * gcc/c-family/c-common.c (c_common_reswords): Add __bases, __direct_bases. * gcc/c-family/c-common.h: Add RID_BASES and RID_DIRECT_BASES. 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * cp-tree.def: Add BASES as a new tree code. * cp-tree.h (enum cp_trait_kind): Add CPTK_BASES, CPTK_DIRECT_BASES. (BASES_TYPE, BASES_DIRECT): Define. (calculate_bases, finish_bases, calculate_direct_bases): Declare. * parser.c (cp_parser_trait_expr, cp_parser_template_argument_list, (cp_parser_simple_type_specifier, cp_parser_save_nsdmi): Use them. * pt.c (find_parameter_packs_r, tsubst_pack_expansion): Likewise. * semantics.c (calculate_bases, finish_bases, calculate_direct_bases, dfs_calculate_bases_pre, dfs_calculate_bases_post, calculate_bases_helper): Define. 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * g++.dg/ext/bases.C: New test. 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * include/tr2/type_traits (bases, direct_bases, typelist): New. 2011-10-17 Benjamin Kosnik <bkoz@redhat.com> * libstdc++-v3/include/Makefile.am: Add tr2 directory and includes. * libstdc++-v3/include/Makefile.in: Regenerate. * scripts/create_testsuite_files: Search tr2 directory. * testsuite/libstdc++-dg/conformance.exp: Same. * testsuite/tr2/bases/requirements/explicit_instantiation.cc: New. * testsuite/tr2/bases/requirements/typedefs.cc: New. * testsuite/tr2/bases/value.cc: New. * testsuite/tr2/direct_bases/requirements/ explicit_instantiation.cc: New. * testsuite/tr2/direct_bases/requirements/typedefs.cc: New. * testsuite/tr2/direct_bases/value.cc: New. From-SVN: r180121
2011-10-18 04:58:06 +02:00
CPTK_BASES,
CPTK_DIRECT_BASES,
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
CPTK_HAS_NOTHROW_ASSIGN,
CPTK_HAS_NOTHROW_CONSTRUCTOR,
CPTK_HAS_NOTHROW_COPY,
CPTK_HAS_TRIVIAL_ASSIGN,
CPTK_HAS_TRIVIAL_CONSTRUCTOR,
CPTK_HAS_TRIVIAL_COPY,
CPTK_HAS_TRIVIAL_DESTRUCTOR,
CPTK_HAS_UNIQUE_OBJ_REPRESENTATIONS,
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
CPTK_HAS_VIRTUAL_DESTRUCTOR,
CPTK_IS_ABSTRACT,
CPTK_IS_AGGREGATE,
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
CPTK_IS_BASE_OF,
CPTK_IS_CLASS,
CPTK_IS_EMPTY,
CPTK_IS_ENUM,
CPTK_IS_FINAL,
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
CPTK_IS_LITERAL_TYPE,
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
CPTK_IS_POD,
CPTK_IS_POLYMORPHIC,
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
CPTK_IS_SAME_AS,
CPTK_IS_STD_LAYOUT,
CPTK_IS_TRIVIAL,
CPTK_IS_TRIVIALLY_ASSIGNABLE,
CPTK_IS_TRIVIALLY_CONSTRUCTIBLE,
CPTK_IS_TRIVIALLY_COPYABLE,
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
CPTK_IS_UNION,
CPTK_UNDERLYING_TYPE
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
/* The types that we are processing. */
#define TRAIT_EXPR_TYPE1(NODE) \
(((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->type1)
#define TRAIT_EXPR_TYPE2(NODE) \
(((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->type2)
/* The specific trait that we are processing. */
#define TRAIT_EXPR_KIND(NODE) \
(((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->kind)
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY (()) tree_trait_expr {
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
struct tree_common common;
tree type1;
tree type2;
enum cp_trait_kind kind;
};
/* Based off of TYPE_UNNAMED_P. */
#define LAMBDA_TYPE_P(NODE) \
(CLASS_TYPE_P (NODE) && CLASSTYPE_LAMBDA_EXPR (NODE))
/* Test if FUNCTION_DECL is a lambda function. */
#define LAMBDA_FUNCTION_P(FNDECL) \
(DECL_OVERLOADED_OPERATOR_P (FNDECL) == CALL_EXPR \
&& LAMBDA_TYPE_P (CP_DECL_CONTEXT (FNDECL)))
enum cp_lambda_default_capture_mode_type {
CPLD_NONE,
CPLD_COPY,
CPLD_REFERENCE
};
/* The method of default capture, if any. */
#define LAMBDA_EXPR_DEFAULT_CAPTURE_MODE(NODE) \
(((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->default_capture_mode)
/* The capture-list, including `this'. Each capture is stored as a FIELD_DECL
* so that the name, type, and field are all together, whether or not it has
* been added to the lambda's class type.
TREE_LIST:
TREE_PURPOSE: The FIELD_DECL for this capture.
TREE_VALUE: The initializer. This is part of a GNU extension. */
#define LAMBDA_EXPR_CAPTURE_LIST(NODE) \
(((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->capture_list)
/* During parsing of the lambda-introducer, the node in the capture-list
that holds the 'this' capture. During parsing of the body, the
capture proxy for that node. */
#define LAMBDA_EXPR_THIS_CAPTURE(NODE) \
(((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->this_capture)
/* Predicate tracking whether `this' is in the effective capture set. */
#define LAMBDA_EXPR_CAPTURES_THIS_P(NODE) \
LAMBDA_EXPR_THIS_CAPTURE(NODE)
/* Predicate tracking whether the lambda was declared 'mutable'. */
#define LAMBDA_EXPR_MUTABLE_P(NODE) \
TREE_LANG_FLAG_1 (LAMBDA_EXPR_CHECK (NODE))
/* The return type in the expression.
* NULL_TREE indicates that none was specified. */
#define LAMBDA_EXPR_RETURN_TYPE(NODE) \
(((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->return_type)
/* The source location of the lambda. */
#define LAMBDA_EXPR_LOCATION(NODE) \
(((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->locus)
/* The mangling scope for the lambda: FUNCTION_DECL, PARM_DECL, VAR_DECL,
FIELD_DECL or NULL_TREE. If this is NULL_TREE, we have no linkage. */
#define LAMBDA_EXPR_EXTRA_SCOPE(NODE) \
(((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->extra_scope)
/* If EXTRA_SCOPE, this is the number of the lambda within that scope. */
#define LAMBDA_EXPR_DISCRIMINATOR(NODE) \
(((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->discriminator)
/* During parsing of the lambda, a vector of capture proxies which need
to be pushed once we're done processing a nested lambda. */
#define LAMBDA_EXPR_PENDING_PROXIES(NODE) \
(((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->pending_proxies)
/* The closure type of the lambda. Note that the TREE_TYPE of a
LAMBDA_EXPR is always NULL_TREE, because we need to instantiate the
LAMBDA_EXPR in order to instantiate the type. */
#define LAMBDA_EXPR_CLOSURE(NODE) \
(((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->closure)
struct GTY (()) tree_lambda_expr
{
struct tree_typed typed;
tree capture_list;
tree this_capture;
tree return_type;
tree extra_scope;
tree closure;
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> *pending_proxies;
location_t locus;
enum cp_lambda_default_capture_mode_type default_capture_mode;
int discriminator;
};
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01:00
/* A (typedef,context,usage location) triplet.
It represents a typedef used through a
context at a given source location.
e.g.
struct foo {
typedef int myint;
};
struct bar {
foo::myint v; // #1<-- this location.
};
In bar, the triplet will be (myint, foo, #1).
*/
struct GTY(()) qualified_typedef_usage_s {
tree typedef_decl;
tree context;
location_t locus;
};
typedef struct qualified_typedef_usage_s qualified_typedef_usage_t;
/* Non-zero if this template specialization has access violations that
should be rechecked when the function is instantiated outside argument
deduction. */
#define TINFO_HAS_ACCESS_ERRORS(NODE) \
(TREE_LANG_FLAG_0 (TEMPLATE_INFO_CHECK (NODE)))
#define FNDECL_HAS_ACCESS_ERRORS(NODE) \
(TINFO_HAS_ACCESS_ERRORS (DECL_TEMPLATE_INFO (NODE)))
/* Non-zero if this variable template specialization was specified using a
template-id, so it's a partial or full specialization and not a definition
of the member template of a particular class specialization. */
#define TINFO_USED_TEMPLATE_ID(NODE) \
(TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE)))
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01:00
struct GTY(()) tree_template_info {
struct tree_common common;
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<qualified_typedef_usage_t, va_gc> *typedefs_needing_access_checking;
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01: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
// Constraint information for a C++ declaration. Constraint information is
// comprised of:
//
// - a constraint expression introduced by the template header
// - a constraint expression introduced by a function declarator
// - the associated constraints, which are the conjunction of those,
// and used for declaration matching
//
// The template and declarator requirements are kept to support pretty
// printing constrained declarations.
struct GTY(()) tree_constraint_info {
struct tree_base base;
tree template_reqs;
tree declarator_reqs;
tree associated_constr;
};
// Require that pointer P is non-null before returning.
template<typename T>
inline T*
check_nonnull (T* p)
{
gcc_assert (p);
return p;
}
// Returns true iff T is non-null and represents constraint info.
inline tree_constraint_info *
check_constraint_info (tree t)
{
if (t && TREE_CODE (t) == CONSTRAINT_INFO)
return (tree_constraint_info *)t;
return NULL;
}
// Access the expression describing the template constraints. This may be
// null if no constraints were introduced in the template parameter list,
// a requirements clause after the template parameter list, or constraints
// through a constrained-type-specifier.
#define CI_TEMPLATE_REQS(NODE) \
check_constraint_info (check_nonnull(NODE))->template_reqs
// Access the expression describing the trailing constraints. This is non-null
// for any implicit instantiation of a constrained declaration. For a
// templated declaration it is non-null only when a trailing requires-clause
// was specified.
#define CI_DECLARATOR_REQS(NODE) \
check_constraint_info (check_nonnull(NODE))->declarator_reqs
// The computed associated constraint expression for a declaration.
#define CI_ASSOCIATED_CONSTRAINTS(NODE) \
check_constraint_info (check_nonnull(NODE))->associated_constr
// Access the logical constraints on the template parameters introduced
// at a given template parameter list level indicated by NODE.
#define TEMPLATE_PARMS_CONSTRAINTS(NODE) \
TREE_TYPE (TREE_LIST_CHECK (NODE))
// Access the logical constraints on the template parameter declaration
// indicated by NODE.
#define TEMPLATE_PARM_CONSTRAINTS(NODE) \
TREE_TYPE (TREE_LIST_CHECK (NODE))
/* Non-zero if the noexcept is present in a compound requirement. */
#define COMPOUND_REQ_NOEXCEPT_P(NODE) \
TREE_LANG_FLAG_0 (TREE_CHECK (NODE, COMPOUND_REQ))
/* The constraints on an 'auto' placeholder type, used in an argument deduction
constraint. */
#define PLACEHOLDER_TYPE_CONSTRAINTS(NODE) \
DECL_SIZE_UNIT (TYPE_NAME (NODE))
/* The expression evaluated by the predicate constraint. */
#define PRED_CONSTR_EXPR(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, PRED_CONSTR), 0)
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
/* The concept of a concept check. */
#define CHECK_CONSTR_CONCEPT(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 0)
/* The template arguments of a concept check. */
#define CHECK_CONSTR_ARGS(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 1)
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
/* The expression validated by the predicate constraint. */
#define EXPR_CONSTR_EXPR(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, EXPR_CONSTR), 0)
/* The type validated by the predicate constraint. */
#define TYPE_CONSTR_TYPE(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, TYPE_CONSTR), 0)
/* In an implicit conversion constraint, the source expression. */
#define ICONV_CONSTR_EXPR(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, ICONV_CONSTR), 0)
/* In an implicit conversion constraint, the target type. */
#define ICONV_CONSTR_TYPE(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, ICONV_CONSTR), 1)
/* In an argument deduction constraint, the source expression. */
#define DEDUCT_CONSTR_EXPR(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 0)
/* In an argument deduction constraint, the target type pattern. */
#define DEDUCT_CONSTR_PATTERN(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 1)
/* In an argument deduction constraint, the list of placeholder nodes. */
#define DEDUCT_CONSTR_PLACEHOLDER(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 2)
/* The expression of an exception constraint. */
#define EXCEPT_CONSTR_EXPR(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, EXCEPT_CONSTR), 0)
/* In a parameterized constraint, the local parameters. */
#define PARM_CONSTR_PARMS(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, PARM_CONSTR), 0)
/* In a parameterized constraint, the operand. */
#define PARM_CONSTR_OPERAND(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, PARM_CONSTR), 1)
/* Whether a PARM_DECL represents a local parameter in a
requires-expression. */
#define CONSTRAINT_VAR_P(NODE) \
DECL_LANG_FLAG_2 (TREE_CHECK (NODE, PARM_DECL))
/* The concept constraining this constrained template-parameter. */
#define CONSTRAINED_PARM_CONCEPT(NODE) \
DECL_SIZE_UNIT (TYPE_DECL_CHECK (NODE))
/* Any extra template arguments specified for a constrained
template-parameter. */
#define CONSTRAINED_PARM_EXTRA_ARGS(NODE) \
DECL_SIZE (TYPE_DECL_CHECK (NODE))
/* The first template parameter of CONSTRAINED_PARM_CONCEPT to be used as a
prototype for the constrained parameter in finish_shorthand_constraint,
attached for convenience. */
#define CONSTRAINED_PARM_PROTOTYPE(NODE) \
DECL_INITIAL (TYPE_DECL_CHECK (NODE))
enum cp_tree_node_structure_enum {
TS_CP_GENERIC,
TS_CP_IDENTIFIER,
TS_CP_TPI,
TS_CP_PTRMEM,
TS_CP_BINDING,
TS_CP_OVERLOAD,
TS_CP_BASELINK,
tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL... * tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL; call langhook for unknown declaration. (find_decls_types_r): Do not walk DECL_ARGUMENT_FLD. * tree.h (DECL_ARGUMENTS): Update. * print-tree.c (print_node): Update. * tree-core.h (tree_decl_non_common): Remove arguments. (tree_function_decl): Add arguments. * class.c (build_clone): Do not clear assembler names of templates. * decl.c (cp_tree_node_structure): Add TEMPLATE_DECL. * cp-objcp-common.c (cp_tree_size): Add TEMPLATE_DECL as a special case return sizeof (struct tree_decl_non_common) for other decls. (cp_common_init_ts): Do not initialize NAMESPACE_DECL; initialize TEMPLATE_DECL as MARK_TS_DECL_COMMON. * cp/cp-tree.h (tree_template_decl): New structure. (cp_tree_node_structure_enum): Add TS_CP_TEMPLATE_DECL. (union cp_lang_tree_node): Add template_decl. (DECL_TEMPLATE_PARMS, DECL_TEMPLATE_RESULT): Update. * lto/lto.c (mentions_vars_p_decl_non_common): Skip DECL_ARGUMENT_FLD. mentions_vars_p_function): Do DECL_ARGUMENTS. (lto_fixup_prevailing_decls): Update. * objc-act.c (objc_common_tree_size): New function. * objc-act.h (KEYWORD_KEY_NAME, KEYWORD_ARG_NAME): Add type checking. (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): New macro. (METHOD_SEL_NAME, METHOD_SEL_ARGS, METHOD_ADD_ARGS, METHOD_ADD_ARGS_ELLIPSIS_P, METHOD_DEFINITION, METHOD_ENCODING, METHOD_TYPE_ATTRIBUTES, METHOD_PROPERTY_CONTEXT): Add type checking. (METHOD_SEL_ARGS): Use decl_common.size instead of decl_non_common.result. (PROPERTY_NAME, PROPERTY_GETTER_NAME, PROPERTY_SETTER_NAME, PROPERTY_READONLY, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS, PROPERTY_IVAR_NAME, PROPERTY_DYNAMIC, PROPERTY_HAS_NO_GETTER, PROPERTY_HAS_NO_SETTER, PROPERTY_OPTIONAL): Add type checking. (objc_common_tree_size): Declare. * objc/objc-lang.c (LANG_HOOKS_TREE_SIZE): New macro. From-SVN: r212549
2014-07-15 12:17:32 +02:00
TS_CP_TEMPLATE_DECL,
TS_CP_WRAPPER,
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
TS_CP_DEFAULT_ARG,
TS_CP_DEFERRED_NOEXCEPT,
TS_CP_STATIC_ASSERT,
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
TS_CP_ARGUMENT_PACK_SELECT,
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
TS_CP_TRAIT_EXPR,
TS_CP_LAMBDA_EXPR,
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01:00
TS_CP_TEMPLATE_INFO,
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
TS_CP_CONSTRAINT_INFO,
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
TS_CP_USERDEF_LITERAL,
LAST_TS_CP_ENUM
};
/* The resulting tree type. */
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
union GTY((desc ("cp_tree_node_structure (&%h)"),
chain_next ("(union lang_tree_node *) c_tree_chain_next (&%h.generic)"))) lang_tree_node {
union tree_node GTY ((tag ("TS_CP_GENERIC"),
desc ("tree_node_structure (&%h)"))) generic;
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
struct template_parm_index GTY ((tag ("TS_CP_TPI"))) tpi;
struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL... * tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL; call langhook for unknown declaration. (find_decls_types_r): Do not walk DECL_ARGUMENT_FLD. * tree.h (DECL_ARGUMENTS): Update. * print-tree.c (print_node): Update. * tree-core.h (tree_decl_non_common): Remove arguments. (tree_function_decl): Add arguments. * class.c (build_clone): Do not clear assembler names of templates. * decl.c (cp_tree_node_structure): Add TEMPLATE_DECL. * cp-objcp-common.c (cp_tree_size): Add TEMPLATE_DECL as a special case return sizeof (struct tree_decl_non_common) for other decls. (cp_common_init_ts): Do not initialize NAMESPACE_DECL; initialize TEMPLATE_DECL as MARK_TS_DECL_COMMON. * cp/cp-tree.h (tree_template_decl): New structure. (cp_tree_node_structure_enum): Add TS_CP_TEMPLATE_DECL. (union cp_lang_tree_node): Add template_decl. (DECL_TEMPLATE_PARMS, DECL_TEMPLATE_RESULT): Update. * lto/lto.c (mentions_vars_p_decl_non_common): Skip DECL_ARGUMENT_FLD. mentions_vars_p_function): Do DECL_ARGUMENTS. (lto_fixup_prevailing_decls): Update. * objc-act.c (objc_common_tree_size): New function. * objc-act.h (KEYWORD_KEY_NAME, KEYWORD_ARG_NAME): Add type checking. (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): New macro. (METHOD_SEL_NAME, METHOD_SEL_ARGS, METHOD_ADD_ARGS, METHOD_ADD_ARGS_ELLIPSIS_P, METHOD_DEFINITION, METHOD_ENCODING, METHOD_TYPE_ATTRIBUTES, METHOD_PROPERTY_CONTEXT): Add type checking. (METHOD_SEL_ARGS): Use decl_common.size instead of decl_non_common.result. (PROPERTY_NAME, PROPERTY_GETTER_NAME, PROPERTY_SETTER_NAME, PROPERTY_READONLY, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS, PROPERTY_IVAR_NAME, PROPERTY_DYNAMIC, PROPERTY_HAS_NO_GETTER, PROPERTY_HAS_NO_SETTER, PROPERTY_OPTIONAL): Add type checking. (objc_common_tree_size): Declare. * objc/objc-lang.c (LANG_HOOKS_TREE_SIZE): New macro. From-SVN: r212549
2014-07-15 12:17:32 +02:00
struct tree_template_decl GTY ((tag ("TS_CP_TEMPLATE_DECL"))) template_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
struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
struct tree_deferred_noexcept GTY ((tag ("TS_CP_DEFERRED_NOEXCEPT"))) deferred_noexcept;
struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT")))
static_assertion;
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
struct tree_argument_pack_select GTY ((tag ("TS_CP_ARGUMENT_PACK_SELECT")))
argument_pack_select;
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
struct tree_trait_expr GTY ((tag ("TS_CP_TRAIT_EXPR")))
trait_expression;
struct tree_lambda_expr GTY ((tag ("TS_CP_LAMBDA_EXPR")))
lambda_expression;
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01:00
struct tree_template_info GTY ((tag ("TS_CP_TEMPLATE_INFO")))
template_info;
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
struct tree_constraint_info GTY ((tag ("TS_CP_CONSTRAINT_INFO")))
constraint_info;
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
struct tree_userdef_literal GTY ((tag ("TS_CP_USERDEF_LITERAL")))
userdef_literal;
};
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
enum cp_tree_index
{
CPTI_WCHAR_DECL,
CPTI_VTABLE_ENTRY_TYPE,
CPTI_DELTA_TYPE,
CPTI_VTABLE_INDEX_TYPE,
CPTI_CLEANUP_TYPE,
Finish implementation of VTTs. * cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and CPTI_VTT_PARM_IDENTIFIER. (vtt_parm_identifier): New macro. (vtt_parm_type): Likewise. (BINFO_SUBVTT_INDEX): Likewise. (BINFO_VPTR_INDEX): Likewise. (struct lang_decl): Add vtt_parm. (DECL_VTT_PARM): New macro. (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject constructors and destructors. * class.c (get_vtt_name): Give it external linkage. (build_clone): Handle the magic VTT parameters for clones. (clone_function_decl): Fix typo in comment. (build_vtt): Keep track of the indices in the VTTs where various entities are stored. (build_vtt_inits): Likewise. (dfs_build_vtt_inits): Likewise. (build_ctor_vtbl_group): Tweak type of construction vtables. (dfs_accumulate_vtbl_inits): Build vtables for all bases, even primary bases, when building construction vtables. * decl.c (duplicate_decls): Handle DECL_VTT_PARM. (initialize_predefined_identifiers): Add vtt_parm_identifier. (init_decl_processing): Initialize vtt_parm_type. (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Make vtt_parm. * decl2.c (build_artificial_parm): New function. (maybe_retrofit_in_chrg): Use it. Add VTT parameters. (grokclassfn): Use build_artificial_parm. * init.c (initialize_vtbl_ptrs): Call fixup_all_virtual_upcast_offsets directly. (perform_member_init): Use the complete subobject destructor for member cleanups. (build_vtbl_address): New function. (expand_virtual_init): Handle VTTs. * optimize (maybe_clone_body): Likewise. * search.c (fixup_all_virtual_upcast_offsets): Give it external linkage. (expand_indirect_vtbls_init): Remove. * semantics.c (setup_vtbl_ptr): Fix typos in comment. * tree.c (make_binfo): Make them bigger. From-SVN: r34177
2000-05-26 01:27:18 +02:00
CPTI_VTT_PARM_TYPE,
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
CPTI_CLASS_TYPE,
CPTI_UNKNOWN_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
CPTI_INIT_LIST_TYPE,
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
CPTI_VTBL_TYPE,
CPTI_VTBL_PTR_TYPE,
CPTI_STD,
CPTI_ABI,
re PR c++/18803 (rejects access to operator() in template) cp: PR c++/18803 * cp-tree.h (REFERENCE_REF_P): New. (CPTI_TYPE_INFO_TYPE): Rename to ... (CPTI_CONST_TYPE_INFO_TYPE): ... here. (CPTI_TYPE_INFO_REF_TYPE): Remove. (type_info_type_node): Rename to ... (const_type_info_type_node): ... here. (type_info_ref_type): Remove. * call.c (build_user_type_conversion): Reformat. (resolve_args): Do not convert_from_reference. (build_object_call): Call convert_from_reference. (prep_operand): Do not convert_from_reference. (build_new_method_call): Likewise. * class.c (build_vfield_ref): Likewise. * cvt.c (convert_to_reference): Likewise. (convert_from_reference): Build INDIRECT_REF here, not with build_indirect_ref. (convert_force): Do not convert_from_reference. (build_expr_type_conversion): Likewise. * decl.c (grok_reference_init): Likewise. * decl2.c (delete_sanity): Likewise. * except.c (initialize_handler_parm): Use POINTER_TYPE_P. * init.c (build_dtor_call): Do not convert_from_reference. * parser.c (cp_parser_template_argument): Unwrap indirected reference. Allow TEMPLATE_PARM_INDEX as an object parm. * pt.c (tsubst_copy_and_build) <case INDIRECT_REF>: Use convert_from_reference, if indicated. <case CALL_EXPR>: Do not convert_from_reference. <case PARM_DECL, VAR_DECL>: Convert_from_reference if needed. (tsubst_initializer_list): Do not convert_from_reference. * rtti.c (init_rtti_processing): Adjust node creation. (throw_bad_typeid): Use const_type_info_type_node. Do not convert_from_reference. (typeid_ok_p): Use const_type_info_type_node. (build_typeid, get_typeid): Always return type_info typed node. (build_dynamic_cast_1): Dont convert_from_reference. Refactor. * semantics.c (finish_stmt_expr_expr): Do not convert_from_reference. (finish_id_expression): Convert_from_reference as appropriate. * typeck.c (decay_conversion): Do not convert_from_reference. (finish_class_member_access_expr): Likewise. (build_indirect_ref): Use POINTER_TYPE_P. (convert_arguments): Do not convert_from_reference. (build_modify_expr): Likewise. (convert_for_initialization): Likewise. * typeck2.c (build_x_arrow): Likewise. testsuite: PR c++/18803 * g++.dg/template/operator5.C: New. From-SVN: r91863
2004-12-08 09:36:09 +01:00
CPTI_CONST_TYPE_INFO_TYPE,
CPTI_TYPE_INFO_PTR_TYPE,
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
CPTI_ABORT_FNDECL,
CPTI_AGGR_TAG,
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
CPTI_CTOR_IDENTIFIER,
CPTI_COMPLETE_CTOR_IDENTIFIER,
CPTI_BASE_CTOR_IDENTIFIER,
CPTI_DTOR_IDENTIFIER,
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
CPTI_COMPLETE_DTOR_IDENTIFIER,
CPTI_BASE_DTOR_IDENTIFIER,
CPTI_DELETING_DTOR_IDENTIFIER,
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
CPTI_DELTA_IDENTIFIER,
CPTI_IN_CHARGE_IDENTIFIER,
Finish implementation of VTTs. * cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and CPTI_VTT_PARM_IDENTIFIER. (vtt_parm_identifier): New macro. (vtt_parm_type): Likewise. (BINFO_SUBVTT_INDEX): Likewise. (BINFO_VPTR_INDEX): Likewise. (struct lang_decl): Add vtt_parm. (DECL_VTT_PARM): New macro. (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject constructors and destructors. * class.c (get_vtt_name): Give it external linkage. (build_clone): Handle the magic VTT parameters for clones. (clone_function_decl): Fix typo in comment. (build_vtt): Keep track of the indices in the VTTs where various entities are stored. (build_vtt_inits): Likewise. (dfs_build_vtt_inits): Likewise. (build_ctor_vtbl_group): Tweak type of construction vtables. (dfs_accumulate_vtbl_inits): Build vtables for all bases, even primary bases, when building construction vtables. * decl.c (duplicate_decls): Handle DECL_VTT_PARM. (initialize_predefined_identifiers): Add vtt_parm_identifier. (init_decl_processing): Initialize vtt_parm_type. (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Make vtt_parm. * decl2.c (build_artificial_parm): New function. (maybe_retrofit_in_chrg): Use it. Add VTT parameters. (grokclassfn): Use build_artificial_parm. * init.c (initialize_vtbl_ptrs): Call fixup_all_virtual_upcast_offsets directly. (perform_member_init): Use the complete subobject destructor for member cleanups. (build_vtbl_address): New function. (expand_virtual_init): Handle VTTs. * optimize (maybe_clone_body): Likewise. * search.c (fixup_all_virtual_upcast_offsets): Give it external linkage. (expand_indirect_vtbls_init): Remove. * semantics.c (setup_vtbl_ptr): Fix typos in comment. * tree.c (make_binfo): Make them bigger. From-SVN: r34177
2000-05-26 01:27:18 +02:00
CPTI_VTT_PARM_IDENTIFIER,
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
CPTI_NELTS_IDENTIFIER,
CPTI_THIS_IDENTIFIER,
CPTI_PFN_IDENTIFIER,
CPTI_VPTR_IDENTIFIER,
CPTI_STD_IDENTIFIER,
CPTI_AUTO_IDENTIFIER,
CPTI_DECLTYPE_AUTO_IDENTIFIER,
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
CPTI_LANG_NAME_C,
CPTI_LANG_NAME_CPLUSPLUS,
CPTI_EMPTY_EXCEPT_SPEC,
CPTI_NOEXCEPT_TRUE_SPEC,
CPTI_NOEXCEPT_FALSE_SPEC,
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
CPTI_TERMINATE,
CPTI_CALL_UNEXPECTED,
CPTI_ATEXIT_FN_PTR_TYPE,
CPTI_ATEXIT,
CPTI_DSO_HANDLE,
CPTI_DCAST,
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
CPTI_KEYED_CLASSES,
call.c (build_special_member_call): Do not try to lookup VTTs by name. * call.c (build_special_member_call): Do not try to lookup VTTs by name. * class.c (vtbl_init_data): Add generate_vcall_entries. (get_vtable_decl): Do not look up virtual tables by name. (copy_virtuals): Do not use BV_USE_VCALL_INDEX_P. (set_primary_base): Do not set CLASSTYPE_RTTI. (determine_primary_base): Likewise. (get_matching_virtual): Remove. (get_vcall_index): New function. (update_vtable_entry_for_fn): Do not try to use virtual thunks when they are not required. Assign vcall indices at this point. (finish_struct_1): Do not set CLASSTYPE_NEEDS_VIRTUAL_REINIT. Do update dynamic_classes. (build_vtt): Do not add VTTs to the symbol table. (build_ctor_vtbl_group): Likewise. (build_vtbl_initializer): Simplify handling of vcall indices. (build_vcall_offset_vtbl_entries): Pretend to build vcall offsets for the most derived class. (add_vcall_offset_vtbl_entries_1): But do not actually add them to the vtable. * cp-tree.h (dynamic_classes): New macro. (lang_type_class): Remove rtti. Add vtables. Add vcall_indices. (CLASSTYPE_RTTI): Remove. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Remove. (CLASSTYPE_VCALL_INDICES): New macro. (CLASSTYPE_VTABLES): Likewise. (BV_USE_VCALL_INDEX_P): Remove. (build_vtable_path): Remove. * decl2.c (finish_vtable_vardecl): Remove. (key_method): Remove #if 0'd code. (finish_vtable_vardecl): Rename to ... (maybe_emit_vtables): ... this. (finish_file): Use it. * search.c (look_for_overrides_here): Update comment. * g++.dg/abi/thunk1.C: New test. * g++.dg/abi/thunk2.C: Likewise. * g++.dg/abi/vtt1.C: Likewise. From-SVN: r58779
2002-11-04 02:45:58 +01:00
CPTI_NULLPTR,
CPTI_NULLPTR_TYPE,
CPTI_ALIGN_TYPE,
CPTI_ANY_TARG,
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
CPTI_MAX
};
1994-02-24 02:02:37 +01:00
extern GTY(()) tree cp_global_trees[CPTI_MAX];
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
#define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
#define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
/* The type used to represent an offset by which to adjust the `this'
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
pointer in pointer-to-member types. */
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
#define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
/* The type used to represent an index into the vtable. */
#define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE]
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations. * cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE, CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE, CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations. (CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE, CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE, CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations. (CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ... (CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here. (CPTI_TINFO_VAR_ID): New enumeration. (__tp_desc_type_node, __access_mode_type_node, __bltn_desc_type_node, __user_desc_type_node, __class_desc_type_node, __ptr_desc_type_node, __attr_desc_type_node, __func_desc_type_node, __ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines. (ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node, ref_desc_type_node, ary_desc_type_node, func_desc_type_node, enum_desc_type_node, class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node, ptmd_desc_type_node, base_desc_type_node): New #defines. (tinfo_fn_id, tinfo_fn_type): Rename to ... (tinfo_decl_id, tinfo_decl_type): ... here. Adjust. (tinfo_var_id): New enumeration. (DECL_TINFO_FN_P): Augment comment. * decl.c (cp_global_trees): Adjust documentation. * rtti.c (init_rtti_processing): Adjust for tinfo_decl_id, tinfo_decl_type and tinfo_var_id. (get_tinfo_decl_dynamic): Adjust for tinfo_decl_type. (build_typeid): Remove unused variable. (get_tinfo_var): Use tinfo_var_id. (tinfo_name): New static function. (get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type. (tinfo_from_decl): Likewise. (get_base_offset): New static function, broken out of expand_class_desc. (expand_si_desc): Use tinfo_name. (expand_class_desc): Likewise. Lose local static variable. Use base_desc_type_node. Use get_base_offset. (expand_ptr_desc): Use tinfo_name. (expand_attr_desc): Likewise. (expand_generic_desc): Likewise. * tinfo.cc (__GXX_ABI_VERSION): Test value and existance. * tinfo.h (__GXX_ABI_VERSION): Test value and existance. From-SVN: r31582
2000-01-24 11:23:26 +01:00
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
#define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
#define unknown_type_node cp_global_trees[CPTI_UNKNOWN_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
#define init_list_type_node cp_global_trees[CPTI_INIT_LIST_TYPE]
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
#define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
#define std_node cp_global_trees[CPTI_STD]
#define abi_node cp_global_trees[CPTI_ABI]
re PR c++/18803 (rejects access to operator() in template) cp: PR c++/18803 * cp-tree.h (REFERENCE_REF_P): New. (CPTI_TYPE_INFO_TYPE): Rename to ... (CPTI_CONST_TYPE_INFO_TYPE): ... here. (CPTI_TYPE_INFO_REF_TYPE): Remove. (type_info_type_node): Rename to ... (const_type_info_type_node): ... here. (type_info_ref_type): Remove. * call.c (build_user_type_conversion): Reformat. (resolve_args): Do not convert_from_reference. (build_object_call): Call convert_from_reference. (prep_operand): Do not convert_from_reference. (build_new_method_call): Likewise. * class.c (build_vfield_ref): Likewise. * cvt.c (convert_to_reference): Likewise. (convert_from_reference): Build INDIRECT_REF here, not with build_indirect_ref. (convert_force): Do not convert_from_reference. (build_expr_type_conversion): Likewise. * decl.c (grok_reference_init): Likewise. * decl2.c (delete_sanity): Likewise. * except.c (initialize_handler_parm): Use POINTER_TYPE_P. * init.c (build_dtor_call): Do not convert_from_reference. * parser.c (cp_parser_template_argument): Unwrap indirected reference. Allow TEMPLATE_PARM_INDEX as an object parm. * pt.c (tsubst_copy_and_build) <case INDIRECT_REF>: Use convert_from_reference, if indicated. <case CALL_EXPR>: Do not convert_from_reference. <case PARM_DECL, VAR_DECL>: Convert_from_reference if needed. (tsubst_initializer_list): Do not convert_from_reference. * rtti.c (init_rtti_processing): Adjust node creation. (throw_bad_typeid): Use const_type_info_type_node. Do not convert_from_reference. (typeid_ok_p): Use const_type_info_type_node. (build_typeid, get_typeid): Always return type_info typed node. (build_dynamic_cast_1): Dont convert_from_reference. Refactor. * semantics.c (finish_stmt_expr_expr): Do not convert_from_reference. (finish_id_expression): Convert_from_reference as appropriate. * typeck.c (decay_conversion): Do not convert_from_reference. (finish_class_member_access_expr): Likewise. (build_indirect_ref): Use POINTER_TYPE_P. (convert_arguments): Do not convert_from_reference. (build_modify_expr): Likewise. (convert_for_initialization): Likewise. * typeck2.c (build_x_arrow): Likewise. testsuite: PR c++/18803 * g++.dg/template/operator5.C: New. From-SVN: r91863
2004-12-08 09:36:09 +01:00
#define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
#define type_info_ptr_type cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE]
c-common.h: New file. * c-common.h: New file. * c-common.c (permanent_obstack): Delete unused declaration. (c_global_trees): New array. (c_common_nodes_and_builtins): New function; split off common code from init_decl_processing in both c-decl.c and cp/decl.c. * c-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. Include c-common.h. * c-decl.c: Delete definitions for tree nodes that were replaced by c_global_trees. (init_decl_processing): Build void_list_node. Call c_common_nodes_and_builtins; delete code to generate the common builtins here. * objc/objc-act.c (build_module_descriptor): Rename variable void_list_node to avoid clash with c-common.h. * cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by c_global_trees and accessor macros defined in c-common.h. (cp_tree_index): New enumeration. (cp_global_trees): Declare new array. Add accessor macros for it, and delete declarations of tree nodes replaced by it. (builtin_function): Delete macro, add declaration for new function. Include c-common.h. * cp/decl.c: Delete definitions for tree nodes that were replaced by cp_global_trees and c_global_trees. (init_decl_processing): Call c_common_nodes_and_builtins; delete code to generate the common builtins here. (builtin_function): New function. * cp/decl2.c (abort_fndecl): Delete declaration. * cp/except.c (expand_builtin_return_address): Delete declaration. (builtin_return_address_fndecl): Delete variable. (const_ptr_type_node): Delete declaration. * cp/lex.c (cons_up_default_function): Delete declaration of void_list_node. * cp/parse.y (void_list_node): Delete declaration. * cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type): Delete variables. (const_string_type_node): Delete declaration. * cp/search.c (abort_fndecl): Delete declaration. * Makefile.in: Update dependencies. * objc/Make-lang.in: Likewise. * cp/Makefile.in: Likewise. From-SVN: r28188
1999-07-20 12:41:10 +02:00
#define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
#define current_aggr cp_global_trees[CPTI_AGGR_TAG]
#define nullptr_node cp_global_trees[CPTI_NULLPTR]
#define nullptr_type_node cp_global_trees[CPTI_NULLPTR_TYPE]
/* std::align_val_t */
#define align_type_node cp_global_trees[CPTI_ALIGN_TYPE]
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
/* We cache these tree nodes so as to call get_identifier less
frequently. */
/* The name of a constructor that takes an in-charge parameter to
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
decide whether or not to construct virtual base classes. */
#define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER]
/* The name of a constructor that constructs virtual base classes. */
#define complete_ctor_identifier cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]
/* The name of a constructor that does not construct virtual base classes. */
#define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* The name of a destructor that takes an in-charge parameter to
decide whether or not to destroy virtual base classes and whether
or not to delete the object. */
#define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER]
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* The name of a destructor that destroys virtual base classes. */
#define complete_dtor_identifier cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER]
/* The name of a destructor that does not destroy virtual base
classes. */
#define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER]
/* The name of a destructor that destroys virtual base classes, and
then deletes the entire object. */
#define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
#define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER]
#define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
Finish implementation of VTTs. * cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and CPTI_VTT_PARM_IDENTIFIER. (vtt_parm_identifier): New macro. (vtt_parm_type): Likewise. (BINFO_SUBVTT_INDEX): Likewise. (BINFO_VPTR_INDEX): Likewise. (struct lang_decl): Add vtt_parm. (DECL_VTT_PARM): New macro. (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject constructors and destructors. * class.c (get_vtt_name): Give it external linkage. (build_clone): Handle the magic VTT parameters for clones. (clone_function_decl): Fix typo in comment. (build_vtt): Keep track of the indices in the VTTs where various entities are stored. (build_vtt_inits): Likewise. (dfs_build_vtt_inits): Likewise. (build_ctor_vtbl_group): Tweak type of construction vtables. (dfs_accumulate_vtbl_inits): Build vtables for all bases, even primary bases, when building construction vtables. * decl.c (duplicate_decls): Handle DECL_VTT_PARM. (initialize_predefined_identifiers): Add vtt_parm_identifier. (init_decl_processing): Initialize vtt_parm_type. (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Make vtt_parm. * decl2.c (build_artificial_parm): New function. (maybe_retrofit_in_chrg): Use it. Add VTT parameters. (grokclassfn): Use build_artificial_parm. * init.c (initialize_vtbl_ptrs): Call fixup_all_virtual_upcast_offsets directly. (perform_member_init): Use the complete subobject destructor for member cleanups. (build_vtbl_address): New function. (expand_virtual_init): Handle VTTs. * optimize (maybe_clone_body): Likewise. * search.c (fixup_all_virtual_upcast_offsets): Give it external linkage. (expand_indirect_vtbls_init): Remove. * semantics.c (setup_vtbl_ptr): Fix typos in comment. * tree.c (make_binfo): Make them bigger. From-SVN: r34177
2000-05-26 01:27:18 +02:00
/* The name of the parameter that contains a pointer to the VTT to use
for this subobject constructor or destructor. */
#define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER]
#define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER]
#define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER]
#define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER]
#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
/* The name of the std namespace. */
#define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
/* auto and declspec(auto) identifiers. */
#define auto_identifier cp_global_trees[CPTI_AUTO_IDENTIFIER]
#define decltype_auto_identifier cp_global_trees[CPTI_DECLTYPE_AUTO_IDENTIFIER]
/* The name of a C++17 deduction guide. */
#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
/* Exception specifiers used for throw(), noexcept(true) and
noexcept(false). We rely on these being uncloned. */
#define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
#define noexcept_true_spec cp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC]
#define noexcept_false_spec cp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC]
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
/* The declaration for `std::terminate'. */
#define terminate_node cp_global_trees[CPTI_TERMINATE]
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
/* The declaration for "__cxa_call_unexpected". */
#define call_unexpected_node cp_global_trees[CPTI_CALL_UNEXPECTED]
/* The type of the function-pointer argument to "__cxa_atexit" (or
"std::atexit", if "__cxa_atexit" is not being used). */
#define atexit_fn_ptr_type_node cp_global_trees[CPTI_ATEXIT_FN_PTR_TYPE]
/* A pointer to `std::atexit'. */
#define atexit_node cp_global_trees[CPTI_ATEXIT]
/* A pointer to `__dso_handle'. */
#define dso_handle_node cp_global_trees[CPTI_DSO_HANDLE]
/* The declaration of the dynamic_cast runtime. */
#define dynamic_cast_node cp_global_trees[CPTI_DCAST]
/* The type of a destructor. */
#define cleanup_type cp_global_trees[CPTI_CLEANUP_TYPE]
Finish implementation of VTTs. * cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and CPTI_VTT_PARM_IDENTIFIER. (vtt_parm_identifier): New macro. (vtt_parm_type): Likewise. (BINFO_SUBVTT_INDEX): Likewise. (BINFO_VPTR_INDEX): Likewise. (struct lang_decl): Add vtt_parm. (DECL_VTT_PARM): New macro. (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject constructors and destructors. * class.c (get_vtt_name): Give it external linkage. (build_clone): Handle the magic VTT parameters for clones. (clone_function_decl): Fix typo in comment. (build_vtt): Keep track of the indices in the VTTs where various entities are stored. (build_vtt_inits): Likewise. (dfs_build_vtt_inits): Likewise. (build_ctor_vtbl_group): Tweak type of construction vtables. (dfs_accumulate_vtbl_inits): Build vtables for all bases, even primary bases, when building construction vtables. * decl.c (duplicate_decls): Handle DECL_VTT_PARM. (initialize_predefined_identifiers): Add vtt_parm_identifier. (init_decl_processing): Initialize vtt_parm_type. (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Make vtt_parm. * decl2.c (build_artificial_parm): New function. (maybe_retrofit_in_chrg): Use it. Add VTT parameters. (grokclassfn): Use build_artificial_parm. * init.c (initialize_vtbl_ptrs): Call fixup_all_virtual_upcast_offsets directly. (perform_member_init): Use the complete subobject destructor for member cleanups. (build_vtbl_address): New function. (expand_virtual_init): Handle VTTs. * optimize (maybe_clone_body): Likewise. * search.c (fixup_all_virtual_upcast_offsets): Give it external linkage. (expand_indirect_vtbls_init): Remove. * semantics.c (setup_vtbl_ptr): Fix typos in comment. * tree.c (make_binfo): Make them bigger. From-SVN: r34177
2000-05-26 01:27:18 +02:00
/* The type of the vtt parameter passed to subobject constructors and
destructors. */
#define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE]
Finish implementation of VTTs. * cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and CPTI_VTT_PARM_IDENTIFIER. (vtt_parm_identifier): New macro. (vtt_parm_type): Likewise. (BINFO_SUBVTT_INDEX): Likewise. (BINFO_VPTR_INDEX): Likewise. (struct lang_decl): Add vtt_parm. (DECL_VTT_PARM): New macro. (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject constructors and destructors. * class.c (get_vtt_name): Give it external linkage. (build_clone): Handle the magic VTT parameters for clones. (clone_function_decl): Fix typo in comment. (build_vtt): Keep track of the indices in the VTTs where various entities are stored. (build_vtt_inits): Likewise. (dfs_build_vtt_inits): Likewise. (build_ctor_vtbl_group): Tweak type of construction vtables. (dfs_accumulate_vtbl_inits): Build vtables for all bases, even primary bases, when building construction vtables. * decl.c (duplicate_decls): Handle DECL_VTT_PARM. (initialize_predefined_identifiers): Add vtt_parm_identifier. (init_decl_processing): Initialize vtt_parm_type. (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Make vtt_parm. * decl2.c (build_artificial_parm): New function. (maybe_retrofit_in_chrg): Use it. Add VTT parameters. (grokclassfn): Use build_artificial_parm. * init.c (initialize_vtbl_ptrs): Call fixup_all_virtual_upcast_offsets directly. (perform_member_init): Use the complete subobject destructor for member cleanups. (build_vtbl_address): New function. (expand_virtual_init): Handle VTTs. * optimize (maybe_clone_body): Likewise. * search.c (fixup_all_virtual_upcast_offsets): Give it external linkage. (expand_indirect_vtbls_init): Remove. * semantics.c (setup_vtbl_ptr): Fix typos in comment. * tree.c (make_binfo): Make them bigger. From-SVN: r34177
2000-05-26 01:27:18 +02:00
/* A TREE_LIST of the dynamic classes whose vtables may have to be
emitted in this translation unit. */
call.c (build_special_member_call): Do not try to lookup VTTs by name. * call.c (build_special_member_call): Do not try to lookup VTTs by name. * class.c (vtbl_init_data): Add generate_vcall_entries. (get_vtable_decl): Do not look up virtual tables by name. (copy_virtuals): Do not use BV_USE_VCALL_INDEX_P. (set_primary_base): Do not set CLASSTYPE_RTTI. (determine_primary_base): Likewise. (get_matching_virtual): Remove. (get_vcall_index): New function. (update_vtable_entry_for_fn): Do not try to use virtual thunks when they are not required. Assign vcall indices at this point. (finish_struct_1): Do not set CLASSTYPE_NEEDS_VIRTUAL_REINIT. Do update dynamic_classes. (build_vtt): Do not add VTTs to the symbol table. (build_ctor_vtbl_group): Likewise. (build_vtbl_initializer): Simplify handling of vcall indices. (build_vcall_offset_vtbl_entries): Pretend to build vcall offsets for the most derived class. (add_vcall_offset_vtbl_entries_1): But do not actually add them to the vtable. * cp-tree.h (dynamic_classes): New macro. (lang_type_class): Remove rtti. Add vtables. Add vcall_indices. (CLASSTYPE_RTTI): Remove. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Remove. (CLASSTYPE_VCALL_INDICES): New macro. (CLASSTYPE_VTABLES): Likewise. (BV_USE_VCALL_INDEX_P): Remove. (build_vtable_path): Remove. * decl2.c (finish_vtable_vardecl): Remove. (key_method): Remove #if 0'd code. (finish_vtable_vardecl): Rename to ... (maybe_emit_vtables): ... this. (finish_file): Use it. * search.c (look_for_overrides_here): Update comment. * g++.dg/abi/thunk1.C: New test. * g++.dg/abi/thunk2.C: Likewise. * g++.dg/abi/vtt1.C: Likewise. From-SVN: r58779
2002-11-04 02:45:58 +01:00
#define keyed_classes cp_global_trees[CPTI_KEYED_CLASSES]
call.c (build_special_member_call): Do not try to lookup VTTs by name. * call.c (build_special_member_call): Do not try to lookup VTTs by name. * class.c (vtbl_init_data): Add generate_vcall_entries. (get_vtable_decl): Do not look up virtual tables by name. (copy_virtuals): Do not use BV_USE_VCALL_INDEX_P. (set_primary_base): Do not set CLASSTYPE_RTTI. (determine_primary_base): Likewise. (get_matching_virtual): Remove. (get_vcall_index): New function. (update_vtable_entry_for_fn): Do not try to use virtual thunks when they are not required. Assign vcall indices at this point. (finish_struct_1): Do not set CLASSTYPE_NEEDS_VIRTUAL_REINIT. Do update dynamic_classes. (build_vtt): Do not add VTTs to the symbol table. (build_ctor_vtbl_group): Likewise. (build_vtbl_initializer): Simplify handling of vcall indices. (build_vcall_offset_vtbl_entries): Pretend to build vcall offsets for the most derived class. (add_vcall_offset_vtbl_entries_1): But do not actually add them to the vtable. * cp-tree.h (dynamic_classes): New macro. (lang_type_class): Remove rtti. Add vtables. Add vcall_indices. (CLASSTYPE_RTTI): Remove. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Remove. (CLASSTYPE_VCALL_INDICES): New macro. (CLASSTYPE_VTABLES): Likewise. (BV_USE_VCALL_INDEX_P): Remove. (build_vtable_path): Remove. * decl2.c (finish_vtable_vardecl): Remove. (key_method): Remove #if 0'd code. (finish_vtable_vardecl): Rename to ... (maybe_emit_vtables): ... this. (finish_file): Use it. * search.c (look_for_overrides_here): Update comment. * g++.dg/abi/thunk1.C: New test. * g++.dg/abi/thunk2.C: Likewise. * g++.dg/abi/vtt1.C: Likewise. From-SVN: r58779
2002-11-04 02:45:58 +01:00
/* A node which matches any template argument. */
#define any_targ_node cp_global_trees[CPTI_ANY_TARG]
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
/* Node to indicate default access. This must be distinct from the
access nodes in tree.h. */
#define access_default_node null_node
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
/* Global state. */
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) saved_scope {
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<cxx_saved_binding, va_gc> *old_bindings;
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
tree old_namespace;
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> *decl_ns_list;
tree class_name;
tree class_type;
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
tree access_specifier;
Reorganize per-function data. * cp-tree.h (saved_scope): Add function_decl, bindings. (language_function): Rename binding_level to bindings. (cp_function_chain): Use the current_function, not the outer_function_chain. (current_class_ptr): Make it work, even when there's no current function. (current_class_ref): Likewise. (SF_DEFAULT, SF_PRE_PARSED, SF_INCLASS_INLINE, SF_EXPAND): New macros. (clear_temp_name): Remove. * decl.c (check_function_type): New function, broken out from start_function. (current_binding_level): Adjust definition. (pushlevel): Simplify. (poplevel): Don't use named_label_uses when we're outside a function scope. (mark_saved_scope): Mark function_decl and bindings. (maybe_push_to_top_level): Don't unconditionally push a new function context. Save bindings and the current_function_decl. Don't clear named_labels. (pop_from_top_level): Pop function context if appropriate. (init_decl_processing): Set init_lang_status and free_lang_status, rather than save_lang_status and restore_lang_status. (start_function): Take SF_* flags. Don't clear per-function data. Reorder and simplify to use new per-function data code. Add asserts. (store_parm_decls): Don't call init_function_start here. (finish_function): Adjust for new handling of per-function data. (push_cp_function_context): Simplify. (mark_cp_function_context): Change binding_level to bindings. * decl2.c (clear_temp_name): Remove. (start_objects): Use SF flags to start_function. (start_static_storage_duration_function): Likewise. * except.c (start_anon_func): Remove redundant calls to push_function_context_to. Use SF flags to start function. (end_anon_func): Remove redundant call to pop_function_context from. * lex.c (reinit_parse_for_function): Don't initialize per-function data. * method.c (emit_thunk): Clear current_function after calling assemble_end_function. Use SF flags for start_function. (synthesize_method): Use SF flags for start_function. * parse.c: Regenerated. * parse.y (fn.defpen): Likewise. (pending_inline): Clear current_function, even if something goes wrong. * pt.c (instantiate_decl): Use SF flags to start_function. Don't save and restore expanding_p. (add_tree): Handle the case where we are outside any function. (end_tree): Likewise. * rtti.c (sythesize_tinfo_fn): Use SF flags to start_function. * semantics.c (begin_function_definition): Likewise. (expand_body): Likewise. From-SVN: r29240
1999-09-09 21:02:39 +02:00
tree function_decl;
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> *lang_base;
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
tree lang_name;
tree template_parms;
cp_binding_level *x_previous_class_level;
cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.h (struct stmt_tree): New type. (struct saved_scope): Remove firstobj. Add x_saved_tree, x_stmt_tree. (class_cache_firstobj): Remove. (struct language_function): Remove stmts_are_full_exprs_p, x_last_tree, and x_last_expr_type. Add x_stmt_tree. (current_stmt_tree): New macro. (last_tree): Adjust. (last_expr_type): Likewise. (doing_semantic_analysis_p): Simplify. (stmts_are_full_exprs_p): Adjust. (begin_tree): Remove prototype. (end_tree): Likewise. (begin_stmt_tree): Change prototype. (finish_stmt_tree): Likewise. (building_stmt_tree): Simplify. * decl.c (mark_stmt_tree): New function. (mark_saved_scope): Use it. (start_function): Rearrange slightly to call begin_stmt_tree earlier. (save_function_data): Tweak. (finish_function): Adjust call to finish_stmt_tree. (mark_lang_function): Use mark_stmt_tree. * expr.c (cplus_expand_expr): Don't handle VEC_INIT_EXPR. * init.c (build_new_1): Remove creation of VEC_INIT_EXPR. (build_vec_init): Remove creation of stand-in intializer. * pt.c (begin_tree): Remove. (end_tree): Likewise. * semantics.c (SET_LAST_STMT): New macro. Use it throughout. (begin_compound_stmt): Handle a compound-statement outside of a function. (begin_stmt_expr): Handle a statement-expression outsidef of a function. (finish_stmt_expr): Likewise. (begin_class_definition): Don't call begin_tree. (finish_inline_definitions): Don't call end_tree. (begin_stmt_tree): Take a pointer to tree, not a function as input. (finish_stmt_tree): Likewise. * tree.c (search_tree): Don't handle VEC_INIT_EXPR. (mapcar): Likewise. * parse.y (simple_stmt): Don't call finish_stmt unnecessarily. * parse.c: Regenerated. * dump.c (dqueue_and_dump): Dump bitfieldness. From-SVN: r29786
1999-10-03 20:57:37 +02:00
tree x_saved_tree;
/* Only used for uses of this in trailing return type. */
tree x_current_class_ptr;
tree x_current_class_ref;
int x_processing_template_decl;
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
int x_processing_specialization;
BOOL_BITFIELD x_processing_explicit_instantiation : 1;
BOOL_BITFIELD need_pop_function_context : 1;
c-common.c (skip_evaluation): Don't define. ./: * c-common.c (skip_evaluation): Don't define. (c_inhibit_evaluation_warnings): Define global variable. (overflow_warning): Check c_inhibit_evaluation_warnings rather than skip_evaluation. (convert_and_check, warn_for_div_by_zero): Likewise. * c-common.h (skip_evaluation): Don't declare. (c_inhibit_evaluation_warnings): Declare. * c-parser.c (c_parser_typeof_specifier): Set c_inhibit_evaluation_warnings rather than skip_evaluation. (c_parser_conditional_expression): Likewise. (c_parser_binary_expression): Likewise. (c_parser_sizeof_expression): Likewise. (c_parser_alignof_expression): Likewise. * c-typeck.c (build_indirect_ref): Check c_inhibit_evaluation_warnings rather than skip_evaluation. (build_conditional_expr, build_binary_op): Likewise. cp/: * parser.c (cp_unevaluated_operand): Define global variable. (cp_parser_question_colon_clause): Increment c_inhibit_evaluation_warnings when evaluating an expression which will never be executed. (cp_parser_decltype): Increment cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. (cp_parser_sizeof_operand): Likewise. (cp_parser_enclosed_template_argument_list): Save cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. * cp-tree.h (struct saved_scope): Remove skip_evaluation field. Add unevaluated_operand and inhibit_evaluation_warnings fields. (cp_unevaluated_operand): Declare. * name-lookup.c (push_to_top_level): Save cp_unevaluated_operand and c_inhibit_evaluation_warnings rather than skip_evaluation. (pop_from_top_level): Restore cp_unevaluated_operand and c_inhibit_evaluation_warnings rather than skip_evaluation. * class.c (build_base_path): Check cp_unevaluated_operand rather than skip_evaluation. * typeck.c (build_class_member_access_expr): Likewise. (cp_build_binary_op): Don't warn about bad shift counts if c_inhibit_evaluation_warnings is non-zero. * pt.c (coerce_template_parms): Save state of cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. (tsubst_aggr_type): Likewise. (tsubst_pack_expansion): Check cp_unevaluated_operand rather than skip_evaluation. (tsubst_copy): Likewise. (tsubst): Set cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. (tsubst_copy_and_build): Likewise. * call.c (convert_arg_to_ellipsis): Check cp_unevaluated_operand rather than skip_evaluation. * decl2.c (mark_used): Likewise. * semantics.c (finish_non_static_data_member): Likewise. * cvt.c (cp_convert_and_check): Check c_inhibit_evaluation_warnings rather than skip_evaluation. * mangle.c (write_type): Set cp_unevaluated_operand rather than skip_evaluation. testsuite/: * g++.dg/warn/skip-1.C: New testcase. From-SVN: r148535
2009-06-16 16:24:40 +02:00
/* Nonzero if we are parsing the discarded statement of a constexpr
if-statement. */
BOOL_BITFIELD discarded_stmt : 1;
c-common.c (skip_evaluation): Don't define. ./: * c-common.c (skip_evaluation): Don't define. (c_inhibit_evaluation_warnings): Define global variable. (overflow_warning): Check c_inhibit_evaluation_warnings rather than skip_evaluation. (convert_and_check, warn_for_div_by_zero): Likewise. * c-common.h (skip_evaluation): Don't declare. (c_inhibit_evaluation_warnings): Declare. * c-parser.c (c_parser_typeof_specifier): Set c_inhibit_evaluation_warnings rather than skip_evaluation. (c_parser_conditional_expression): Likewise. (c_parser_binary_expression): Likewise. (c_parser_sizeof_expression): Likewise. (c_parser_alignof_expression): Likewise. * c-typeck.c (build_indirect_ref): Check c_inhibit_evaluation_warnings rather than skip_evaluation. (build_conditional_expr, build_binary_op): Likewise. cp/: * parser.c (cp_unevaluated_operand): Define global variable. (cp_parser_question_colon_clause): Increment c_inhibit_evaluation_warnings when evaluating an expression which will never be executed. (cp_parser_decltype): Increment cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. (cp_parser_sizeof_operand): Likewise. (cp_parser_enclosed_template_argument_list): Save cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. * cp-tree.h (struct saved_scope): Remove skip_evaluation field. Add unevaluated_operand and inhibit_evaluation_warnings fields. (cp_unevaluated_operand): Declare. * name-lookup.c (push_to_top_level): Save cp_unevaluated_operand and c_inhibit_evaluation_warnings rather than skip_evaluation. (pop_from_top_level): Restore cp_unevaluated_operand and c_inhibit_evaluation_warnings rather than skip_evaluation. * class.c (build_base_path): Check cp_unevaluated_operand rather than skip_evaluation. * typeck.c (build_class_member_access_expr): Likewise. (cp_build_binary_op): Don't warn about bad shift counts if c_inhibit_evaluation_warnings is non-zero. * pt.c (coerce_template_parms): Save state of cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. (tsubst_aggr_type): Likewise. (tsubst_pack_expansion): Check cp_unevaluated_operand rather than skip_evaluation. (tsubst_copy): Likewise. (tsubst): Set cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. (tsubst_copy_and_build): Likewise. * call.c (convert_arg_to_ellipsis): Check cp_unevaluated_operand rather than skip_evaluation. * decl2.c (mark_used): Likewise. * semantics.c (finish_non_static_data_member): Likewise. * cvt.c (cp_convert_and_check): Check c_inhibit_evaluation_warnings rather than skip_evaluation. * mangle.c (write_type): Set cp_unevaluated_operand rather than skip_evaluation. testsuite/: * g++.dg/warn/skip-1.C: New testcase. From-SVN: r148535
2009-06-16 16:24:40 +02:00
int unevaluated_operand;
int inhibit_evaluation_warnings;
int noexcept_operand;
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
/* If non-zero, implicit "omp declare target" attribute is added into the
attribute lists. */
int omp_declare_target_attribute;
Move statement-tree facilities from C++ to C front-end. * c-common.h (c_tree_index): Add CTI_VOID_ZERO. (void_zero_node): New macro. (struct stmt_tree_s): New type. (stmt_tree): New typedef. (struct language_function): New type. (last_tree): New macro. (last_expr_type): Likewise. (walk_tree_fn): New typedef. (current_stmt_tree): New function. (begin_stmt_tree): Likewise. (add_stmt): Likewise. (finish_stmt_tree): Likewise. (statement_code_p): Likewise. (lang_statement_code_p): New variable. (walk_stmt_tree): New function. (STMT_IS_FULL_EXPR_P): New macro. * c-common.c (lang_statement_code_p): New variable. (c_common_nodes_and_builtins): Initialize void_zero_node. (statement_code_p): New function. (walk_stmt_tree): Likewise. * c-decl.c (language_function): Rename to ... (c_language_function): ... this. Include language_function. (push_c_function_context): Adjust accordingly. (pop_c_function_context): Likewise. (mark_c_function_context): Likewise. (current_stmt_tree): Define. * c-semantics.c (begin_stmt_tree): New function. (add_stmt): Likewise. (prune_unused_decls): Likewise. (finish_stmt_tree): Likewise. Move statement-tree facilities from C++ to C front-end. * cp-tree.h (cp_tree_index): Remove CPTI_VOID_ZERO. (void_zero_node): Remove. (stmt_tree): Likewise. (scope_chain): Adjust. (language_function): Rename to cp_language_function. (cp_function_chain): Adjust. (current_stmt_tree): Remove. (last_tree): Likewise. (last_expr_type): Likewise. (struct lang_decl): Adjust. (STMT_IS_FULL_EXPR_P): Remove. (add_tree): Remove. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (walk_tree_fn): Likewise. (walk_stmt_tree): Likewise. * class.c (finish_struct): Replace use of add_tree with add_stmt. * decl.c (mark_stmt_tree): Adjust type. (init_decl_processing): Don't build void_zero_node. (initialize_local_var): Adjust usage of current_stmt_tree. (finish_enum): Use add_stmt, not add_tree. (save_function_data): Adjust use of language_function. (finish_constructor_body): Use add_stmt, not add_tree. (finish_destructor_body): Likewise. (push_cp_function_context): Adjust use of language_function. (pop_cp_function_context): Likewise. (mark_lang_function): Likewise. (mark_cp_function_context): Likewise. * init.c (build_aggr_init): Adjust use of current_stmt_tree. (build_vec_init): Likewise. * semantics.c (SET_LAST_STMT): Remove. (RECHAIN_STMTS): Don't use it. (stmts_are_full_exprs_p): Adjust use of current_stmt_tree. (current_stmt_tree): Define. (add_tree): Remove. (finish_goto_stmt): Use add_stmt, not add_tree. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_then_clause): Likewise. (begin_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (begin_handler): Likewise. (begin_catch_block): Likewise. (begin_compound_stmt): Likewise. (begin_asm_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (add_decl_stmt): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (setup_vtbl_ptr): Likewise. (add_scope_stmt): Likewise. (finish_stmt_expr): Likewise. (prune_unused_decls): Remove. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (prep_stmt): Adjust use of current_stmt_tree. (lang_expand_stmt): Likewise. * tree.c (statement_code_p): Remove. (cp_statement_code_p): New function. (walk_stmt_tree): Remove. (init_tree): Set lang_statement_code_p. From-SVN: r36221
2000-09-07 03:36:11 +02:00
struct stmt_tree_s x_stmt_tree;
cp_binding_level *class_bindings;
cp_binding_level *bindings;
hash_map<tree, tree> *GTY((skip)) x_local_specializations;
struct saved_scope *prev;
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
};
extern GTY(()) struct saved_scope *scope_chain;
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
/* The current open namespace. */
#define current_namespace scope_chain->old_namespace
/* The stack for namespaces of current declarations. */
#define decl_namespace_list scope_chain->decl_ns_list
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
/* IDENTIFIER_NODE: name of current class */
#define current_class_name scope_chain->class_name
/* _TYPE: the type of the current class */
#define current_class_type scope_chain->class_type
/* When parsing a class definition, the access specifier most recently
given by the user, or, if no access specifier was given, the
default value appropriate for the kind of class (i.e., struct,
class, or union). */
#define current_access_specifier scope_chain->access_specifier
/* Pointer to the top of the language name stack. */
#define current_lang_base scope_chain->lang_base
#define current_lang_name scope_chain->lang_name
/* When parsing a template declaration, a TREE_LIST represents the
active template parameters. Each node in the list represents one
level of template parameters. The innermost level is first in the
list. The depth of each level is stored as an INTEGER_CST in the
TREE_PURPOSE of each node. The parameters for that level are
stored in the TREE_VALUE. */
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
#define current_template_parms scope_chain->template_parms
#define processing_template_decl scope_chain->x_processing_template_decl
#define processing_specialization scope_chain->x_processing_specialization
#define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
#define in_discarded_stmt scope_chain->discarded_stmt
/* RAII sentinel to handle clearing processing_template_decl and restoring
it when done. */
struct processing_template_decl_sentinel
{
int saved;
processing_template_decl_sentinel (bool reset = true)
: saved (processing_template_decl)
{
if (reset)
processing_template_decl = 0;
}
~processing_template_decl_sentinel()
{
processing_template_decl = saved;
}
};
/* RAII sentinel to disable certain warnings during template substitution
and elsewhere. */
struct warning_sentinel
{
int &flag;
int val;
warning_sentinel(int& flag, bool suppress=true)
: flag(flag), val(flag) { if (suppress) flag = 0; }
~warning_sentinel() { flag = val; }
};
/* The cached class binding level, from the most recently exited
class, or NULL if none. */
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
#define previous_class_level scope_chain->x_previous_class_level
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
/* A map from local variable declarations in the body of the template
presently being instantiated to the corresponding instantiated
local variables. */
#define local_specializations scope_chain->x_local_specializations
/* Nonzero if we are parsing the operand of a noexcept operator. */
#define cp_noexcept_operand scope_chain->noexcept_operand
cp-tree.h (struct saved_scope): Add incomplete field. * cp-tree.h (struct saved_scope): Add incomplete field. (namespace_scope_incomplete): New macro. * decl.c (pushdecl): Use it. (hack_incomplete_structures): Use it. See through artificial binding levels. (mark_saved_scope): Mark it. Implement access control for nested types. * search.c (type_access_control): New fn. (accessible_p): Now we do perform access control for types. * semantics.c (deferred_type_access_control): New fn. (initial_deferred_type_access_control): New fn. (begin_function_definition): Call it. Add lookups parm. * decl.c (struct binding_level): Add this_class field. (pushlevel_class): Set it. (mark_binding_level): Mark it. (lookup_name_real): Use it. Call type_access_control. (mark_saved_scope): Mark lookups field. * cp-tree.h (flagged_type_tree): Add lookups field. (struct saved_scope): Add lookups field. (type_lookups): New macro. * parse.y (declmods): Now <ftype>. (parse_decl): Add lookups parm. Call initial_deferred_type_access_control. (lang_extdef): Clear type_lookups. (typed_declspecs, declmods, typespec): Set lookups field. (initdcl): Call deferred_type_access_control. (fn.def1, fn.def2, typed_declspecs1, initdcl0_innards, nomods_initdcl0, component_decl_1, named_parm): Adjust. * friend.c (is_friend): Nested classes are friends of their enclosing classes. * class.c (currently_open_derived_class): New fn. * method.c (hack_identifier): Use it. * lex.c (do_identifier): Remove obsolete code. * parse.y (typed_typespecs): Propagate new_type_flag properly. From-SVN: r31837
2000-02-07 21:36:36 +01:00
/* A list of private types mentioned, for deferred access checking. */
struct GTY((for_user)) cxx_int_tree_map {
unsigned int uid;
tree to;
};
hash-traits.h (ggc_hasher): Rename to... gcc/ * hash-traits.h (ggc_hasher): Rename to... (ggc_remover): ...this and remove typedefs. (ggc_cache_hasher): Update accordingly. Add typedefs. (ggc_ptr_hash): New class. * hash-table.h: Update comment. * cfgloop.h (loop_exit_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. * cgraph.h (section_name_hasher, cgraph_edge_hasher): Likewise. (tree_descriptor_hasher): Likewise. * cgraph.c (function_version_hasher): Likewise. * dwarf2out.c (indirect_string_hasher, dwarf_file_hasher): Likewise. (decl_die_hasher, block_die_hasher, decl_loc_hasher): Likewise. (dw_loc_list_hasher, addr_hasher): Likewise. * function.h (used_type_hasher): Likewise. * function.c (temp_address_hasher): Likewise. * gimple-ssa.h (tm_restart_hasher, ssa_name_hasher): Likewise. * libfuncs.h (libfunc_hasher): Likewise. * lto-streamer.h (decl_state_hasher): Likewise. * optabs.c (libfunc_decl_hasher): Likewise. * tree-scalar-evolution.c (scev_info_hasher): Likewise. * varasm.c (section_hasher, object_block_hasher): Likewise. (const_rtx_desc_hasher): Likewise. * config/darwin.c (indirection_hasher, cfstring_hasher): Likewise. * config/rs6000/rs6000.c (toc_hasher, builtin_hasher): Likewise. gcc/c-family/ * c-common.c (c_type_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. gcc/cp/ * constexpr.c (constexpr_fundef_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. (constexpr_call_hasher): Likewise. * cp-tree.h (cxx_int_tree_map_hasher, named_label_hasher): Likewise. * decl.c (typename_hasher): Likewise. * mangle.c (conv_type_hasher): Likewise. * pt.c (spec_hasher): Likewise. * tree.c (cplus_array_hasher, list_hasher): Likewise. * typeck2.c (abstract_type_hasher): Likewise. gcc/fortran/ * trans-decl.c (module_hasher): Likewise. * trans.h (module_decl_hasher): Likewise. gcc/java/ * java-tree.h (treetreehasher): Inherit from ggc_ptr_hash rather than ggc_hasher. (ict_hasher, type_assertion_hasher): Likewise. gcc/objc/ * objc-act.c (objc_string_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. From-SVN: r224959
2015-06-25 19:06:36 +02:00
struct cxx_int_tree_map_hasher : ggc_ptr_hash<cxx_int_tree_map>
{
static hashval_t hash (cxx_int_tree_map *);
static bool equal (cxx_int_tree_map *, cxx_int_tree_map *);
};
struct named_label_entry;
hash-traits.h (ggc_hasher): Rename to... gcc/ * hash-traits.h (ggc_hasher): Rename to... (ggc_remover): ...this and remove typedefs. (ggc_cache_hasher): Update accordingly. Add typedefs. (ggc_ptr_hash): New class. * hash-table.h: Update comment. * cfgloop.h (loop_exit_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. * cgraph.h (section_name_hasher, cgraph_edge_hasher): Likewise. (tree_descriptor_hasher): Likewise. * cgraph.c (function_version_hasher): Likewise. * dwarf2out.c (indirect_string_hasher, dwarf_file_hasher): Likewise. (decl_die_hasher, block_die_hasher, decl_loc_hasher): Likewise. (dw_loc_list_hasher, addr_hasher): Likewise. * function.h (used_type_hasher): Likewise. * function.c (temp_address_hasher): Likewise. * gimple-ssa.h (tm_restart_hasher, ssa_name_hasher): Likewise. * libfuncs.h (libfunc_hasher): Likewise. * lto-streamer.h (decl_state_hasher): Likewise. * optabs.c (libfunc_decl_hasher): Likewise. * tree-scalar-evolution.c (scev_info_hasher): Likewise. * varasm.c (section_hasher, object_block_hasher): Likewise. (const_rtx_desc_hasher): Likewise. * config/darwin.c (indirection_hasher, cfstring_hasher): Likewise. * config/rs6000/rs6000.c (toc_hasher, builtin_hasher): Likewise. gcc/c-family/ * c-common.c (c_type_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. gcc/cp/ * constexpr.c (constexpr_fundef_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. (constexpr_call_hasher): Likewise. * cp-tree.h (cxx_int_tree_map_hasher, named_label_hasher): Likewise. * decl.c (typename_hasher): Likewise. * mangle.c (conv_type_hasher): Likewise. * pt.c (spec_hasher): Likewise. * tree.c (cplus_array_hasher, list_hasher): Likewise. * typeck2.c (abstract_type_hasher): Likewise. gcc/fortran/ * trans-decl.c (module_hasher): Likewise. * trans.h (module_decl_hasher): Likewise. gcc/java/ * java-tree.h (treetreehasher): Inherit from ggc_ptr_hash rather than ggc_hasher. (ict_hasher, type_assertion_hasher): Likewise. gcc/objc/ * objc-act.c (objc_string_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. From-SVN: r224959
2015-06-25 19:06:36 +02:00
struct named_label_hasher : ggc_ptr_hash<named_label_entry>
{
static hashval_t hash (named_label_entry *);
static bool equal (named_label_entry *, named_label_entry *);
};
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
/* Global state pertinent to the current function. */
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) language_function {
struct c_language_function base;
Move statement-tree facilities from C++ to C front-end. * c-common.h (c_tree_index): Add CTI_VOID_ZERO. (void_zero_node): New macro. (struct stmt_tree_s): New type. (stmt_tree): New typedef. (struct language_function): New type. (last_tree): New macro. (last_expr_type): Likewise. (walk_tree_fn): New typedef. (current_stmt_tree): New function. (begin_stmt_tree): Likewise. (add_stmt): Likewise. (finish_stmt_tree): Likewise. (statement_code_p): Likewise. (lang_statement_code_p): New variable. (walk_stmt_tree): New function. (STMT_IS_FULL_EXPR_P): New macro. * c-common.c (lang_statement_code_p): New variable. (c_common_nodes_and_builtins): Initialize void_zero_node. (statement_code_p): New function. (walk_stmt_tree): Likewise. * c-decl.c (language_function): Rename to ... (c_language_function): ... this. Include language_function. (push_c_function_context): Adjust accordingly. (pop_c_function_context): Likewise. (mark_c_function_context): Likewise. (current_stmt_tree): Define. * c-semantics.c (begin_stmt_tree): New function. (add_stmt): Likewise. (prune_unused_decls): Likewise. (finish_stmt_tree): Likewise. Move statement-tree facilities from C++ to C front-end. * cp-tree.h (cp_tree_index): Remove CPTI_VOID_ZERO. (void_zero_node): Remove. (stmt_tree): Likewise. (scope_chain): Adjust. (language_function): Rename to cp_language_function. (cp_function_chain): Adjust. (current_stmt_tree): Remove. (last_tree): Likewise. (last_expr_type): Likewise. (struct lang_decl): Adjust. (STMT_IS_FULL_EXPR_P): Remove. (add_tree): Remove. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (walk_tree_fn): Likewise. (walk_stmt_tree): Likewise. * class.c (finish_struct): Replace use of add_tree with add_stmt. * decl.c (mark_stmt_tree): Adjust type. (init_decl_processing): Don't build void_zero_node. (initialize_local_var): Adjust usage of current_stmt_tree. (finish_enum): Use add_stmt, not add_tree. (save_function_data): Adjust use of language_function. (finish_constructor_body): Use add_stmt, not add_tree. (finish_destructor_body): Likewise. (push_cp_function_context): Adjust use of language_function. (pop_cp_function_context): Likewise. (mark_lang_function): Likewise. (mark_cp_function_context): Likewise. * init.c (build_aggr_init): Adjust use of current_stmt_tree. (build_vec_init): Likewise. * semantics.c (SET_LAST_STMT): Remove. (RECHAIN_STMTS): Don't use it. (stmts_are_full_exprs_p): Adjust use of current_stmt_tree. (current_stmt_tree): Define. (add_tree): Remove. (finish_goto_stmt): Use add_stmt, not add_tree. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_then_clause): Likewise. (begin_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (begin_handler): Likewise. (begin_catch_block): Likewise. (begin_compound_stmt): Likewise. (begin_asm_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (add_decl_stmt): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (setup_vtbl_ptr): Likewise. (add_scope_stmt): Likewise. (finish_stmt_expr): Likewise. (prune_unused_decls): Remove. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (prep_stmt): Adjust use of current_stmt_tree. (lang_expand_stmt): Likewise. * tree.c (statement_code_p): Remove. (cp_statement_code_p): New function. (walk_stmt_tree): Remove. (init_tree): Set lang_statement_code_p. From-SVN: r36221
2000-09-07 03:36:11 +02:00
tree x_cdtor_label;
tree x_current_class_ptr;
tree x_current_class_ref;
tree x_eh_spec_block;
tree x_in_charge_parm;
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
tree x_vtt_parm;
tree x_return_value;
Implement return type deduction for normal functions with -std=c++1y. * cp-tree.h (FNDECL_USED_AUTO): New macro. (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P): Remove. (dependent_lambda_return_type_node): Remove. (CPTI_DEPENDENT_LAMBDA_RETURN_TYPE): Remove. (struct language_function): Add x_auto_return_pattern field. (current_function_auto_return_pattern): New. (enum tsubst_flags): Add tf_partial. * decl.c (decls_match): Handle auto return comparison. (duplicate_decls): Adjust error message for auto return. (cxx_init_decl_processing): Remove dependent_lambda_return_type_node. (cp_finish_decl): Don't do auto deduction for functions. (grokdeclarator): Allow auto return without trailing return type in C++1y mode. (check_function_type): Defer checking of deduced return type. (start_preparsed_function): Set current_function_auto_return_pattern. (finish_function): Set deduced return type to void if not previously deduced. * decl2.c (change_return_type): Handle error_mark_node. (mark_used): Always instantiate functions with deduced return type. Complain about use if deduction isn't done. * parser.c (cp_parser_lambda_declarator_opt): Use 'auto' for initial return type. (cp_parser_lambda_body): Don't deduce return type in a template. (cp_parser_conversion_type_id): Allow auto in C++1y. * pt.c (instantiate_class_template_1): Don't mess with LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P. (tsubst_copy_and_build): Likewise. (fn_type_unification, tsubst): Don't reduce the template parm level of 'auto' during deduction. (unify): Compare 'auto' specially. (get_bindings): Change test. (always_instantiate_p): Always instantiate functions with deduced return type. (do_auto_deduction): Handle error_mark_node and lambda context. Don't check for use in initializer. (contains_auto_r): Remove. * search.c (lookup_conversions_r): Handle auto conversion function. * semantics.c (lambda_return_type): Handle null return. Don't mess with dependent_lambda_return_type_node. (apply_deduced_return_type): Rename from apply_lambda_return_type. * typeck.c (merge_types): Handle auto. (check_return_expr): Do auto deduction. * typeck2.c (add_exception_specifier): Fix complain check. From-SVN: r185768
2012-03-24 21:56:08 +01:00
tree x_auto_return_pattern;
BOOL_BITFIELD returns_value : 1;
BOOL_BITFIELD returns_null : 1;
BOOL_BITFIELD returns_abnormally : 1;
BOOL_BITFIELD infinite_loop: 1;
BOOL_BITFIELD x_in_function_try_handler : 1;
BOOL_BITFIELD x_in_base_initializer : 1;
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
/* True if this function can throw an exception. */
BOOL_BITFIELD can_throw : 1;
C++14 constexpr support (minus loops and multiple returns) C++14 constexpr support (minus loops and multiple returns) gcc/ * tree-inline.c (copy_fn): New. * tree-inline.h: Declare it. gcc/cp/ * constexpr.c (use_new_call): New macro. (build_data_member_initialization): Ignore non-mem-inits. (check_constexpr_bind_expr_vars): Remove C++14 checks. (constexpr_fn_retval): Likewise. (check_constexpr_ctor_body): Do nothing in C++14. (massage_constexpr_body): In C++14 only collect mem-inits. (get_function_named_in_call): Handle null CALL_EXPR_FN. (cxx_bind_parameters_in_call): Build bindings in same order as parameters. Don't treat iniviref parms specially in new call mode. (cxx_eval_call_expression): If use_new_call, do constexpr expansion based on DECL_SAVED_TREE rather than the massaged constexpr body. Set up ctx->object from AGGR_INIT_EXPR_SLOT if we don't have one. (is_sub_constant_expr): Don't mess with ctx.ctor here. (cxx_eval_component_reference): A null element means we're mid- initialization. (cxx_eval_store_expression, cxx_eval_increment_expression): New. (cxx_eval_constant_expression): Handle RESULT_DECL, DECL_EXPR, MODIFY_EXPR, STATEMENT_LIST, BIND_EXPR, USING_STMT, PREINCREMENT_EXPR, POSTINCREMENT_EXPR, PREDECREMENT_EXPR, POSTDECREMENT_EXPR. Don't look into DECL_INITIAL of variables in constexpr functions. In new-call mode find parms in the values table. (potential_constant_expression_1): Handle null CALL_EXPR_FN. Handle STATEMENT_LIST, MODIFY_EXPR, MODOP_EXPR, IF_STMT, PREINCREMENT_EXPR, POSTINCREMENT_EXPR, PREDECREMENT_EXPR, POSTDECREMENT_EXPR, BIND_EXPR, WITH_CLEANUP_EXPR, CLEANUP_POINT_EXPR, MUST_NOT_THROW_EXPR, TRY_CATCH_EXPR, EH_SPEC_BLOCK, EXPR_STMT, DECL_EXPR, CASE_LABEL_EXPR, BREAK_STMT, CONTINUE_STMT, USING_STMT, IF_STMT, DO_STMT, FOR_STMT, WHILE_STMT, SWITCH_STMT, ASM_EXPR. (cxx_eval_vec_init_1): Call build_aggr_init_expr. (cxx_eval_indirect_ref): Don't return a CONSTRUCTOR when the caller wants an lvalue. (cxx_eval_outermost_constant_expr): Pull object out of AGGR_INIT_EXPR. (maybe_constant_init): Look through INIT_EXPR. (ensure_literal_type_for_constexpr_object): Set cp_function_chain->invalid_constexpr. * cp-tree.h (struct language_function): Add invalid_constexpr bitfield. * decl.c (start_decl): Set cp_function_chain->invalid_constexpr. (check_for_uninitialized_const_var): Likewise. (maybe_save_function_definition): Check it. * parser.c (cp_parser_jump_statement): Set cp_function_chain->invalid_constexpr. (cp_parser_asm_definition): Likewise. From-SVN: r217663
2014-11-17 19:16:14 +01:00
BOOL_BITFIELD invalid_constexpr : 1;
hash_table<named_label_hasher> *x_named_labels;
cp_binding_level *bindings;
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> *x_local_names;
/* Tracking possibly infinite loops. This is a vec<tree> only because
vec<bool> doesn't work with gtype. */
vec<tree, va_gc> *infinite_loops;
hash_table<cxx_int_tree_map_hasher> *extern_decl_map;
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
};
Makefile.in (CXX_TREE_H): Include function.h. * Makefile.in (CXX_TREE_H): Include function.h. (decl.o): Don't depend on function.h. (decl2.o): Likewise. (typeck.o): Likewise. (init.o): Likewise. (method.o): Likewise. * cp-tree.h: Include function.h. (cp_function): Rename to language_function. Remove next. (cp_function_chain): Make it a macro, not a variable. (push_cp_function_context): Don't declare. (pop_cp_function_context): Likewise. * decl.c: Don't include function.h. (push_cp_function_context): Make it static. Make it suitable for a save_lang_status callback. (pop_cp_function_context): Likewise. (maybe_push_to_top_level): Call push_function_context_to, not push_cp_function_context. (pop_from_top_level): Call pop_function_context_from, not pop_cp_function_context. (init_decl_processing): Set save_lang_status and restore_lang_status. Call push_function_context_to, not push_cp_function_context. (cp_function_chain): Remove. * decl2.c: Don't include function.h. * except.c: Don't include function.h. (start_anon_func): Call push_function_context_to, not push_cp_function_context. (end_anon_func): Call pop_function_context_from, not pop_cp_function_context. * init.c: Don't include function.h. * lex.c (begin_definition_of_inclass_inline): Call push_function_context_to, not push_cp_function_context. (process_next_inline): Call pop_function_context_from, not pop_cp_function_context. * method.c: Don't include function.h. (synthesize_method): Call push_function_context_to, not push_cp_function_context. Call pop_function_context_from, not pop_cp_function_context. * typeck.c: Don't include function.h. From-SVN: r29096
1999-09-04 04:19:29 +02:00
/* The current C++-specific per-function global variables. */
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
#define cp_function_chain (cfun->language)
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
/* In a constructor destructor, the point at which all derived class
destroying/construction has been done. I.e., just before a
constructor returns, or before any base class destroying will be done
in a destructor. */
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
#define cdtor_label cp_function_chain->x_cdtor_label
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
/* When we're processing a member function, current_class_ptr is the
PARM_DECL for the `this' pointer. The current_class_ref is an
expression for `*this'. */
#define current_class_ptr \
(*(cfun && cp_function_chain \
? &cp_function_chain->x_current_class_ptr \
: &scope_chain->x_current_class_ptr))
#define current_class_ref \
(*(cfun && cp_function_chain \
? &cp_function_chain->x_current_class_ref \
: &scope_chain->x_current_class_ref))
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
/* The EH_SPEC_BLOCK for the exception-specifiers for the current
function, if any. */
#define current_eh_spec_block cp_function_chain->x_eh_spec_block
/* The `__in_chrg' parameter for the current function. Only used for
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
constructors and destructors. */
#define current_in_charge_parm cp_function_chain->x_in_charge_parm
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
/* The `__vtt_parm' parameter for the current function. Only used for
constructors and destructors. */
#define current_vtt_parm cp_function_chain->x_vtt_parm
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
/* Set to 0 at beginning of a function definition, set to 1 if
a return statement that specifies a return value is seen. */
#define current_function_returns_value cp_function_chain->returns_value
/* Set to 0 at beginning of a function definition, set to 1 if
a return statement with no argument is seen. */
#define current_function_returns_null cp_function_chain->returns_null
/* Set to 0 at beginning of a function definition, set to 1 if
a call to a noreturn function is seen. */
#define current_function_returns_abnormally \
cp_function_chain->returns_abnormally
/* Set to 0 at beginning of a function definition, set to 1 if we see an
obvious infinite loop. This can have false positives and false
negatives, so it should only be used as a heuristic. */
#define current_function_infinite_loop cp_function_chain->infinite_loop
/* Nonzero if we are processing a base initializer. Zero elsewhere. */
#define in_base_initializer cp_function_chain->x_in_base_initializer
#define in_function_try_handler cp_function_chain->x_in_function_try_handler
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
/* Expression always returned from function, or error_mark_node
otherwise, for use by the automatic named return value optimization. */
#define current_function_return_value \
(cp_function_chain->x_return_value)
Implement return type deduction for normal functions with -std=c++1y. * cp-tree.h (FNDECL_USED_AUTO): New macro. (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P): Remove. (dependent_lambda_return_type_node): Remove. (CPTI_DEPENDENT_LAMBDA_RETURN_TYPE): Remove. (struct language_function): Add x_auto_return_pattern field. (current_function_auto_return_pattern): New. (enum tsubst_flags): Add tf_partial. * decl.c (decls_match): Handle auto return comparison. (duplicate_decls): Adjust error message for auto return. (cxx_init_decl_processing): Remove dependent_lambda_return_type_node. (cp_finish_decl): Don't do auto deduction for functions. (grokdeclarator): Allow auto return without trailing return type in C++1y mode. (check_function_type): Defer checking of deduced return type. (start_preparsed_function): Set current_function_auto_return_pattern. (finish_function): Set deduced return type to void if not previously deduced. * decl2.c (change_return_type): Handle error_mark_node. (mark_used): Always instantiate functions with deduced return type. Complain about use if deduction isn't done. * parser.c (cp_parser_lambda_declarator_opt): Use 'auto' for initial return type. (cp_parser_lambda_body): Don't deduce return type in a template. (cp_parser_conversion_type_id): Allow auto in C++1y. * pt.c (instantiate_class_template_1): Don't mess with LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P. (tsubst_copy_and_build): Likewise. (fn_type_unification, tsubst): Don't reduce the template parm level of 'auto' during deduction. (unify): Compare 'auto' specially. (get_bindings): Change test. (always_instantiate_p): Always instantiate functions with deduced return type. (do_auto_deduction): Handle error_mark_node and lambda context. Don't check for use in initializer. (contains_auto_r): Remove. * search.c (lookup_conversions_r): Handle auto conversion function. * semantics.c (lambda_return_type): Handle null return. Don't mess with dependent_lambda_return_type_node. (apply_deduced_return_type): Rename from apply_lambda_return_type. * typeck.c (merge_types): Handle auto. (check_return_expr): Do auto deduction. * typeck2.c (add_exception_specifier): Fix complain check. From-SVN: r185768
2012-03-24 21:56:08 +01:00
/* A type involving 'auto' to be used for return type deduction. */
#define current_function_auto_return_pattern \
(cp_function_chain->x_auto_return_pattern)
call.c (build_op_delete_call): Do not forget the placement arguments when iterating through mutiple delete... * call.c (build_op_delete_call): Do not forget the placement arguments when iterating through mutiple delete operators. * cp-tree.h (svaed_scope): Remove last_parms. (NEW_DELETE_OPNAME_P): New macro. (last_function_parms): Remove. (do_friend): Adjust prototype. * decl.c (grokparms): Return the PARM_DECLs directly, rather than using last_function_parms. (grokfndecl): Take the PARM_DECLs as an argument, rather than using last_function_parms. (grokdeclarator): Adjust accordingly. Do not form METHOD_TYPEs for class-specific operator new and operator delete. (grok_op_properties): Do not look for allocation functions with METHOD_TYPEs. (start_function): Use DECL_ARGUMENTS instead of last_function_parms. * decl.h (last_function_parms): Do not declare. * decl2.c (grokclassfn): Do not use last_function_parms. * friend.c (do_friend): Remove parmdecls parameter. * name-lookup.c (push_to_top_level): Do not save last_function_parms. (pop_from_top_level): Do not restore it. * pt.c (check_explicit_specialization): Do not adjust last_function_parms. * name-lookup.c (do_local_using_decl): Create a local binding for types brought in via using declarations. * name-lookup.c (lookup_arg_dependent): Handle block-scope function declarations correctly. * semantics.c (finish_id_expression): Correct handling of conversion operators to dependent types. * typeck.c (lookup_destructor): Allow the use of destructors from base classes. * g++.dg/init/placement3.C: New test. * g++.dg/template/spec13.C: New test. * g++.dg/lookup/using11.C: New test. * g++.dg/lookup/koenig3.C: New test. * g++.dg/template/operator2.C: New test. * g++.dg/expr/dtor3.C: New test. * g++.old-deja/g++.brendan/crash15.C: Remove incorrect dg-error marker. * g++.old-deja/g++.law/visibility28.C: Likewise. From-SVN: r79722
2004-03-20 01:18:24 +01:00
/* True if NAME is the IDENTIFIER_NODE for an overloaded "operator
new" or "operator delete". */
#define NEW_DELETE_OPNAME_P(NAME) \
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
((NAME) == cp_operator_id (NEW_EXPR) \
|| (NAME) == cp_operator_id (VEC_NEW_EXPR) \
|| (NAME) == cp_operator_id (DELETE_EXPR) \
|| (NAME) == cp_operator_id (VEC_DELETE_EXPR))
call.c (build_op_delete_call): Do not forget the placement arguments when iterating through mutiple delete... * call.c (build_op_delete_call): Do not forget the placement arguments when iterating through mutiple delete operators. * cp-tree.h (svaed_scope): Remove last_parms. (NEW_DELETE_OPNAME_P): New macro. (last_function_parms): Remove. (do_friend): Adjust prototype. * decl.c (grokparms): Return the PARM_DECLs directly, rather than using last_function_parms. (grokfndecl): Take the PARM_DECLs as an argument, rather than using last_function_parms. (grokdeclarator): Adjust accordingly. Do not form METHOD_TYPEs for class-specific operator new and operator delete. (grok_op_properties): Do not look for allocation functions with METHOD_TYPEs. (start_function): Use DECL_ARGUMENTS instead of last_function_parms. * decl.h (last_function_parms): Do not declare. * decl2.c (grokclassfn): Do not use last_function_parms. * friend.c (do_friend): Remove parmdecls parameter. * name-lookup.c (push_to_top_level): Do not save last_function_parms. (pop_from_top_level): Do not restore it. * pt.c (check_explicit_specialization): Do not adjust last_function_parms. * name-lookup.c (do_local_using_decl): Create a local binding for types brought in via using declarations. * name-lookup.c (lookup_arg_dependent): Handle block-scope function declarations correctly. * semantics.c (finish_id_expression): Correct handling of conversion operators to dependent types. * typeck.c (lookup_destructor): Allow the use of destructors from base classes. * g++.dg/init/placement3.C: New test. * g++.dg/template/spec13.C: New test. * g++.dg/lookup/using11.C: New test. * g++.dg/lookup/koenig3.C: New test. * g++.dg/template/operator2.C: New test. * g++.dg/expr/dtor3.C: New test. * g++.old-deja/g++.brendan/crash15.C: Remove incorrect dg-error marker. * g++.old-deja/g++.law/visibility28.C: Likewise. From-SVN: r79722
2004-03-20 01:18:24 +01:00
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
#define cp_operator_id(CODE) \
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
(operator_name_info[(int) (CODE)].identifier)
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
#define cp_assignment_operator_id(CODE) \
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
(assignment_operator_name_info[(int) (CODE)].identifier)
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
/* In parser.c. */
extern tree cp_literal_operator_id (const char *);
1994-02-24 02:02:37 +01:00
/* TRUE if a tree code represents a statement. */
extern bool statement_code_p[MAX_TREE_CODES];
#define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)]
extend.texi (Java Exceptions): Remove. * doc/extend.texi (Java Exceptions): Remove. (java_interface): Remove. cp/ * cp-tree.h (enum cp_tree_index): Remove CPTI_JAVA_*, CPTI_LANG_NAME_JAVA and CPTI_JCLASS. (java_byte_type_node, java_short_type_node, java_int_type_node, java_long_type_node, java_float_type_node, java_double_type_node, java_char_type_node, java_boolean_type_node, lang_name_java, jclass_node): Remove. (enum languages): Remove lang_java. (TYPE_FOR_JAVA): Remove. (struct lang_type_class): Remove java_interface bit-field. (TYPE_JAVA_INTERFACE): Remove. (pragma_java_exceptions): Remove. (check_java_method, build_java_class_ref): Remove prototypes. * name-lookup.c (pushtag_1): Don't set TYPE_FOR_JAVA. * decl2.c (acceptable_java_type, check_java_method): Remove. (import_export_decl): Remove TYPE_FOR_JAVA handling. (build_java_method_aliases): Remove. (c_parse_final_cleanups): Don't call build_java_method_aliases. (possibly_inlined_p): Don't test pragma_java_exceptions. * init.c (build_new_1): Remove TYPE_FOR_JAVA handling. (build_java_class_ref): Remove. * pt.c (maybe_new_partial_specialization, lookup_template_class_1, instantiate_class_template_1): Don't copy TYPE_FOR_JAVA. * except.c (eh_type_info): Remove java type handling. (decl_is_java_type, choose_personality_routine): Remove. (initialize_handler_parm): Don't call choose_personality_routine. (expand_start_catch_block): Don't handle java types. (build_throw): Likewise. * cp-lang.c (cp_eh_personality): Don't handle pragma_java_exceptions. * typeck.c (structural_comptypes): Don't compare TYPE_FOR_JAVA. * call.c (build_over_call): Don't handle TYPE_JAVA_INTERFACE. (java_iface_lookup_fn): Remove. (build_java_interface_fn_ref): Remove. * tree.c (cxx_attribute_table): Remove java_interface. (handle_java_interface_attribute): Remove. * lex.c (pragma_java_exceptions): Remove. (init_cp_pragma): Don't register GCC java_exceptions pragma. (handle_pragma_java_exceptions): Remove. (retrofit_lang_decl): Don't handle lang_name_java. * method.c (implicitly_declare_fn): Don't handle TYPE_FOR_JAVA. * error.c (language_to_string): Don't handle lang_java. * decl.c (record_builtin_java_type): Remove. (initialize_predefined_identifiers): Remove Java. (cxx_init_decl_processing): Remove java_*_type_node. (cp_finish_decl): Don't handle TYPE_FOR_JAVA. (grokfndecl): Likewise. (check_special_function_return_type): Likewise. (grokdeclarator): Don't set TYPE_FOR_JAVA. (grokparms): Don't handle TYPE_FOR_JAVA. (xref_basetypes): Likewise. (check_function_type): Likewise. (finish_constructor_body): Likewise. * mangle.c (write_builtin_type): Don't handle TYPE_FOR_JAVA and java_*_type_node. (write_bare_function_type): Don't handle TYPE_FOR_JAVA. (write_java_integer_type_codes): Remove. * class.c (add_method): Don't handle TYPE_FOR_JAVA. (add_implicitly_declared_members, determine_key_method, finish_struct_1): Likewise. (push_lang_context): Don't handle lang_name_java. testsuite/ * g++.dg/other/java3.C: Remove. * g++.dg/other/java1.C: Remove. * g++.dg/other/error12.C: Remove. * g++.dg/other/java2.C: Remove. * g++.dg/warn/Wnvdtor.C: Remove. * g++.dg/lookup/java1.C: Remove. * g++.dg/lookup/java2.C: Remove. * g++.dg/ext/pr34829.C: Remove. * g++.dg/ext/java-3.C: Remove. * g++.dg/ext/java-1.C: Remove. * g++.dg/ext/java-2.C: Remove. * g++.old-deja/g++.oliva/dwarf2.C: Remove. From-SVN: r240750
2016-10-04 17:32:31 +02:00
enum languages { lang_c, lang_cplusplus };
1994-02-24 02:02:37 +01:00
/* Macros to make error reporting functions' lives easier. */
#define TYPE_LINKAGE_IDENTIFIER(NODE) \
(TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE)))
1994-02-24 02:02:37 +01:00
#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
/* Nonzero if NODE has no name for linkage purposes. */
#define TYPE_UNNAMED_P(NODE) \
(OVERLOAD_TYPE_P (NODE) && anon_aggrname_p (TYPE_LINKAGE_IDENTIFIER (NODE)))
/* The _DECL for this _TYPE. */
#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
/* Nonzero if T is a type that could resolve to any kind of concrete type
at instantiation time. */
#define WILDCARD_TYPE_P(T) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(TREE_CODE (T) == TEMPLATE_TYPE_PARM \
|| TREE_CODE (T) == TYPENAME_TYPE \
|| TREE_CODE (T) == TYPEOF_TYPE \
|| TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \
|| TREE_CODE (T) == DECLTYPE_TYPE)
/* Nonzero if T is a class (or struct or union) type. Also nonzero
for template type parameters, typename types, and instantiated
template template parameters. Keep these checks in ascending code
order. */
#define MAYBE_CLASS_TYPE_P(T) (WILDCARD_TYPE_P (T) || CLASS_TYPE_P (T))
cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. (TYPE_BINFO): Likewise. (IS_AGGR_TYPE): Tweak. (SET_IS_AGGR_TYPE): New macro. (CLASS_TYPE_P): Tweak. (lang_type): Group mark bitfields together. Remove linenum. (CLASSTYPE_SOURCE_LINE): Remove macro. (CLASSTYPE_MARKED_N): New macro. (SET_CLASSTYPE_MARKED_N): Likewise. (CLEAR_CLASSTYPE_MARKED_N): Likewise. (CLASS_TYPE_MARKED_*): Use them. (SET_CLASSTYPE_MARKED_*): Likewise. (CLEAR_CLASSTYPE_MARKED_*): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well. (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE. * class.c (class_cache_obstack): New variable. (class_cache_firstobj): Likewise. (finish_struct): Don't set CLASSTYPE_SOURCE_LINE. (pushclass): Free the cache, when appropriate. (popclass): Tidy. (maybe_push_cache_obstack): Use class_cache_obstack. * decl.c (include hash.h). (typename_hash): New function. (typename_compare): Likewise. (build_typename_type): Check the hash table to avoid creating duplicates. (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE. (grokdeclarator): Use CLASS_TYPE_P. (xref_basetypes): Likewise. (start_function): Likewise. Don't put current_class_ref on the permanent obstack. * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO and TYPE_TI_ARGS. * lex.c (note_got_semicolon): Use CLASS_TYPE_P. (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated fields for types other than class types. Do clear TYPE_ALIAS_SET for types other than class types, though. * method.c (build_overload_identifier): Use CLASS_TYPE_P and TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * pt.c (process_template_parm): Don't set CLASSTYPE_GOT_SEMICOLON. (lookup_template_class) Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. Coerce arguments on the momentary obstack. (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (instantiate_class_template): Calculate template arguments on the momentary obstack. Tidy. (tsubst_template_arg_vector): Use make_temp_vec. (tsubst_aggr_type): Put template arguments on the momentary obstack. (tsubst_decl): Likewise. (tsubst): Copy the array bounds index to the permanent obstack before building index types. Use new macros. (unify): Use new macros. (do_type_instantiation): Likewise. * search.c (lookup_fnfields_1): Use new macros. (dfs_pushdecls): Build envelopes on the cache obstack. (dfs_compress_decls): Use new macros. (push_class_decls): Build on the cache obstack. * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON. * sign.c (build_signature_pointer_or_reference_type): Use SET_IS_AGGR_TYPE. * tree.c (make_binfo): Check CLASS_TYPE_P. (copy_template_template_parm): Adjust. (make_temp_vec): Use push_expresion_obstack. * typeck.c (complete_type): Use new macros. (comptypes): Likewise. From-SVN: r23686
1998-11-17 13:51:20 +01:00
cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. 2008-03-21 Paolo Carlini <pcarlini@suse.de> * cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. (SET_IS_AGGR_TYPE): Rename to SET_CLASS_TYPE_P. (IS_AGGR_TYPE_CODE): Rename to RECORD_OR_UNION_CODE_P. (PROMOTES_TO_AGGR_TYPE): Remove. (CLASS_TYPE_P, TYPE_NON_AGGREGATE_CLASS): Adjust. * typeck.c (unary_complex_lvalue, build_modify_expr, convert_for_initialization): Adjust. * init.c (is_aggr_type): Remove. (is_class_type): Add. (build_offset_ref, build_new_1, build_vec_delete_1, build_vec_init, build_delete): Adjust. * lex.c (make_aggr_type): Remove. (make_class_type): Add. (cxx_make_type): Adjust. * class.c (finish_struct_1, fixed_type_or_null, is_empty_class): Adjust. * decl.c (build_typename_type, make_typename_type, make_unbound_class_template, cxx_init_decl_processing, check_tag_decl, groktypename, start_decl_1, layout_var_decl, check_initializer, cp_finish_decl, build_ptrmemfunc_type, grokparms, grok_op_properties, xref_tag, check_function_type): Adjust. * call.c (check_dtor_name, standard_conversion, implicit_conversion, add_builtin_candidate, add_builtin_candidates, build_user_type_conversion_1, convert_like_real, build_cxx_call, is_subseq, compare_ics): Adjust. * method.c (use_thunk): Adjust. * rtti.c (build_dynamic_cast_1, create_pseudo_type_info, create_tinfo_types): Adjust. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, convert_from_reference, ocp_convert, build_expr_type_conversion): Adjust. * tree.c (bind_template_template_parm, error_type): Adjust. * dump.c (cp_dump_tree): Adjust. * search.c (lookup_member): Adjust. * friend.c (make_friend_class, do_friend): Adjust. * typeck2.c (store_init_value, process_init_constructor_array, process_init_constructor_record, build_x_arrow, build_m_component_ref, build_functional_cast): Adjust. * pt.c (finish_member_template_decl, process_template_parm, lookup_template_class, tsubst_function_type, tsubst, tsubst_copy_and_build, get_template_base, bt_instantiate_type_proc): Adjust. * semantics.c (begin_class_definition, finish_base_specifier, finish_typeof, cxx_omp_predetermined_sharing, finish_decltype_type): Adjust. * name-lookup.c (constructor_name_p, push_overloaded_decl, do_class_using_decl, lookup_qualified_name, maybe_process_template_type_declaration): Adjust. * decl2.c (grok_array_decl, check_member_template, constrain_class_visibility): Adjust. * parser.c (cp_parser_class_name): Adjust. From-SVN: r133434
2008-03-21 19:56:51 +01:00
/* Set CLASS_TYPE_P for T to VAL. T must be a class, struct, or
union type. */
cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. 2008-03-21 Paolo Carlini <pcarlini@suse.de> * cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. (SET_IS_AGGR_TYPE): Rename to SET_CLASS_TYPE_P. (IS_AGGR_TYPE_CODE): Rename to RECORD_OR_UNION_CODE_P. (PROMOTES_TO_AGGR_TYPE): Remove. (CLASS_TYPE_P, TYPE_NON_AGGREGATE_CLASS): Adjust. * typeck.c (unary_complex_lvalue, build_modify_expr, convert_for_initialization): Adjust. * init.c (is_aggr_type): Remove. (is_class_type): Add. (build_offset_ref, build_new_1, build_vec_delete_1, build_vec_init, build_delete): Adjust. * lex.c (make_aggr_type): Remove. (make_class_type): Add. (cxx_make_type): Adjust. * class.c (finish_struct_1, fixed_type_or_null, is_empty_class): Adjust. * decl.c (build_typename_type, make_typename_type, make_unbound_class_template, cxx_init_decl_processing, check_tag_decl, groktypename, start_decl_1, layout_var_decl, check_initializer, cp_finish_decl, build_ptrmemfunc_type, grokparms, grok_op_properties, xref_tag, check_function_type): Adjust. * call.c (check_dtor_name, standard_conversion, implicit_conversion, add_builtin_candidate, add_builtin_candidates, build_user_type_conversion_1, convert_like_real, build_cxx_call, is_subseq, compare_ics): Adjust. * method.c (use_thunk): Adjust. * rtti.c (build_dynamic_cast_1, create_pseudo_type_info, create_tinfo_types): Adjust. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, convert_from_reference, ocp_convert, build_expr_type_conversion): Adjust. * tree.c (bind_template_template_parm, error_type): Adjust. * dump.c (cp_dump_tree): Adjust. * search.c (lookup_member): Adjust. * friend.c (make_friend_class, do_friend): Adjust. * typeck2.c (store_init_value, process_init_constructor_array, process_init_constructor_record, build_x_arrow, build_m_component_ref, build_functional_cast): Adjust. * pt.c (finish_member_template_decl, process_template_parm, lookup_template_class, tsubst_function_type, tsubst, tsubst_copy_and_build, get_template_base, bt_instantiate_type_proc): Adjust. * semantics.c (begin_class_definition, finish_base_specifier, finish_typeof, cxx_omp_predetermined_sharing, finish_decltype_type): Adjust. * name-lookup.c (constructor_name_p, push_overloaded_decl, do_class_using_decl, lookup_qualified_name, maybe_process_template_type_declaration): Adjust. * decl2.c (grok_array_decl, check_member_template, constrain_class_visibility): Adjust. * parser.c (cp_parser_class_name): Adjust. From-SVN: r133434
2008-03-21 19:56:51 +01:00
#define SET_CLASS_TYPE_P(T, VAL) \
cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. (TYPE_BINFO): Likewise. (IS_AGGR_TYPE): Tweak. (SET_IS_AGGR_TYPE): New macro. (CLASS_TYPE_P): Tweak. (lang_type): Group mark bitfields together. Remove linenum. (CLASSTYPE_SOURCE_LINE): Remove macro. (CLASSTYPE_MARKED_N): New macro. (SET_CLASSTYPE_MARKED_N): Likewise. (CLEAR_CLASSTYPE_MARKED_N): Likewise. (CLASS_TYPE_MARKED_*): Use them. (SET_CLASSTYPE_MARKED_*): Likewise. (CLEAR_CLASSTYPE_MARKED_*): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well. (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE. * class.c (class_cache_obstack): New variable. (class_cache_firstobj): Likewise. (finish_struct): Don't set CLASSTYPE_SOURCE_LINE. (pushclass): Free the cache, when appropriate. (popclass): Tidy. (maybe_push_cache_obstack): Use class_cache_obstack. * decl.c (include hash.h). (typename_hash): New function. (typename_compare): Likewise. (build_typename_type): Check the hash table to avoid creating duplicates. (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE. (grokdeclarator): Use CLASS_TYPE_P. (xref_basetypes): Likewise. (start_function): Likewise. Don't put current_class_ref on the permanent obstack. * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO and TYPE_TI_ARGS. * lex.c (note_got_semicolon): Use CLASS_TYPE_P. (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated fields for types other than class types. Do clear TYPE_ALIAS_SET for types other than class types, though. * method.c (build_overload_identifier): Use CLASS_TYPE_P and TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * pt.c (process_template_parm): Don't set CLASSTYPE_GOT_SEMICOLON. (lookup_template_class) Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. Coerce arguments on the momentary obstack. (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (instantiate_class_template): Calculate template arguments on the momentary obstack. Tidy. (tsubst_template_arg_vector): Use make_temp_vec. (tsubst_aggr_type): Put template arguments on the momentary obstack. (tsubst_decl): Likewise. (tsubst): Copy the array bounds index to the permanent obstack before building index types. Use new macros. (unify): Use new macros. (do_type_instantiation): Likewise. * search.c (lookup_fnfields_1): Use new macros. (dfs_pushdecls): Build envelopes on the cache obstack. (dfs_compress_decls): Use new macros. (push_class_decls): Build on the cache obstack. * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON. * sign.c (build_signature_pointer_or_reference_type): Use SET_IS_AGGR_TYPE. * tree.c (make_binfo): Check CLASS_TYPE_P. (copy_template_template_parm): Adjust. (make_temp_vec): Use push_expresion_obstack. * typeck.c (complete_type): Use new macros. (comptypes): Likewise. From-SVN: r23686
1998-11-17 13:51:20 +01:00
(TYPE_LANG_FLAG_5 (T) = (VAL))
/* Nonzero if T is a class type. Zero for template type parameters,
typename types, and so forth. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define CLASS_TYPE_P(T) \
cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. 2008-03-21 Paolo Carlini <pcarlini@suse.de> * cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. (SET_IS_AGGR_TYPE): Rename to SET_CLASS_TYPE_P. (IS_AGGR_TYPE_CODE): Rename to RECORD_OR_UNION_CODE_P. (PROMOTES_TO_AGGR_TYPE): Remove. (CLASS_TYPE_P, TYPE_NON_AGGREGATE_CLASS): Adjust. * typeck.c (unary_complex_lvalue, build_modify_expr, convert_for_initialization): Adjust. * init.c (is_aggr_type): Remove. (is_class_type): Add. (build_offset_ref, build_new_1, build_vec_delete_1, build_vec_init, build_delete): Adjust. * lex.c (make_aggr_type): Remove. (make_class_type): Add. (cxx_make_type): Adjust. * class.c (finish_struct_1, fixed_type_or_null, is_empty_class): Adjust. * decl.c (build_typename_type, make_typename_type, make_unbound_class_template, cxx_init_decl_processing, check_tag_decl, groktypename, start_decl_1, layout_var_decl, check_initializer, cp_finish_decl, build_ptrmemfunc_type, grokparms, grok_op_properties, xref_tag, check_function_type): Adjust. * call.c (check_dtor_name, standard_conversion, implicit_conversion, add_builtin_candidate, add_builtin_candidates, build_user_type_conversion_1, convert_like_real, build_cxx_call, is_subseq, compare_ics): Adjust. * method.c (use_thunk): Adjust. * rtti.c (build_dynamic_cast_1, create_pseudo_type_info, create_tinfo_types): Adjust. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, convert_from_reference, ocp_convert, build_expr_type_conversion): Adjust. * tree.c (bind_template_template_parm, error_type): Adjust. * dump.c (cp_dump_tree): Adjust. * search.c (lookup_member): Adjust. * friend.c (make_friend_class, do_friend): Adjust. * typeck2.c (store_init_value, process_init_constructor_array, process_init_constructor_record, build_x_arrow, build_m_component_ref, build_functional_cast): Adjust. * pt.c (finish_member_template_decl, process_template_parm, lookup_template_class, tsubst_function_type, tsubst, tsubst_copy_and_build, get_template_base, bt_instantiate_type_proc): Adjust. * semantics.c (begin_class_definition, finish_base_specifier, finish_typeof, cxx_omp_predetermined_sharing, finish_decltype_type): Adjust. * name-lookup.c (constructor_name_p, push_overloaded_decl, do_class_using_decl, lookup_qualified_name, maybe_process_template_type_declaration): Adjust. * decl2.c (grok_array_decl, check_member_template, constrain_class_visibility): Adjust. * parser.c (cp_parser_class_name): Adjust. From-SVN: r133434
2008-03-21 19:56:51 +01:00
(RECORD_OR_UNION_CODE_P (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T))
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
/* Nonzero if T is a class type but not an union. */
#define NON_UNION_CLASS_TYPE_P(T) \
(CLASS_TYPE_P (T) && TREE_CODE (T) != UNION_TYPE)
/* Keep these checks in ascending code order. */
cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. 2008-03-21 Paolo Carlini <pcarlini@suse.de> * cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. (SET_IS_AGGR_TYPE): Rename to SET_CLASS_TYPE_P. (IS_AGGR_TYPE_CODE): Rename to RECORD_OR_UNION_CODE_P. (PROMOTES_TO_AGGR_TYPE): Remove. (CLASS_TYPE_P, TYPE_NON_AGGREGATE_CLASS): Adjust. * typeck.c (unary_complex_lvalue, build_modify_expr, convert_for_initialization): Adjust. * init.c (is_aggr_type): Remove. (is_class_type): Add. (build_offset_ref, build_new_1, build_vec_delete_1, build_vec_init, build_delete): Adjust. * lex.c (make_aggr_type): Remove. (make_class_type): Add. (cxx_make_type): Adjust. * class.c (finish_struct_1, fixed_type_or_null, is_empty_class): Adjust. * decl.c (build_typename_type, make_typename_type, make_unbound_class_template, cxx_init_decl_processing, check_tag_decl, groktypename, start_decl_1, layout_var_decl, check_initializer, cp_finish_decl, build_ptrmemfunc_type, grokparms, grok_op_properties, xref_tag, check_function_type): Adjust. * call.c (check_dtor_name, standard_conversion, implicit_conversion, add_builtin_candidate, add_builtin_candidates, build_user_type_conversion_1, convert_like_real, build_cxx_call, is_subseq, compare_ics): Adjust. * method.c (use_thunk): Adjust. * rtti.c (build_dynamic_cast_1, create_pseudo_type_info, create_tinfo_types): Adjust. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, convert_from_reference, ocp_convert, build_expr_type_conversion): Adjust. * tree.c (bind_template_template_parm, error_type): Adjust. * dump.c (cp_dump_tree): Adjust. * search.c (lookup_member): Adjust. * friend.c (make_friend_class, do_friend): Adjust. * typeck2.c (store_init_value, process_init_constructor_array, process_init_constructor_record, build_x_arrow, build_m_component_ref, build_functional_cast): Adjust. * pt.c (finish_member_template_decl, process_template_parm, lookup_template_class, tsubst_function_type, tsubst, tsubst_copy_and_build, get_template_base, bt_instantiate_type_proc): Adjust. * semantics.c (begin_class_definition, finish_base_specifier, finish_typeof, cxx_omp_predetermined_sharing, finish_decltype_type): Adjust. * name-lookup.c (constructor_name_p, push_overloaded_decl, do_class_using_decl, lookup_qualified_name, maybe_process_template_type_declaration): Adjust. * decl2.c (grok_array_decl, check_member_template, constrain_class_visibility): Adjust. * parser.c (cp_parser_class_name): Adjust. From-SVN: r133434
2008-03-21 19:56:51 +01:00
#define RECORD_OR_UNION_CODE_P(T) \
((T) == RECORD_TYPE || (T) == UNION_TYPE)
#define OVERLOAD_TYPE_P(T) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
1994-02-24 02:02:37 +01:00
/* True if this type is dependent. This predicate is only valid if
TYPE_DEPENDENT_P_VALID is true. */
#define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE)
/* True if dependent_type_p has been called for this type, with the
result that TYPE_DEPENDENT_P is valid. */
#define TYPE_DEPENDENT_P_VALID(NODE) TYPE_LANG_FLAG_6(NODE)
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
/* Nonzero if this type is const-qualified. */
#define CP_TYPE_CONST_P(NODE) \
2001-11-22 03:33:02 +01:00
((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
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
/* Nonzero if this type is volatile-qualified. */
#define CP_TYPE_VOLATILE_P(NODE) \
2001-11-22 03:33:02 +01:00
((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0)
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
/* Nonzero if this type is restrict-qualified. */
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
#define CP_TYPE_RESTRICT_P(NODE) \
2001-11-22 03:33:02 +01:00
((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0)
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
/* Nonzero if this type is const-qualified, but not
volatile-qualified. Other qualifiers are ignored. This macro is
used to test whether or not it is OK to bind an rvalue to a
reference. */
#define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \
2001-11-22 03:33:02 +01:00
((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
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
== TYPE_QUAL_CONST)
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
#define FUNCTION_ARG_CHAIN(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE)))
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
/* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES
which refers to a user-written parameter. */
#define FUNCTION_FIRST_USER_PARMTYPE(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE)))
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
/* Similarly, but for DECL_ARGUMENTS. */
#define FUNCTION_FIRST_USER_PARM(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE))
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
/* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and
ambiguity issues. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define DERIVED_FROM_P(PARENT, TYPE) \
(lookup_base ((TYPE), (PARENT), ba_any, NULL, tf_none) != NULL_TREE)
re PR c++/9283 (__attribute__((visibility ("hidden"))) not supported for class/struct) PR c++/9283 PR c++/15000 * c-common.c (c_common_attribute_table): Allow handle_visibility_attribute to be called for types. (handle_visibility_attribute) When given a type, set the visibility bits on the TYPE_NAME. When given a decl, don't set no_add_attrs so that we can check later whether the attribute was present. Added warning if attribute applied to non class type. * c-decl.c (diagnose_mismatched_decls): Updated rules for merging decls and checking that they are consistent. * common.opt: Added -fvisibility. * c.opt, c-opts.c: Added -fvisibility-inlines-hidden. * c-pragma.h, c-pragma.c: Added handle_pragma_visibility(). * flags.h, tree.h: Added assorted support defines for overall patch * opts.c: Added parsing support for -fvisibility. * tree.c (build_decl): Set visibility for all decls to be whatever is in force at that time. * varasm.c (default_binds_local_p_1): Reworked logic determining when to make a symbol locally bound. * doc/invoke.texi: Added documentation for -fvisibility and -fvisibility-inlines-hidden. PR c++/15000 PR c++/9283 * class.c (check_field_decls): Apply hidden visibility if -fvisibility-inlines-hidden and inlined unless otherwise specified (build_vtable): Set vtable visibility to class visibility. (check_field_decls): Default static member visibility to class visibility. (check_methods): Default method visibility to class visibility. * cp-tree.h: Added CLASSTYPE_VISIBILITY and CLASSTYPE_VISIBILITY_SPECIFIED macro. * decl.c (duplicate_decls): New logic for merging definition decls with declaration decls. Added ignore & warning when non default applied to global operator new or delete. * method.c, optimize.c, rtti.c: Added setting of VISIBILITY_SPECIFIED wherever VISIBILITY was changed * rtti.c (get_tinfo_decl): Set typeinfo visibility to class visibility. (tinfo_base_init): Set typeinfo name visibility to class visibility. PR c++/9283 PR c++/15000 * gcc.dg/visibility-9.c, gcc.dg/visibility-a.c: New tests. * g++.dg/ext/visibility/: New directory. * g++.dg/ext/visibility-1.C, g++.dg/ext/visibility-2.C g++.dg/ext/visibility-3.C, g++.dg/ext/visibility-4.C, g++.dg/ext/visibility-5.C, g++.dg/ext/visibility-6.C, g++.dg/ext/visibility-7.C: Move to g++.dg/ext/visibility/. * g++.dg/ext/visibility/fvisibility.C, g++.dg/ext/visibility/fvisibility-inlines-hidden.C, g++.dg/ext/visibility/fvisibility-override1.C g++.dg/ext/visibility/fvisibility-override2.C g++.dg/ext/visibility/memfuncts.C g++.dg/ext/visibility/noPLT.C g++.dg/ext/visibility/pragma.C g++.dg/ext/visibility/pragma-override1.C g++.dg/ext/visibility/pragma-override2.C g++.dg/ext/visibility/staticmemfuncts.C g++.dg/ext/visibility/virtual.C: New tests. Co-Authored-By: Brian Ryner <bryner@brianryner.com> From-SVN: r85167
2004-07-26 00:52:22 +02:00
/* Gives the visibility specification for a class type. */
#define CLASSTYPE_VISIBILITY(TYPE) \
DECL_VISIBILITY (TYPE_MAIN_DECL (TYPE))
#define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) \
DECL_VISIBILITY_SPECIFIED (TYPE_MAIN_DECL (TYPE))
re PR c++/9283 (__attribute__((visibility ("hidden"))) not supported for class/struct) PR c++/9283 PR c++/15000 * c-common.c (c_common_attribute_table): Allow handle_visibility_attribute to be called for types. (handle_visibility_attribute) When given a type, set the visibility bits on the TYPE_NAME. When given a decl, don't set no_add_attrs so that we can check later whether the attribute was present. Added warning if attribute applied to non class type. * c-decl.c (diagnose_mismatched_decls): Updated rules for merging decls and checking that they are consistent. * common.opt: Added -fvisibility. * c.opt, c-opts.c: Added -fvisibility-inlines-hidden. * c-pragma.h, c-pragma.c: Added handle_pragma_visibility(). * flags.h, tree.h: Added assorted support defines for overall patch * opts.c: Added parsing support for -fvisibility. * tree.c (build_decl): Set visibility for all decls to be whatever is in force at that time. * varasm.c (default_binds_local_p_1): Reworked logic determining when to make a symbol locally bound. * doc/invoke.texi: Added documentation for -fvisibility and -fvisibility-inlines-hidden. PR c++/15000 PR c++/9283 * class.c (check_field_decls): Apply hidden visibility if -fvisibility-inlines-hidden and inlined unless otherwise specified (build_vtable): Set vtable visibility to class visibility. (check_field_decls): Default static member visibility to class visibility. (check_methods): Default method visibility to class visibility. * cp-tree.h: Added CLASSTYPE_VISIBILITY and CLASSTYPE_VISIBILITY_SPECIFIED macro. * decl.c (duplicate_decls): New logic for merging definition decls with declaration decls. Added ignore & warning when non default applied to global operator new or delete. * method.c, optimize.c, rtti.c: Added setting of VISIBILITY_SPECIFIED wherever VISIBILITY was changed * rtti.c (get_tinfo_decl): Set typeinfo visibility to class visibility. (tinfo_base_init): Set typeinfo name visibility to class visibility. PR c++/9283 PR c++/15000 * gcc.dg/visibility-9.c, gcc.dg/visibility-a.c: New tests. * g++.dg/ext/visibility/: New directory. * g++.dg/ext/visibility-1.C, g++.dg/ext/visibility-2.C g++.dg/ext/visibility-3.C, g++.dg/ext/visibility-4.C, g++.dg/ext/visibility-5.C, g++.dg/ext/visibility-6.C, g++.dg/ext/visibility-7.C: Move to g++.dg/ext/visibility/. * g++.dg/ext/visibility/fvisibility.C, g++.dg/ext/visibility/fvisibility-inlines-hidden.C, g++.dg/ext/visibility/fvisibility-override1.C g++.dg/ext/visibility/fvisibility-override2.C g++.dg/ext/visibility/memfuncts.C g++.dg/ext/visibility/noPLT.C g++.dg/ext/visibility/pragma.C g++.dg/ext/visibility/pragma-override1.C g++.dg/ext/visibility/pragma-override2.C g++.dg/ext/visibility/staticmemfuncts.C g++.dg/ext/visibility/virtual.C: New tests. Co-Authored-By: Brian Ryner <bryner@brianryner.com> From-SVN: r85167
2004-07-26 00:52:22 +02:00
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
struct GTY (()) tree_pair_s {
tree purpose;
tree value;
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
typedef tree_pair_s *tree_pair_p;
re PR c++/9283 (__attribute__((visibility ("hidden"))) not supported for class/struct) PR c++/9283 PR c++/15000 * c-common.c (c_common_attribute_table): Allow handle_visibility_attribute to be called for types. (handle_visibility_attribute) When given a type, set the visibility bits on the TYPE_NAME. When given a decl, don't set no_add_attrs so that we can check later whether the attribute was present. Added warning if attribute applied to non class type. * c-decl.c (diagnose_mismatched_decls): Updated rules for merging decls and checking that they are consistent. * common.opt: Added -fvisibility. * c.opt, c-opts.c: Added -fvisibility-inlines-hidden. * c-pragma.h, c-pragma.c: Added handle_pragma_visibility(). * flags.h, tree.h: Added assorted support defines for overall patch * opts.c: Added parsing support for -fvisibility. * tree.c (build_decl): Set visibility for all decls to be whatever is in force at that time. * varasm.c (default_binds_local_p_1): Reworked logic determining when to make a symbol locally bound. * doc/invoke.texi: Added documentation for -fvisibility and -fvisibility-inlines-hidden. PR c++/15000 PR c++/9283 * class.c (check_field_decls): Apply hidden visibility if -fvisibility-inlines-hidden and inlined unless otherwise specified (build_vtable): Set vtable visibility to class visibility. (check_field_decls): Default static member visibility to class visibility. (check_methods): Default method visibility to class visibility. * cp-tree.h: Added CLASSTYPE_VISIBILITY and CLASSTYPE_VISIBILITY_SPECIFIED macro. * decl.c (duplicate_decls): New logic for merging definition decls with declaration decls. Added ignore & warning when non default applied to global operator new or delete. * method.c, optimize.c, rtti.c: Added setting of VISIBILITY_SPECIFIED wherever VISIBILITY was changed * rtti.c (get_tinfo_decl): Set typeinfo visibility to class visibility. (tinfo_base_init): Set typeinfo name visibility to class visibility. PR c++/9283 PR c++/15000 * gcc.dg/visibility-9.c, gcc.dg/visibility-a.c: New tests. * g++.dg/ext/visibility/: New directory. * g++.dg/ext/visibility-1.C, g++.dg/ext/visibility-2.C g++.dg/ext/visibility-3.C, g++.dg/ext/visibility-4.C, g++.dg/ext/visibility-5.C, g++.dg/ext/visibility-6.C, g++.dg/ext/visibility-7.C: Move to g++.dg/ext/visibility/. * g++.dg/ext/visibility/fvisibility.C, g++.dg/ext/visibility/fvisibility-inlines-hidden.C, g++.dg/ext/visibility/fvisibility-override1.C g++.dg/ext/visibility/fvisibility-override2.C g++.dg/ext/visibility/memfuncts.C g++.dg/ext/visibility/noPLT.C g++.dg/ext/visibility/pragma.C g++.dg/ext/visibility/pragma-override1.C g++.dg/ext/visibility/pragma-override2.C g++.dg/ext/visibility/staticmemfuncts.C g++.dg/ext/visibility/virtual.C: New tests. Co-Authored-By: Brian Ryner <bryner@brianryner.com> From-SVN: r85167
2004-07-26 00:52:22 +02:00
/* This is a few header flags for 'struct lang_type'. Actually,
all but the first are used only for lang_type_class; they
are put in this structure to save space. */
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) lang_type_header {
BOOL_BITFIELD is_lang_type_class : 1;
BOOL_BITFIELD has_type_conversion : 1;
BOOL_BITFIELD has_copy_ctor : 1;
BOOL_BITFIELD has_default_ctor : 1;
BOOL_BITFIELD const_needs_init : 1;
BOOL_BITFIELD ref_needs_init : 1;
BOOL_BITFIELD has_const_copy_assign : 1;
BOOL_BITFIELD spare : 1;
};
cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. (TYPE_BINFO): Likewise. (IS_AGGR_TYPE): Tweak. (SET_IS_AGGR_TYPE): New macro. (CLASS_TYPE_P): Tweak. (lang_type): Group mark bitfields together. Remove linenum. (CLASSTYPE_SOURCE_LINE): Remove macro. (CLASSTYPE_MARKED_N): New macro. (SET_CLASSTYPE_MARKED_N): Likewise. (CLEAR_CLASSTYPE_MARKED_N): Likewise. (CLASS_TYPE_MARKED_*): Use them. (SET_CLASSTYPE_MARKED_*): Likewise. (CLEAR_CLASSTYPE_MARKED_*): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well. (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE. * class.c (class_cache_obstack): New variable. (class_cache_firstobj): Likewise. (finish_struct): Don't set CLASSTYPE_SOURCE_LINE. (pushclass): Free the cache, when appropriate. (popclass): Tidy. (maybe_push_cache_obstack): Use class_cache_obstack. * decl.c (include hash.h). (typename_hash): New function. (typename_compare): Likewise. (build_typename_type): Check the hash table to avoid creating duplicates. (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE. (grokdeclarator): Use CLASS_TYPE_P. (xref_basetypes): Likewise. (start_function): Likewise. Don't put current_class_ref on the permanent obstack. * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO and TYPE_TI_ARGS. * lex.c (note_got_semicolon): Use CLASS_TYPE_P. (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated fields for types other than class types. Do clear TYPE_ALIAS_SET for types other than class types, though. * method.c (build_overload_identifier): Use CLASS_TYPE_P and TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * pt.c (process_template_parm): Don't set CLASSTYPE_GOT_SEMICOLON. (lookup_template_class) Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. Coerce arguments on the momentary obstack. (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (instantiate_class_template): Calculate template arguments on the momentary obstack. Tidy. (tsubst_template_arg_vector): Use make_temp_vec. (tsubst_aggr_type): Put template arguments on the momentary obstack. (tsubst_decl): Likewise. (tsubst): Copy the array bounds index to the permanent obstack before building index types. Use new macros. (unify): Use new macros. (do_type_instantiation): Likewise. * search.c (lookup_fnfields_1): Use new macros. (dfs_pushdecls): Build envelopes on the cache obstack. (dfs_compress_decls): Use new macros. (push_class_decls): Build on the cache obstack. * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON. * sign.c (build_signature_pointer_or_reference_type): Use SET_IS_AGGR_TYPE. * tree.c (make_binfo): Check CLASS_TYPE_P. (copy_template_template_parm): Adjust. (make_temp_vec): Use push_expresion_obstack. * typeck.c (complete_type): Use new macros. (comptypes): Likewise. From-SVN: r23686
1998-11-17 13:51:20 +01:00
/* This structure provides additional information above and beyond
what is provide in the ordinary tree_type. In the past, we used it
for the types of class types, template parameters types, typename
types, and so forth. However, there can be many (tens to hundreds
of thousands) of template parameter types in a compilation, and
there's no need for this additional information in that case.
Therefore, we now use this data structure only for class types.
In the past, it was thought that there would be relatively few
class types. However, in the presence of heavy use of templates,
many (i.e., thousands) of classes can easily be generated.
Therefore, we should endeavor to keep the size of this structure to
a minimum. */
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) lang_type_class {
struct lang_type_header h;
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
unsigned char align;
unsigned has_mutable : 1;
unsigned com_interface : 1;
unsigned non_pod_class : 1;
unsigned nearly_empty_p : 1;
pt.c (instantiate_decl): Abort if we see a member constant instantiation that doesn't already have its... * pt.c (instantiate_decl): Abort if we see a member constant instantiation that doesn't already have its initializer. Downgrade explicit instantiation without definition to pedwarn. * cp-tree.h (DECL_TINFO_FN_P, SET_DECL_TINFO_FN_P): Remove. * class.c (build_vtable_entry): Don't check DECL_TINFO_FN_P. (import_export_decl): Check tinfo_decl_p, not DECL_TINFO_FN_P. * cp-tree.h (CLASSTYPE_VTABLE_NEEDS_WRITING): Remove. (pending_vtables): Remove. * decl2.c (pending_vtables): Remove. (import_export_vtable): Use CLASSTYPE_INTERFACE_ONLY, not CLASSTYPE_VTABLE_NEEDS_WRITING. (import_export_class): Likewise. (init_decl2): Don't mark pending_vtables. * lex.c (handle_pragma_vtable): Just sorry. * pt.c (instantiate_class_template): Don't mess with CLASSTYPE_VTABLE_NEEDS_WRITING. (mark_class_instantiated): Likewise. * ptree.c (print_lang_type): Don't print it. * semantics.c (begin_class_definition): Don't set it. * pt.c (template_tail): Replace with last_pending_template. (maybe_templates, maybe_template_tail): Remove. (add_pending_template): Adjust. (instantiate_pending_templates): Adjust. * cp-tree.h (struct saved_scope): Remove lang_stack field. (current_lang_stack): Remove. * decl.c (maybe_push_to_top_level): Don't initialize it. (duplicate_decls): Use current_lang_depth. (xref_basetypes): Likewise. * class.c (current_lang_depth): New fn. (push_lang_context): Use more varray functionality. (pop_lang_context): Likewise. From-SVN: r40724
2001-03-22 01:55:13 +01:00
unsigned user_align : 1;
unsigned has_copy_assign : 1;
unsigned has_new : 1;
unsigned has_array_new : 1;
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
unsigned gets_delete : 2;
unsigned interface_only : 1;
unsigned interface_unknown : 1;
cp-tree.h (lang_type_class): Remove is_partial_instantiation. * cp-tree.h (lang_type_class): Remove is_partial_instantiation. (PARTIAL_INSTANTIATION_P): Remove. (IMPLICIT_TYPENAME_P): Likewise. (IMPLICIT_TYPENAME_TYPE_DECL_P): Likewise. (build_typename_type): Remove declaration. (parmlist_is_exprlist): Likewise. * decl.c (build_typename_type): Make it static, remove third parameter. (push_class_binding): Don't do implicit typename stuff. (make_typename_type): Likewise. (lookup_name_real): Likewise. (grokdeclarator): Don't try to convert declarations into initializations. Don't do implicit typename stuff. (parmlist_is_exprlist): Remove. (xref_basetypes): Simplify. * decl2.c (grokfield): Don't try to convert declarations into initializations. (build_anon_union_vars): Do this while processing templates, too. (finish_anon_union): Likewise. * error.c (dump_type): Remove implicit typename handling. * parser.c (cp_parser_diagnose_invalid_type_name): New method. (cp_parser_primary_expression): Correct handling of names not found by unqualified name lookup in templates. (cp_parser_nested_name_specifier_opt): Avoid checking dependency of types when possible. (cp_parser_simple_declaration): Complain intelligently about some invalid declarations. (cp_parser_member_declaration): Likewise. (cp_parser_constructor_declarator_p): Don't check when we're in a function scope. * pt.c (instantiate_class_template): Remove PARTIAL_INSTANTIATION_P gunk. * search.c (lookup_field_r): Don't build implicit typenames. (marked_pushdecls_p): Don't enter dependent base types. (unmarked_pushdecls_p): Likewise. * semantics.c (begin_class_definition): Remove implicit typename stuff. * config/locale/gnu/messages_members.h: Use this-> to refer to unqualified members of base clasess. * config/locale/ieee_1003.1-2001/codecvt_specializations.h: Likewise. * include/bits/codecvt.h: Likewise. * include/bits/deque.tcc: Likewise. * include/bits/fstream.tcc: Likewise. * include/bits/istream.tcc: Likewise. * include/bits/list.tcc: Likewise. * include/bits/locale_facets.h: Likewise. * include/bits/ostream.tcc: Likewise. * include/bits/sstream.tcc: Likewise. * include/bits/stl_bvector.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_tree.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/vector.tcc: Likewise. * include/ext/ropeimpl.h: Likewise. * include/ext/stdio_filebuf.h: Likewise. * include/ext/stl_rope.h: Likewise. * include/std/std_fstream.h: Likewise. * include/std/std_sstream.h: Likewise. Co-Authored-By: Jeffrey Oldham <oldham@codesourcery.com> From-SVN: r61403
2003-01-16 21:30:50 +01:00
unsigned contains_empty_class_p : 1;
re PR c++/11703 (Problem with using enum in placement delete) PR c++/11703 * call.c (type_passed_as): Use TYPE_SIZE, not TYPE_PRECISION to determine whether or not to promote types. (convert_for_arg_passing): Likewise. * decl2.c (cp_build_parm_decl): Do not set DECL_ARG_TYPE in templates. * pt.c (tsubst_decl): Do not expect it to be set. PR c++/9512 PR c++/10923 * cp-tree.h (check_elaborated_type_specifier): Declare. (handle_class_head): Remove. (note_got_semicolon): Likewise. (note_list_got_semicolon): Likewise. (finish_class_definition): Likewise. * decl.c (check_elaborated_type_specifier): Make it public. Robustify. (handle_class_head): Remove. * parser.c (cp_parser_elaborated_type_specifier): Use check_elaborated_type_specifier. (cp_parser_class_specifier): Do not call finish_class_definition. (cp_parser_class_head): Or handle_class_head. Check for over-qualified names. * semantics.c (finish_class_definition): Remove. * parser.c (cp_parser_check_for_definition_in_return_type): New function. (cp_parser_simple_declaration): Adjust call to cp_parser_init_declarator. (cp_parser_decl_specifier_seq): Change type of declares_class_or_enum parameter. (cp_parser_explicit_instantiation): Adjust accordingly. (cp_parser_type_specifier): Change type of declares_class_or_enum parameter. (cp_parser_init_declarator): Add declares_class_or_enum parameter. (cp_parser_parameter_declaration): Adjust call to cp_parser_decl_specifier_seq. (cp_parser_function_definition): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_single_declaration): Likewise. * cp-tree.h (lang_type_class): Remove has_call_overloaded, has_array_ref_overloaded, has_arrow_overloaded, and got_semicolon. (TYPE_OVERLOADS_CALL_EXPR): Remove. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (CLASSTYPE_GOT_SEMICOLON): Likewise. * class.c (check_bases): Do not set them. (finish_struct_1): Likewise. * decl.c (cp_finish_decl): Do not set CLASSTYPE_GOT_SEMICOLON. (build_ptrmemfunc_type): Likewise. (grok_op_properties): Do not set TYPE_OVERLOADS_*. (start_function): Do not check CLASSTYPE_GOT_SEMICOLON. * decl2.c (grokfield): Do not set CLASSTYPE_GOT_SEMICOLON. * lex.c (note_got_semicolon): Remove. (note_list_got_semicolon): Likewise. * parser.c (cp_parser_simple_declaration): Do not call note_list_got_semicolon. * pt.c (list_eq): Remove. (lookup_template_class): Do not set CLASSTYPE_GOT_SEMICOLON. (instantiate_class_template): Do not set TYPE_OVERLOADS*. (instantiate_class_template): Do not set CLASSTYPE_GOT_SEMICOLON. * ptree.c (cxx_print_type): Do not print them. * semantics.c (finish_member_class_template): Do not call note_list_got_semicolon. * g++.dg/parse/ret-type2.C: New test. PR c++/11703 * g++.dg/init/new8.C: New test. PR c++/10923 * g++.dg/parse/typedef5.C: New test. PR c++/9512 * g++.dg/parse/qualified2.C: New test. * g++.old-deja/g++.other/decl5.C: Mark one more instance of invalid code. From-SVN: r70391
2003-08-13 00:26:25 +02:00
unsigned anon_aggr : 1;
unsigned non_zero_init : 1;
unsigned empty_p : 1;
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
unsigned vec_new_uses_cookie : 1;
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
unsigned declared_class : 1;
unsigned diamond_shaped : 1;
unsigned repeated_base : 1;
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
unsigned being_defined : 1;
unsigned debug_requested : 1;
re PR c++/11703 (Problem with using enum in placement delete) PR c++/11703 * call.c (type_passed_as): Use TYPE_SIZE, not TYPE_PRECISION to determine whether or not to promote types. (convert_for_arg_passing): Likewise. * decl2.c (cp_build_parm_decl): Do not set DECL_ARG_TYPE in templates. * pt.c (tsubst_decl): Do not expect it to be set. PR c++/9512 PR c++/10923 * cp-tree.h (check_elaborated_type_specifier): Declare. (handle_class_head): Remove. (note_got_semicolon): Likewise. (note_list_got_semicolon): Likewise. (finish_class_definition): Likewise. * decl.c (check_elaborated_type_specifier): Make it public. Robustify. (handle_class_head): Remove. * parser.c (cp_parser_elaborated_type_specifier): Use check_elaborated_type_specifier. (cp_parser_class_specifier): Do not call finish_class_definition. (cp_parser_class_head): Or handle_class_head. Check for over-qualified names. * semantics.c (finish_class_definition): Remove. * parser.c (cp_parser_check_for_definition_in_return_type): New function. (cp_parser_simple_declaration): Adjust call to cp_parser_init_declarator. (cp_parser_decl_specifier_seq): Change type of declares_class_or_enum parameter. (cp_parser_explicit_instantiation): Adjust accordingly. (cp_parser_type_specifier): Change type of declares_class_or_enum parameter. (cp_parser_init_declarator): Add declares_class_or_enum parameter. (cp_parser_parameter_declaration): Adjust call to cp_parser_decl_specifier_seq. (cp_parser_function_definition): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_single_declaration): Likewise. * cp-tree.h (lang_type_class): Remove has_call_overloaded, has_array_ref_overloaded, has_arrow_overloaded, and got_semicolon. (TYPE_OVERLOADS_CALL_EXPR): Remove. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (CLASSTYPE_GOT_SEMICOLON): Likewise. * class.c (check_bases): Do not set them. (finish_struct_1): Likewise. * decl.c (cp_finish_decl): Do not set CLASSTYPE_GOT_SEMICOLON. (build_ptrmemfunc_type): Likewise. (grok_op_properties): Do not set TYPE_OVERLOADS_*. (start_function): Do not check CLASSTYPE_GOT_SEMICOLON. * decl2.c (grokfield): Do not set CLASSTYPE_GOT_SEMICOLON. * lex.c (note_got_semicolon): Remove. (note_list_got_semicolon): Likewise. * parser.c (cp_parser_simple_declaration): Do not call note_list_got_semicolon. * pt.c (list_eq): Remove. (lookup_template_class): Do not set CLASSTYPE_GOT_SEMICOLON. (instantiate_class_template): Do not set TYPE_OVERLOADS*. (instantiate_class_template): Do not set CLASSTYPE_GOT_SEMICOLON. * ptree.c (cxx_print_type): Do not print them. * semantics.c (finish_member_class_template): Do not call note_list_got_semicolon. * g++.dg/parse/ret-type2.C: New test. PR c++/11703 * g++.dg/init/new8.C: New test. PR c++/10923 * g++.dg/parse/typedef5.C: New test. PR c++/9512 * g++.dg/parse/qualified2.C: New test. * g++.old-deja/g++.other/decl5.C: Mark one more instance of invalid code. From-SVN: r70391
2003-08-13 00:26:25 +02:00
unsigned fields_readonly : 1;
extend.texi (Java Exceptions): Remove. * doc/extend.texi (Java Exceptions): Remove. (java_interface): Remove. cp/ * cp-tree.h (enum cp_tree_index): Remove CPTI_JAVA_*, CPTI_LANG_NAME_JAVA and CPTI_JCLASS. (java_byte_type_node, java_short_type_node, java_int_type_node, java_long_type_node, java_float_type_node, java_double_type_node, java_char_type_node, java_boolean_type_node, lang_name_java, jclass_node): Remove. (enum languages): Remove lang_java. (TYPE_FOR_JAVA): Remove. (struct lang_type_class): Remove java_interface bit-field. (TYPE_JAVA_INTERFACE): Remove. (pragma_java_exceptions): Remove. (check_java_method, build_java_class_ref): Remove prototypes. * name-lookup.c (pushtag_1): Don't set TYPE_FOR_JAVA. * decl2.c (acceptable_java_type, check_java_method): Remove. (import_export_decl): Remove TYPE_FOR_JAVA handling. (build_java_method_aliases): Remove. (c_parse_final_cleanups): Don't call build_java_method_aliases. (possibly_inlined_p): Don't test pragma_java_exceptions. * init.c (build_new_1): Remove TYPE_FOR_JAVA handling. (build_java_class_ref): Remove. * pt.c (maybe_new_partial_specialization, lookup_template_class_1, instantiate_class_template_1): Don't copy TYPE_FOR_JAVA. * except.c (eh_type_info): Remove java type handling. (decl_is_java_type, choose_personality_routine): Remove. (initialize_handler_parm): Don't call choose_personality_routine. (expand_start_catch_block): Don't handle java types. (build_throw): Likewise. * cp-lang.c (cp_eh_personality): Don't handle pragma_java_exceptions. * typeck.c (structural_comptypes): Don't compare TYPE_FOR_JAVA. * call.c (build_over_call): Don't handle TYPE_JAVA_INTERFACE. (java_iface_lookup_fn): Remove. (build_java_interface_fn_ref): Remove. * tree.c (cxx_attribute_table): Remove java_interface. (handle_java_interface_attribute): Remove. * lex.c (pragma_java_exceptions): Remove. (init_cp_pragma): Don't register GCC java_exceptions pragma. (handle_pragma_java_exceptions): Remove. (retrofit_lang_decl): Don't handle lang_name_java. * method.c (implicitly_declare_fn): Don't handle TYPE_FOR_JAVA. * error.c (language_to_string): Don't handle lang_java. * decl.c (record_builtin_java_type): Remove. (initialize_predefined_identifiers): Remove Java. (cxx_init_decl_processing): Remove java_*_type_node. (cp_finish_decl): Don't handle TYPE_FOR_JAVA. (grokfndecl): Likewise. (check_special_function_return_type): Likewise. (grokdeclarator): Don't set TYPE_FOR_JAVA. (grokparms): Don't handle TYPE_FOR_JAVA. (xref_basetypes): Likewise. (check_function_type): Likewise. (finish_constructor_body): Likewise. * mangle.c (write_builtin_type): Don't handle TYPE_FOR_JAVA and java_*_type_node. (write_bare_function_type): Don't handle TYPE_FOR_JAVA. (write_java_integer_type_codes): Remove. * class.c (add_method): Don't handle TYPE_FOR_JAVA. (add_implicitly_declared_members, determine_key_method, finish_struct_1): Likewise. (push_lang_context): Don't handle lang_name_java. testsuite/ * g++.dg/other/java3.C: Remove. * g++.dg/other/java1.C: Remove. * g++.dg/other/error12.C: Remove. * g++.dg/other/java2.C: Remove. * g++.dg/warn/Wnvdtor.C: Remove. * g++.dg/lookup/java1.C: Remove. * g++.dg/lookup/java2.C: Remove. * g++.dg/ext/pr34829.C: Remove. * g++.dg/ext/java-3.C: Remove. * g++.dg/ext/java-1.C: Remove. * g++.dg/ext/java-2.C: Remove. * g++.old-deja/g++.oliva/dwarf2.C: Remove. From-SVN: r240750
2016-10-04 17:32:31 +02:00
unsigned ptrmemfunc_flag : 1;
unsigned use_template : 2;
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
unsigned was_anonymous : 1;
unsigned lazy_default_ctor : 1;
unsigned lazy_copy_ctor : 1;
unsigned lazy_copy_assign : 1;
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
unsigned lazy_destructor : 1;
unsigned has_const_copy_ctor : 1;
extend.texi (Java Exceptions): Remove. * doc/extend.texi (Java Exceptions): Remove. (java_interface): Remove. cp/ * cp-tree.h (enum cp_tree_index): Remove CPTI_JAVA_*, CPTI_LANG_NAME_JAVA and CPTI_JCLASS. (java_byte_type_node, java_short_type_node, java_int_type_node, java_long_type_node, java_float_type_node, java_double_type_node, java_char_type_node, java_boolean_type_node, lang_name_java, jclass_node): Remove. (enum languages): Remove lang_java. (TYPE_FOR_JAVA): Remove. (struct lang_type_class): Remove java_interface bit-field. (TYPE_JAVA_INTERFACE): Remove. (pragma_java_exceptions): Remove. (check_java_method, build_java_class_ref): Remove prototypes. * name-lookup.c (pushtag_1): Don't set TYPE_FOR_JAVA. * decl2.c (acceptable_java_type, check_java_method): Remove. (import_export_decl): Remove TYPE_FOR_JAVA handling. (build_java_method_aliases): Remove. (c_parse_final_cleanups): Don't call build_java_method_aliases. (possibly_inlined_p): Don't test pragma_java_exceptions. * init.c (build_new_1): Remove TYPE_FOR_JAVA handling. (build_java_class_ref): Remove. * pt.c (maybe_new_partial_specialization, lookup_template_class_1, instantiate_class_template_1): Don't copy TYPE_FOR_JAVA. * except.c (eh_type_info): Remove java type handling. (decl_is_java_type, choose_personality_routine): Remove. (initialize_handler_parm): Don't call choose_personality_routine. (expand_start_catch_block): Don't handle java types. (build_throw): Likewise. * cp-lang.c (cp_eh_personality): Don't handle pragma_java_exceptions. * typeck.c (structural_comptypes): Don't compare TYPE_FOR_JAVA. * call.c (build_over_call): Don't handle TYPE_JAVA_INTERFACE. (java_iface_lookup_fn): Remove. (build_java_interface_fn_ref): Remove. * tree.c (cxx_attribute_table): Remove java_interface. (handle_java_interface_attribute): Remove. * lex.c (pragma_java_exceptions): Remove. (init_cp_pragma): Don't register GCC java_exceptions pragma. (handle_pragma_java_exceptions): Remove. (retrofit_lang_decl): Don't handle lang_name_java. * method.c (implicitly_declare_fn): Don't handle TYPE_FOR_JAVA. * error.c (language_to_string): Don't handle lang_java. * decl.c (record_builtin_java_type): Remove. (initialize_predefined_identifiers): Remove Java. (cxx_init_decl_processing): Remove java_*_type_node. (cp_finish_decl): Don't handle TYPE_FOR_JAVA. (grokfndecl): Likewise. (check_special_function_return_type): Likewise. (grokdeclarator): Don't set TYPE_FOR_JAVA. (grokparms): Don't handle TYPE_FOR_JAVA. (xref_basetypes): Likewise. (check_function_type): Likewise. (finish_constructor_body): Likewise. * mangle.c (write_builtin_type): Don't handle TYPE_FOR_JAVA and java_*_type_node. (write_bare_function_type): Don't handle TYPE_FOR_JAVA. (write_java_integer_type_codes): Remove. * class.c (add_method): Don't handle TYPE_FOR_JAVA. (add_implicitly_declared_members, determine_key_method, finish_struct_1): Likewise. (push_lang_context): Don't handle lang_name_java. testsuite/ * g++.dg/other/java3.C: Remove. * g++.dg/other/java1.C: Remove. * g++.dg/other/error12.C: Remove. * g++.dg/other/java2.C: Remove. * g++.dg/warn/Wnvdtor.C: Remove. * g++.dg/lookup/java1.C: Remove. * g++.dg/lookup/java2.C: Remove. * g++.dg/ext/pr34829.C: Remove. * g++.dg/ext/java-3.C: Remove. * g++.dg/ext/java-1.C: Remove. * g++.dg/ext/java-2.C: Remove. * g++.old-deja/g++.oliva/dwarf2.C: Remove. From-SVN: r240750
2016-10-04 17:32:31 +02:00
unsigned has_complex_copy_ctor : 1;
unsigned has_complex_copy_assign : 1;
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
unsigned non_aggregate : 1;
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
unsigned has_complex_dflt : 1;
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
unsigned has_list_ctor : 1;
unsigned non_std_layout : 1;
unsigned is_literal : 1;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
unsigned lazy_move_ctor : 1;
extend.texi (Java Exceptions): Remove. * doc/extend.texi (Java Exceptions): Remove. (java_interface): Remove. cp/ * cp-tree.h (enum cp_tree_index): Remove CPTI_JAVA_*, CPTI_LANG_NAME_JAVA and CPTI_JCLASS. (java_byte_type_node, java_short_type_node, java_int_type_node, java_long_type_node, java_float_type_node, java_double_type_node, java_char_type_node, java_boolean_type_node, lang_name_java, jclass_node): Remove. (enum languages): Remove lang_java. (TYPE_FOR_JAVA): Remove. (struct lang_type_class): Remove java_interface bit-field. (TYPE_JAVA_INTERFACE): Remove. (pragma_java_exceptions): Remove. (check_java_method, build_java_class_ref): Remove prototypes. * name-lookup.c (pushtag_1): Don't set TYPE_FOR_JAVA. * decl2.c (acceptable_java_type, check_java_method): Remove. (import_export_decl): Remove TYPE_FOR_JAVA handling. (build_java_method_aliases): Remove. (c_parse_final_cleanups): Don't call build_java_method_aliases. (possibly_inlined_p): Don't test pragma_java_exceptions. * init.c (build_new_1): Remove TYPE_FOR_JAVA handling. (build_java_class_ref): Remove. * pt.c (maybe_new_partial_specialization, lookup_template_class_1, instantiate_class_template_1): Don't copy TYPE_FOR_JAVA. * except.c (eh_type_info): Remove java type handling. (decl_is_java_type, choose_personality_routine): Remove. (initialize_handler_parm): Don't call choose_personality_routine. (expand_start_catch_block): Don't handle java types. (build_throw): Likewise. * cp-lang.c (cp_eh_personality): Don't handle pragma_java_exceptions. * typeck.c (structural_comptypes): Don't compare TYPE_FOR_JAVA. * call.c (build_over_call): Don't handle TYPE_JAVA_INTERFACE. (java_iface_lookup_fn): Remove. (build_java_interface_fn_ref): Remove. * tree.c (cxx_attribute_table): Remove java_interface. (handle_java_interface_attribute): Remove. * lex.c (pragma_java_exceptions): Remove. (init_cp_pragma): Don't register GCC java_exceptions pragma. (handle_pragma_java_exceptions): Remove. (retrofit_lang_decl): Don't handle lang_name_java. * method.c (implicitly_declare_fn): Don't handle TYPE_FOR_JAVA. * error.c (language_to_string): Don't handle lang_java. * decl.c (record_builtin_java_type): Remove. (initialize_predefined_identifiers): Remove Java. (cxx_init_decl_processing): Remove java_*_type_node. (cp_finish_decl): Don't handle TYPE_FOR_JAVA. (grokfndecl): Likewise. (check_special_function_return_type): Likewise. (grokdeclarator): Don't set TYPE_FOR_JAVA. (grokparms): Don't handle TYPE_FOR_JAVA. (xref_basetypes): Likewise. (check_function_type): Likewise. (finish_constructor_body): Likewise. * mangle.c (write_builtin_type): Don't handle TYPE_FOR_JAVA and java_*_type_node. (write_bare_function_type): Don't handle TYPE_FOR_JAVA. (write_java_integer_type_codes): Remove. * class.c (add_method): Don't handle TYPE_FOR_JAVA. (add_implicitly_declared_members, determine_key_method, finish_struct_1): Likewise. (push_lang_context): Don't handle lang_name_java. testsuite/ * g++.dg/other/java3.C: Remove. * g++.dg/other/java1.C: Remove. * g++.dg/other/error12.C: Remove. * g++.dg/other/java2.C: Remove. * g++.dg/warn/Wnvdtor.C: Remove. * g++.dg/lookup/java1.C: Remove. * g++.dg/lookup/java2.C: Remove. * g++.dg/ext/pr34829.C: Remove. * g++.dg/ext/java-3.C: Remove. * g++.dg/ext/java-1.C: Remove. * g++.dg/ext/java-2.C: Remove. * g++.old-deja/g++.oliva/dwarf2.C: Remove. From-SVN: r240750
2016-10-04 17:32:31 +02:00
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
unsigned lazy_move_assign : 1;
unsigned has_complex_move_ctor : 1;
unsigned has_complex_move_assign : 1;
unsigned has_constexpr_ctor : 1;
unsigned unique_obj_representations : 1;
unsigned unique_obj_representations_set : 1;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
so, make sure to copy it in instantiate_class_template! */
/* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or
cp-tree.h (cp_function): Move here, from decl.c. * cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
1999-09-02 21:14:06 +02:00
remove a flag. */
unsigned dummy : 2;
Allow indirect primary bases. * cp-tree.h (struct lang_type): Remove vfield_parent. Add primary_base. (CLASSTYPE_VFIELD_PARENT): Remove. (CLASSTYPE_PRIMARY_BINFO): Reimplement. (BINFO_PRIMARY_BINFO): Remove. (CLASSTYPE_HAS_PRIMARY_BASE_P): Reimplement. (BINFO_VBASE_PRIMARY_P): Likewise. (BINFO_PRIMARY_BASE_OF): New macro. (BINFO_INDIRECT_PRIMARY_P): Likewise. (get_primary_binfo): New function. * decl.c (lang_mark_tree): Make lang_type::primary_base. * class.c (vcall_offset_data_s): Rename to ... (vtbl_init_data_s): ... this. Rename primary_p to primary_vtbl_p, and add ctor_vtbl_p. (get_derived_offset): Use get_primary_binfo. (dfs_mark_primary_bases): Adjust handling of virtual primary bases. (mark_primary_bases): Likewise. (set_primary_base): Take a binfo, not an integer, as a representation of the primary base. (indirect_primary_base_p): Remove. (determine_primary_base): Adjust for indirect primary bases. (dfs_find_final_overrider): Fix typo in coment. (update_vtable_entry_for_fn): Use get_primary_binfo. (layout_nonempty_base_or_field): Tweak. (build_base_fields): Adjust for new primary base semantics. (dfs_propagate_binfo_offsets): Remove. (propagate_binfo_offsets): Rewrite. (dfs_set_offset_for_shared_vbases): Remove. (layout_virtual_bases): Don't use it. (layout_class_type): Set CLASSTYPE_SIZE correctly under the new ABI. (finish_struct_1): Set CLASSTYPE_PRIMARY_BINFO, not CLASSTYPE_VFIELD_PARENT. (dfs_get_primary_binfo): New function. (get_primary_binfo): Likewise. (dump_class_hierarchy_r): Tweak printing of primary bases. (build_vtbl_initializer): Fix typo in comments. Use vtbl_init_data. (build_vcall_and_vbase_vtbl_entries): Likewise. (build_vbaes_offset_vtbl_entries): Likewise. (dfs_build_vcall_offset_vtbl_entries): Adjust setting of BV_VCALL_INDEX to handle indirect primary bases. (build_vcall_offset_vtbl_entries): Use vtbl_init_data. (build_rtti_vtbl_entries): Likewise. * search.c (get_shared_vbase_if_not_primary): Tweak. (find_vbase_instance): Likewise. (binfo_for_vtable): Simplify. * tree.c (unshare_base_binfos): Clear BINFO_PRIMARY_BASE_OF. (make_binfo): Make it have 11 entries. From-SVN: r35360
2000-07-31 02:24:44 +02:00
tree primary_base;
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_pair_s, va_gc> *vcall_indices;
call.c (build_special_member_call): Do not try to lookup VTTs by name. * call.c (build_special_member_call): Do not try to lookup VTTs by name. * class.c (vtbl_init_data): Add generate_vcall_entries. (get_vtable_decl): Do not look up virtual tables by name. (copy_virtuals): Do not use BV_USE_VCALL_INDEX_P. (set_primary_base): Do not set CLASSTYPE_RTTI. (determine_primary_base): Likewise. (get_matching_virtual): Remove. (get_vcall_index): New function. (update_vtable_entry_for_fn): Do not try to use virtual thunks when they are not required. Assign vcall indices at this point. (finish_struct_1): Do not set CLASSTYPE_NEEDS_VIRTUAL_REINIT. Do update dynamic_classes. (build_vtt): Do not add VTTs to the symbol table. (build_ctor_vtbl_group): Likewise. (build_vtbl_initializer): Simplify handling of vcall indices. (build_vcall_offset_vtbl_entries): Pretend to build vcall offsets for the most derived class. (add_vcall_offset_vtbl_entries_1): But do not actually add them to the vtable. * cp-tree.h (dynamic_classes): New macro. (lang_type_class): Remove rtti. Add vtables. Add vcall_indices. (CLASSTYPE_RTTI): Remove. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Remove. (CLASSTYPE_VCALL_INDICES): New macro. (CLASSTYPE_VTABLES): Likewise. (BV_USE_VCALL_INDEX_P): Remove. (build_vtable_path): Remove. * decl2.c (finish_vtable_vardecl): Remove. (key_method): Remove #if 0'd code. (finish_vtable_vardecl): Rename to ... (maybe_emit_vtables): ... this. (finish_file): Use it. * search.c (look_for_overrides_here): Update comment. * g++.dg/abi/thunk1.C: New test. * g++.dg/abi/thunk2.C: Likewise. * g++.dg/abi/vtt1.C: Likewise. From-SVN: r58779
2002-11-04 02:45:58 +01:00
tree vtables;
tree typeinfo_var;
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> *vbases;
hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.c (ht_lookup): Use it when searching, remember. (ht_expand): Do not recompute. * tree.h (IDENTIFIER_HASH_VALUE): New macro. cp/ * cp-tree.h (struct lang_type_class): Replace data member tags with hash-table nested_udts. (CLASSTYPE_NESTED_UTDS): Rename from CLASSTYPE_TAGS. * class.c (unreverse_member_declarations): Don't touch CLASSTYPE_TAGS. (pushclass): Use cxx_remember_type_decls. * decl.c (struct cp_binding_level): Replace data member tags with hash-table type_decls. (pop_binding_level): Handle level->type_decls. (kept_level_p): Adjust. (poplevel): Remove unused local variable. (bt_print_entry): New function. (print_binding_level): Use it. (push_namespace): Build current_binding_level->type_decls. (maybe_process_template_type_declaration): Adjust. (pushtag): Likewise. (clear_anon_tags): Use binding_table_remove_anonymous_types. (gettags): Remove. (cxx_remember_type_decls): Rename from storetags. Adjust. (lookup_tag): Use binding_table_find_anon_type. Tidy. (lookup_tag_reverse): Use binding_table_reverse_maybe_remap. (cxx_init_decl_processing): Build global_binding_level->type_decls. (store_parm_decls): Remove pointless code. * name-lookup.c (free_binding_entry): New variable. (ENTRY_INDEX): New macro. (struct binding_table_s): New datatype. (binding_entry_make): New function. (binding_entry_free): Likewise. (binding_table_construct): Likewise. (binding_table_free): Likewise. (binding_table_new): Likewise. (binding_table_expand): Likewise. (binding_table_insert): Likewise. (binding_table_find): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. * name-lookup.h (binding_table): New type. (binding_entry): Likewise. (bt_foreach_proc): Likewise. (struct binding_entry_s): New datatype. (SCOPE_DEFAULT_HT_SIZE): New macro. (CLASS_SCOPE_HT_SIZE): Likewise. (NAMESPACE_ORDINARY_HT_SIZE): Likewise. (NAMESPACE_STD_HT_SIZE): Likewise. (GLOBAL_SCOPE_HT_SIZE): Likewise. (binding_table_new): Declare. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. (binding_table_find): Likewise. (cxx_remember_type_decls): Likewise. * pt.c (bt_instantiate_type_proc): New function. (do_type_instantiation): Use it. * search.c (lookup_field_r): Use binding_table_find. From-SVN: r66930
2003-05-18 15:40:54 +02:00
binding_table nested_udts;
store-layout.c (finish_record_layout): Add free_p parameter. * store-layout.c (finish_record_layout): Add free_p parameter. (layout_type): Pass it. * tree.h (finish_record_layout): Update prototype. * class.c (walk_subobject_offsets): Correct the calculation of offsets for virtual bases. Correct the counting of array elements. (layout_nonempty_base_or_field): Simplify. Correct the calculation of offsets to be propagated through the binfo hierarchy. (build_base_field): Avoid creating a FIELD_DECL for empty bases. Add the FIELD_DECL to TYPE_FIELDS. (build_base_fields): Adjust accordingly. (layout_virtual_bases): Use build_base_field. (end_of_class): Return a tree, not an integer. (warn_about_ambiguous_direct_bases): Rename to ... (warn_about_ambiguous_bases): ... this. (include_empty_classes): New function. (layout_class_type): Create an alternative version of the type to be used when as a base class type. Do not call finish_record_layout until we are done laying out the class. * cp-tree.h (lang_type_class): Remove size, size_unit. Add as_base. (CLASSTYPE_SIZE): Reimplement. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN): Likweise. (CLASSTYPE_USER_ALIGN): Likewise. (CLASSTYPE_AS_BASE): New macro. (DECL_INITIALIZED_P): Likewise. (extract_init): Remove prototype. (build_forced_zero_init): Rename to ... (build_zero_init): ... this. (force_store_init_value): Remove. * decl.c (obscure_complex_init): Remove. (duplicate_decls): Copy DECL_INITIALIZED_P. (check_initializer): Do not leave junk in DECL_INITIAL. (cp_finish_decl): Handle zero-initialization of entities with static storage duration. * expr.c (extract_init): Remove. * init.c (build_forced_zero_init): Remove. (build_zero_init): New function. (build_default_init): Use it. (build_field_list): Skip FIELD_DECLs for base subobjects. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. (synthesize_exception_spec): Likewise. * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P. (regenerate_decl_from_template): To not set DECL_INITIAL for a static data member whose initialization took place in its class. (instantiate_decl): Do not pass an initializer to cp_finish_decl in that situation. * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects. (dfs_unuse_fields): Likewise. * tree.c (pod_type_p): Handle error_mark_node. (zero_init_p): Likewise. * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base subobjects. * typeck2.c (store_init_value): Remove #if 0'd code. (force_store_init_value): Remove. (process_init_constructor): Use build_zero_init. * g++.dg/abi/empty7.C: New test. * g++.dg/init/pm2.C: Likewise. From-SVN: r57654
2002-09-30 18:52:19 +02:00
tree as_base;
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> *pure_virtuals;
Correct many new ABI issues regarding vbase and vcall offset layout. Correct many new ABI issues regarding vbase and vcall offset layout. * cp-tree.h (BINFO_VTABLE): Document. (struct lang_type): Tweak formatting. (BINFO_PRIMARY_BINFO): Add to documentation. (CLASSTYPE_VSIZE): Fix typo in comment. (CLASSTYPE_VBASECLASSES): Update documentation. (BINFO_VBASE_MARKED): Remove. (SET_BINFO_VBASE_MARKED): Likewise. (CLEAR_BINFO_VBASE_MARKED): Likewise. (BINFO_FIELDS_MARKED): Remove. (SET_BINFO_FIELDS_MARKED): Likewise. (CLEAR_BINFO_FIELDS_MARKED): Likewise. (enum access_kind): New enumeration. (num_extra_vtbl_entries): Remove declaration. (size_extra_vtbl_entries): Likewise. (get_vtbl_decl_for_binfo): New function. (dfs_vbase_unmark): Remove declaration. (mark_primary_bases): Likewise. * class.c (SAME_FN): Remove. (struct vcall_offset_data_s): Move definition. (build_vbase_pointer): Use `build', not `build_binary_op', to access the vbase pointer under the new ABI. (build_vtable_entry_ref): Use get_vtbl_decl_for_binfo. (build_primary_vtable): Likewise. (dfs_mark_primary_bases): Move here from search.c. (mark_primary_bases): Likewise. (determine_primary_bases): Under the new ABI, don't make a base class a primary base just because we don't yet have any virtual functions. (layout_vtable_decl): Use get_vtbl_decl_for_binfo. (num_vfun_entries): Remove. (dfs_count_virtuals): Likewise. (num_extra_vtbl_entries): Likewise. (size_extra_vtbl_entries): Likewise. (layout_virtual_bases): Iterate in inheritance graph order under the new ABI. (finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to indicate that a vfield is present. (init_class_processing): Initialize access_public_node, etc., from ak_public, etc. (get_vtbl_decl_for_binfo): New function. (dump_class_hierarchy_r): Likewise. (dump_class_hierarchy): Use it. (finish_vtbls): Build the vtbls in inheritance graph order. (dfs_finish_vtbls): Adjust call to build_vtbl_initializer. (initialize_vtable): Use get_vtbl_decl_for_binfo. (accumulate_vtbl_inits): Add comments explaining why a pre-order walk is required. (dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location where the vptr points, even for primary vtables. (build_vtbl_initializer): Adjust handling of vbase and vcall offsets. (build_vcall_and_vbase_vtable_entries): New function. (dfs_build_vbase_offset_vtbl_entries): Remove. (build_vbase_offset_vtbl_entries): Reimplement. (dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that were already handled in a primary base class vtable. (build_vcall_offset_vtbl_entries): Adjust. (build_rtti_vtbl_entries): Adjust. * decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo. * init.c (expand_virtual_init): Simplify. * repo.c (repo_get_id): Use get_vtbl_decl_for_binfo. * rtti.c (create_pseudo_type_info): Adjust calculation of vptr. * search.c (BINFO_ACCESS): New macro. (SET_BINFO_ACCESS): Likewise. (dfs_access_in_type): Manipulate access_kinds, not access nodes. (access_in_type): Likewise. (dfs_accessible_p): Likewise. (protected_accessible_p): Likewise. (lookup_fnfields_1): Adjust documentation. (dfs_mark_primary_bases): Move to class.c (mark_primary_bases): Likewise. (dfs_vbase_unmark): Remove. (virtual_context): Use BINFO_FOR_VBASE. (dfs_get_vbase_types): Simplify. (dfs_build_inheritance_graph_order): New function. (get_vbase_types): Use it. * tree.c (debug_binfo): Use get_vtbl_decl_for_binfo. * tinfo.cc (get_vbase_offset): New function. (__vmi_class_type_info::do_find_public_src): Use it. (__vmi_class_type_info::do_dyncast): Likewise. (__vmi_class_type_info::do_upcast): Likewise. From-SVN: r32905
2000-04-04 20:13:22 +02:00
tree friend_classes;
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> * GTY((reorder ("resort_type_method_vec"))) methods;
tree key_method;
tree decl_list;
Correct many new ABI issues regarding vbase and vcall offset layout. Correct many new ABI issues regarding vbase and vcall offset layout. * cp-tree.h (BINFO_VTABLE): Document. (struct lang_type): Tweak formatting. (BINFO_PRIMARY_BINFO): Add to documentation. (CLASSTYPE_VSIZE): Fix typo in comment. (CLASSTYPE_VBASECLASSES): Update documentation. (BINFO_VBASE_MARKED): Remove. (SET_BINFO_VBASE_MARKED): Likewise. (CLEAR_BINFO_VBASE_MARKED): Likewise. (BINFO_FIELDS_MARKED): Remove. (SET_BINFO_FIELDS_MARKED): Likewise. (CLEAR_BINFO_FIELDS_MARKED): Likewise. (enum access_kind): New enumeration. (num_extra_vtbl_entries): Remove declaration. (size_extra_vtbl_entries): Likewise. (get_vtbl_decl_for_binfo): New function. (dfs_vbase_unmark): Remove declaration. (mark_primary_bases): Likewise. * class.c (SAME_FN): Remove. (struct vcall_offset_data_s): Move definition. (build_vbase_pointer): Use `build', not `build_binary_op', to access the vbase pointer under the new ABI. (build_vtable_entry_ref): Use get_vtbl_decl_for_binfo. (build_primary_vtable): Likewise. (dfs_mark_primary_bases): Move here from search.c. (mark_primary_bases): Likewise. (determine_primary_bases): Under the new ABI, don't make a base class a primary base just because we don't yet have any virtual functions. (layout_vtable_decl): Use get_vtbl_decl_for_binfo. (num_vfun_entries): Remove. (dfs_count_virtuals): Likewise. (num_extra_vtbl_entries): Likewise. (size_extra_vtbl_entries): Likewise. (layout_virtual_bases): Iterate in inheritance graph order under the new ABI. (finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to indicate that a vfield is present. (init_class_processing): Initialize access_public_node, etc., from ak_public, etc. (get_vtbl_decl_for_binfo): New function. (dump_class_hierarchy_r): Likewise. (dump_class_hierarchy): Use it. (finish_vtbls): Build the vtbls in inheritance graph order. (dfs_finish_vtbls): Adjust call to build_vtbl_initializer. (initialize_vtable): Use get_vtbl_decl_for_binfo. (accumulate_vtbl_inits): Add comments explaining why a pre-order walk is required. (dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location where the vptr points, even for primary vtables. (build_vtbl_initializer): Adjust handling of vbase and vcall offsets. (build_vcall_and_vbase_vtable_entries): New function. (dfs_build_vbase_offset_vtbl_entries): Remove. (build_vbase_offset_vtbl_entries): Reimplement. (dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that were already handled in a primary base class vtable. (build_vcall_offset_vtbl_entries): Adjust. (build_rtti_vtbl_entries): Adjust. * decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo. * init.c (expand_virtual_init): Simplify. * repo.c (repo_get_id): Use get_vtbl_decl_for_binfo. * rtti.c (create_pseudo_type_info): Adjust calculation of vptr. * search.c (BINFO_ACCESS): New macro. (SET_BINFO_ACCESS): Likewise. (dfs_access_in_type): Manipulate access_kinds, not access nodes. (access_in_type): Likewise. (dfs_accessible_p): Likewise. (protected_accessible_p): Likewise. (lookup_fnfields_1): Adjust documentation. (dfs_mark_primary_bases): Move to class.c (mark_primary_bases): Likewise. (dfs_vbase_unmark): Remove. (virtual_context): Use BINFO_FOR_VBASE. (dfs_get_vbase_types): Simplify. (dfs_build_inheritance_graph_order): New function. (get_vbase_types): Use it. * tree.c (debug_binfo): Use get_vtbl_decl_for_binfo. * tinfo.cc (get_vbase_offset): New function. (__vmi_class_type_info::do_find_public_src): Use it. (__vmi_class_type_info::do_dyncast): Likewise. (__vmi_class_type_info::do_upcast): Likewise. From-SVN: r32905
2000-04-04 20:13:22 +02:00
tree template_info;
tree befriending_classes;
/* In a RECORD_TYPE, information specific to Objective-C++, such
as a list of adopted protocols or a pointer to a corresponding
@interface. See objc/objc-act.h for details. */
tree objc_info;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
/* sorted_fields is sorted based on a pointer, so we need to be able
to resort it if pointers get rearranged. */
struct sorted_fields_type * GTY ((reorder ("resort_sorted_fields")))
sorted_fields;
/* FIXME reuse another field? */
tree lambda_expr;
1994-02-24 02:02:37 +01:00
};
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) lang_type_ptrmem {
struct lang_type_header h;
tree record;
};
use templates instead of gengtype for typed allocation functions gcc/ChangeLog: * alias.c (record_alias_subset): Adjust. * bitmap.c (bitmap_element_allocate): Likewise. (bitmap_gc_alloc_stat): Likewise. * cfg.c (init_flow): Likewise. (alloc_block): Likewise. (unchecked_make_edge): Likewise. * cfgloop.c (alloc_loop): Likewise. (flow_loops_find): Likewise. (rescan_loop_exit): Likewise. * cfgrtl.c (init_rtl_bb_info): Likewise. * cgraph.c (insert_new_cgraph_node_version): Likewise. (cgraph_allocate_node): Likewise. (cgraph_create_edge_1): Likewise. (cgraph_allocate_init_indirect_info): Likewise. * cgraphclones.c (cgraph_clone_edge): Likewise. * cgraphunit.c (add_asm_node): Likewise. (init_lowered_empty_function): Likewise. * config/aarch64/aarch64.c (aarch64_init_machine_status): Likewise. * config/alpha/alpha.c (alpha_init_machine_status): Likewise. (alpha_use_linkage): Likewise. * config/arc/arc.c (arc_init_machine_status): Likewise. * config/arm/arm.c (arm_init_machine_status): Likewise. * config/avr/avr.c (avr_init_machine_status): Likewise. * config/bfin/bfin.c (bfin_init_machine_status): Likewise. * config/c6x/c6x.c (c6x_init_machine_status): Likewise. * config/cris/cris.c (cris_init_machine_status): Likewise. * config/darwin.c (machopic_indirection_name): Likewise. (darwin_build_constant_cfstring): Likewise. (darwin_enter_string_into_cfstring_table): Likewise. * config/epiphany/epiphany.c (epiphany_init_machine_status): * Likewise. * config/frv/frv.c (frv_init_machine_status): Likewise. * config/i386/i386.c (get_dllimport_decl): Likewise. (ix86_init_machine_status): Likewise. (assign_386_stack_local): Likewise. * config/i386/winnt.c (i386_pe_record_external_function): Likewise. (i386_pe_maybe_record_exported_symbol): Likewise. (i386_pe_record_stub): Likewise. * config/ia64/ia64.c (ia64_init_machine_status): Likewise. * config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise. * config/m32c/m32c.c (m32c_init_machine_status): Likewise. (m32c_note_pragma_address): Likewise. * config/mep/mep.c (mep_init_machine_status): Likewise. (mep_note_pragma_flag): Likewise. * config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise. (mips16_local_alias): Likewise. (mips_init_machine_status): Likewise. * config/mmix/mmix.c (mmix_init_machine_status): Likewise. * config/moxie/moxie.c (moxie_init_machine_status): Likewise. * config/msp430/msp430.c (msp430_init_machine_status): Likewise. * config/nds32/nds32.c (nds32_init_machine_status): Likewise. * config/nios2/nios2.c (nios2_init_machine_status): Likewise. * config/pa/pa.c (pa_init_machine_status): Likewise. (pa_get_deferred_plabel): Likewise. * config/rl78/rl78.c (rl78_init_machine_status): Likewise. * config/rs6000/rs6000.c (builtin_function_type): Likewise. (rs6000_init_machine_status): Likewise. (output_toc): Likewise. * config/s390/s390.c (s390_init_machine_status): Likewise. * config/score/score.c (score_output_external): Likewise. * config/sparc/sparc.c (sparc_init_machine_status): Likewise. * config/spu/spu.c (spu_init_machine_status): Likewise. * config/tilegx/tilegx.c (tilegx_init_machine_status): Likewise. * config/tilepro/tilepro.c (tilepro_init_machine_status): * Likewise. * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise. * coverage.c (coverage_end_function): Likewise. * dbxout.c (dbxout_init): Likewise. * doc/gty.texi: Don't mention variable_size attribute. * dwarf2cfi.c (new_cfi): Adjust. (new_cfi_row): Likewise. (copy_cfi_row): Likewise. (create_cie_data): Likewise. * dwarf2out.c (dwarf2out_alloc_current_fde): Likewise. (new_loc_descr): Likewise. (find_AT_string_in_table): Likewise. (add_addr_table_entry): Likewise. (new_die): Likewise. (add_var_loc_to_decl): Likewise. (clone_die): Likewise. (clone_as_declaration): Likewise. (break_out_comdat_types): Likewise. (new_loc_list): Likewise. (add_loc_descr_to_each): Likewise. (add_location_or_const_value_attribute): Likewise. (add_linkage_name): Likewise. (lookup_filename): Likewise. (dwarf2out_var_location): Likewise. (new_line_info_table): Likewise. (dwarf2out_init): Likewise. (mem_loc_descriptor): Likewise. (loc_descriptor): Likewise. (add_const_value_attribute): Likewise. (tree_add_const_value_attribute): Likewise. (comp_dir_string): Likewise. (dwarf2out_vms_debug_main_pointer): Likewise. (string_cst_pool_decl): Likewise. * emit-rtl.c (set_mem_attrs): Likewise. (get_reg_attrs): Likewise. (start_sequence): Likewise. (init_emit): Likewise. (init_emit_regs): Likewise. * except.c (init_eh_for_function): Likewise. (gen_eh_region): Likewise. (gen_eh_region_catch): Likewise. (gen_eh_landing_pad): Likewise. (add_call_site): Likewise. * function.c (add_frame_space): Likewise. (insert_temp_slot_address): Likewise. (assign_stack_temp_for_type): Likewise. (get_hard_reg_initial_val): Likewise. (allocate_struct_function): Likewise. (prepare_function_start): Likewise. (types_used_by_var_decl_insert): Likewise. * gengtype.c (variable_size_p): Remove function. (enum alloc_quantity): Remove enum. (write_typed_alloc_def): Remove function. (write_typed_struct_alloc_def): Likewise. (write_typed_typedef_alloc_def): Likewise. (write_typed_alloc_defns): Likewise. (main): Adjust. * ggc-common.c (ggc_cleared_alloc_htab_ignore_args): Adjust. (ggc_cleared_alloc_ptr_array_two_args): Likewise. * ggc.h (ggc_alloc): new function. (ggc_cleared_alloc): Likewise. (ggc_vec_alloc): Template on type of vector element, and remove element size argument. (ggc_cleared_vec_alloc): Likewise. * gimple.c (gimple_build_omp_for): Adjust. (gimple_copy): Likewise. * ipa-cp.c (get_replacement_map): Likewise. (find_aggregate_values_for_callers_subset): Likewise. (known_aggs_to_agg_replacement_list): Likewise. * ipa-devirt.c (get_odr_type): Likewise. * ipa-prop.c (ipa_node_duplication_hook): Likewise. (read_agg_replacement_chain): Likewise. * loop-iv.c (get_simple_loop_desc): Likewise. * lto-cgraph.c (input_node_opt_summary): Likewise. * lto-section-in.c (lto_new_in_decl_state): Likewise. * lto-streamer-in.c (lto_input_eh_catch_list): Likewise. (input_eh_region): Likewise. (input_eh_lp): Likewise. (input_cfg): Likewise. * optabs.c (set_optab_libfunc): Likewise. (init_tree_optimization_optabs): Likewise. (set_conv_libfunc): Likewise. * passes.c (do_per_function_toporder): Likewise. * rtl.h: Don't use variable_size gty attribute. * sese.c (if_region_set_false_region): Adjust. * stringpool.c (gt_pch_save_stringpool): Likewise. * target-globals.c (save_target_globals): Likewise. * toplev.c (general_init): Likewise. * trans-mem.c (record_tm_replacement): Likewise. (split_bb_make_tm_edge): Likewise. * tree-cfg.c (move_sese_region_to_fn): Likewise. * tree-data-ref.h (lambda_vector_new): Likewise. * tree-eh.c (add_stmt_to_eh_lp_fn): Likewise. * tree-iterator.c (tsi_link_before): Likewise. (tsi_link_after): Likewise. * tree-scalar-evolution.c (new_scev_info_str): Likewise. * tree-ssa-loop-niter.c (record_estimate): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Likewise. * tree-ssa-operands.h: Don't use variable_size gty attribute. * tree-ssa.c (init_tree_ssa): Adjust. * tree-ssanames.c (set_range_info): Likewise. (get_ptr_info): Likewise. (duplicate_ssa_name_ptr_info): Likewise. (duplicate_ssa_name_range_info): Likewise. * tree-streamer-in.c (unpack_ts_real_cst_value_fields): Likewise. (unpack_ts_fixed_cst_value_fields): Likewise. * tree.c (build_fixed): Likewise. (build_real): Likewise. (build_string): Likewise. (decl_priority_info): Likewise. (decl_debug_expr_insert): Likewise. (decl_value_expr_insert): Likewise. (decl_debug_args_insert): Likewise. (type_hash_add): Likewise. (build_omp_clause): Likewise. * ubsan.c (decl_for_type_insert): Likewise. * varasm.c (get_unnamed_section): Likewise. (get_noswitch_section): Likewise. (get_section): Likewise. (get_block_for_section): Likewise. (create_block_symbol): Likewise. (build_constant_desc): Likewise. (create_constant_pool): Likewise. (force_const_mem): Likewise. (record_tm_clone_pair): Likewise. * varpool.c (varpool_create_empty_node): Likewise. gcc/c/ChangeLog: * c-decl.c (finish_struct): Adjust. (finish_enum): Likewise. (bind): Adjust. (record_inline_static): Likewise. (push_scope): Likewise. (make_label): Likewise. (lookup_label_for_goto): Likewise. (finish_struct): Likewise. (finish_enum): Likewise. (store_parm_decls): Likewise. (c_push_function_context): Likewise. * c-lang.h: Remove usage of variable_size gty attribute. * c-parser.c (c_parse_init): Adjust. (c_parse_file): Likewise. gcc/java/ChangeLog: * class.c (add_method_1): Adjust. (java_treetreehash_new): Likewise. * constants.c (set_constant_entry): Likewise. (cpool_for_class): Likewise. * decl.c (make_binding_level): Likewise. (java_dup_lang_specific_decl): Likewise. * expr.c (add_type_assertion): Likewise. * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise. (lang_decl): don't use variable_size gty attribute. (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Adjust. (lang_type): Don't use variable_size gty attribute. * jcf-parse.c (java_parse_file): Adjust. (process_zip_dir): Likewise. * jcf.h: Remove usage of variable_size gty attribute. * jcf-reader.c (jcf_parse_constant_pool): Adjust. (jcf_parse_bootstrap_methods): Likewise. gcc/objc/ChangeLog: * objc-act.c (objc_build_string_object): Adjust. (continue_class): Likewise. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. * objc-map.c (objc_map_alloc_ggc): Likewise. (objc_map_private_resize): Likewise. * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Likewise. (hash_name_enter): Likewise. gcc/cp/ChangeLog: * class.c (sorted_fields_type_new): Adjust. * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise. * cp-tree.h: Remove usage of variable_size gty attribute. * decl.c (make_label_decl): Adjust. (check_goto): Likewise. (start_preparsed_function): Likewise. (save_function_data): Likewise. * lex.c (init_reswords): Likewise. (retrofit_lang_decl): Likewise. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. * name-lookup.c (binding_entry_make): Likewise. (binding_table_construct): Likewise. (binding_table_new): Likewise. (cxx_binding_make): Likewise. (pushdecl_maybe_friend_1): Likewise. (begin_scope): Likewise. (push_to_top_level): Likewise. * parser.c (cp_lexer_alloc): Likewise. (cp_lexer_new_from_tokens): Likewise. (cp_token_cache_new): Likewise. (cp_parser_context_new): Likewise. (cp_parser_new): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_template_id): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (register_specialization): Likewise. (add_pending_template): Likewise. (lookup_template_class_1): Likewise. (push_tinst_level): Likewise. * semantics.c (register_constexpr_fundef): Likewise. (cxx_eval_call_expression): Likewise. * typeck2.c (abstract_virtuals_error_sfinae): Likewise. gcc/fortran/ChangeLog: * f95-lang.c (pushlevel): Adjust. * trans-decl.c (gfc_allocate_lang_decl): Adjust. (gfc_find_module): Likewise. * trans-types.c (gfc_get_nodesc_array_type): Likewise. (gfc_get_array_type_bounds): Likewise. (gfc_nonrestricted_type): Likewise. * trans.h: Don't use variable_size gty attribute. gcc/ada/ChangeLog: * gcc-interface/ada-tree.h: Remove usage of variable_size gty annotation. * gcc-interface/decl.c (annotate_value): Adjust. * gcc-interface/trans.c (Attribute_to_gnu): Likewise. (push_range_check_info): Likewise. (Loop_Statement_to_gnu): Likewise. (Subprogram_Body_to_gnu): Likewise. (Compilation_Unit_to_gnu): Likewise. (start_stmt_group): Likewise. * gcc-interface/utils.c (init_gnat_utils): Likewise. (gnat_pushlevel): Likewise. (maybe_pad_type): Likewise. gcc/go/ChangeLog: * go-lang.c (struct GTY): Don't use variable_size gty attribute. gcc/c-family/ChangeLog: * c-common.h (sorted_fields_type): Remove variable_size GTY attribute. * c-pragma.c (push_alignment): Adjust. (handle_pragma_push_options): Likewise. gcc/lto/ChangeLog: * lto-tree.h: Don't use variable_size gty attribute. * lto.c (lto_read_in_decl_state): Adjust. (create_subid_section_table): Likewise. (lto_flatten_files): Likewise. (read_cgraph_and_symbols): Likewise. gcc/objcp/ChangeLog: * objcp-decl.h: Adjust. From-SVN: r210566
2014-05-18 01:07:23 +02:00
struct GTY(()) lang_type {
union lang_type_u
{
cfgcleanup.c (try_simplify_condjump): Don't remove line notes to avoid unreachable code warnings. * cfgcleanup.c (try_simplify_condjump): Don't remove line notes to avoid unreachable code warnings. * toplev.c (backend_init): Don't emit line notes for unreachable code warnings. * combine.c (distribute_notes): Don't distribute a REG_VTABLE_REF note. * final.c (final_scan_insn): Don't handle it. * rtl.c (reg_note_name): Remove it. * rtl.h (enum reg_node): Dito. * emit-rtl.c (force_line_numbers, restore_line_number_status): Remove. * rtl.h (force_line_numbers, restore_line_number_status): Remove prototypes. * stmt.c (using_eh_for_cleanups_p, using_eh_for_cleanups): Move... * tree-eh.c (using_eh_for_cleanups_p): ...here. Make static. (using_eh_for_cleanups): Also moved here. * expr.c (expand_expr_real_1) <CASE_LABEL_EXPR>: Die if we see one. <SWITCH_EXPR>: Die if we have a non-NULL SWITCH_BODY. Update calls to expand_start_case and add_case_node. * stmt.c (struct nesting): Cleanup unused fields condition_code, last_unconditional_cleanup, nominal_type, printname, and line_number_status. (struct fixup_goto): Remove. (struct stmt_status): Remove x_goto_fixup_chain field. (goto_fixup_chain): Remove. (strip_default_case_nodes, group_case_nodes, emit_jump_if_reachable, pushcase, pushcase_range): Remove. (expand_start_bindings_and_block): Don't set unused fields in the nesting stack. (expand_start_case, add_case_node): Cleanup unused formal arguments. (expand_end_case_type): Don't simplify the case-list. Use emit_jump instead of emit_jump_if_reachable. (emit_case_nodes): Likewise. * tree-cfg.c (group_case_labels, cleanup_dead_labels): No longer static. (update_eh_label): Work around left-over exception handing regions. * tree-flow.h (group_case_labels, cleanup_dead_labels): Add protos. * tree-optimize.c (execute_cleanup_cfg_post_optimizing): New function. (pass_cleanup_cfg_post_optimizing): New pass. (init_tree_optimization_passes): Run the new pass after all optimizations. * tree.h (pushcase, pushcase_range): Remove prototypes. (expand_start_case, add_case_node): Update prototypes. cp/ * cp-tree.h (struct lang_type): Don't have three GTY options on a single bit GTY desc. java/ * parse.y (java_complete_expand_methods, java_expand_classes): Don't abuse restore_line_number_status. From-SVN: r84849
2004-07-17 02:31:15 +02:00
struct lang_type_header GTY((skip (""))) h;
struct lang_type_class GTY((tag ("1"))) c;
struct lang_type_ptrmem GTY((tag ("0"))) ptrmem;
} GTY((desc ("%h.h.is_lang_type_class"))) u;
};
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
#define LANG_TYPE_CLASS_CHECK(NODE) __extension__ \
({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
if (! lt->u.h.is_lang_type_class) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
&lt->u.c; })
#define LANG_TYPE_PTRMEM_CHECK(NODE) __extension__ \
({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
if (lt->u.h.is_lang_type_class) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
&lt->u.ptrmem; })
#else
#define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c)
#define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem)
#endif /* ENABLE_TREE_CHECKING */
/* Nonzero for _CLASSTYPE means that operator delete is defined. */
#define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete)
#define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
/* Nonzero if `new NODE[x]' should cause the allocation of extra
storage to indicate how many array elements are in use. */
#define TYPE_VEC_NEW_USES_COOKIE(NODE) \
(CLASS_TYPE_P (NODE) \
&& LANG_TYPE_CLASS_CHECK (NODE)->vec_new_uses_cookie)
1994-02-24 02:02:37 +01:00
/* Nonzero means that this _CLASSTYPE node defines ways of converting
itself to other types. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define TYPE_HAS_CONVERSION(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion)
1994-02-24 02:02:37 +01:00
/* Nonzero means that NODE (a class type) has a default constructor --
but that it has not yet been declared. */
#define CLASSTYPE_LAZY_DEFAULT_CTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->lazy_default_ctor)
/* Nonzero means that NODE (a class type) has a copy constructor --
but that it has not yet been declared. */
#define CLASSTYPE_LAZY_COPY_CTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor)
/* Nonzero means that NODE (a class type) has a move constructor --
but that it has not yet been declared. */
#define CLASSTYPE_LAZY_MOVE_CTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_ctor)
/* Nonzero means that NODE (a class type) has an assignment operator
-- but that it has not yet been declared. */
#define CLASSTYPE_LAZY_COPY_ASSIGN(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_assign)
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* Nonzero means that NODE (a class type) has an assignment operator
-- but that it has not yet been declared. */
#define CLASSTYPE_LAZY_MOVE_ASSIGN(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_assign)
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
/* Nonzero means that NODE (a class type) has a destructor -- but that
it has not yet been declared. */
#define CLASSTYPE_LAZY_DESTRUCTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor)
/* Nonzero means that NODE (a class type) is final */
#define CLASSTYPE_FINAL(NODE) \
TYPE_FINAL_P (NODE)
1994-02-24 02:02:37 +01:00
/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
#define TYPE_HAS_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_copy_assign)
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
/* True iff the class type NODE has an "operator =" whose parameter
has a parameter of type "const X&". */
#define TYPE_HAS_CONST_COPY_ASSIGN(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_copy_assign)
1994-02-24 02:02:37 +01:00
/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
#define TYPE_HAS_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_copy_ctor)
#define TYPE_HAS_CONST_COPY_CTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->has_const_copy_ctor)
1994-02-24 02:02:37 +01:00
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
/* Nonzero if this class has an X(initializer_list<T>) constructor. */
#define TYPE_HAS_LIST_CTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->has_list_ctor)
/* Nonzero if this class has a constexpr constructor other than a copy/move
constructor. Note that a class can have constexpr constructors for
static initialization even if it isn't a literal class. */
#define TYPE_HAS_CONSTEXPR_CTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->has_constexpr_ctor)
/* Nonzero if this class defines an overloaded operator new. (An
operator new [] doesn't count.) */
#define TYPE_HAS_NEW_OPERATOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->has_new)
/* Nonzero if this class defines an overloaded operator new[]. */
#define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->has_array_new)
1994-02-24 02:02:37 +01:00
/* Nonzero means that this type is being defined. I.e., the left brace
starting the definition of this type has been seen. */
#define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined)
1994-02-24 02:02:37 +01:00
/* Nonzero means that this type is either complete or being defined, so we
can do lookup in it. */
#define COMPLETE_OR_OPEN_TYPE_P(NODE) \
(COMPLETE_TYPE_P (NODE) || (CLASS_TYPE_P (NODE) && TYPE_BEING_DEFINED (NODE)))
/* Mark bits for repeated base checks. */
#define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE))
/* Nonzero if the class NODE has multiple paths to the same (virtual)
base object. */
#define CLASSTYPE_DIAMOND_SHAPED_P(NODE) \
(LANG_TYPE_CLASS_CHECK(NODE)->diamond_shaped)
/* Nonzero if the class NODE has multiple instances of the same base
type. */
#define CLASSTYPE_REPEATED_BASE_P(NODE) \
(LANG_TYPE_CLASS_CHECK(NODE)->repeated_base)
/* The member function with which the vtable will be emitted:
the first noninline non-pure-virtual member function. NULL_TREE
if there is no key function or if this is a class template */
#define CLASSTYPE_KEY_METHOD(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->key_method)
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
/* Vector member functions defined in this class. Each element is
either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All
functions with the same name end up in the same slot. The first
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
two elements are for constructors, and destructors, respectively.
All template conversion operators to innermost template dependent
types are overloaded on the next slot, if they exist. Note, the
names for these functions will not all be the same. The
non-template conversion operators & templated conversions to
non-innermost template types are next, followed by ordinary member
functions. There may be empty entries at the end of the vector.
The conversion operators are unsorted. The ordinary member
functions are sorted, once the class is complete. */
#define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods)
1994-02-24 02:02:37 +01:00
/* For class templates, this is a TREE_LIST of all member data,
functions, types, and friends in the order of declaration.
The TREE_PURPOSE of each TREE_LIST is NULL_TREE for a friend,
and the RECORD_TYPE for the class template otherwise. */
#define CLASSTYPE_DECL_LIST(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->decl_list)
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */
#define CLASSTYPE_CONSTRUCTOR_SLOT 0
/* The slot in the CLASSTYPE_METHOD_VEC where destructors go. */
#define CLASSTYPE_DESTRUCTOR_SLOT 1
/* The first slot in the CLASSTYPE_METHOD_VEC where conversion
operators can appear. */
#define CLASSTYPE_FIRST_CONVERSION_SLOT 2
/* A FUNCTION_DECL or OVERLOAD for the constructors for NODE. These
are the constructors that take an in-charge parameter. */
#define CLASSTYPE_CONSTRUCTORS(NODE) \
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
((*CLASSTYPE_METHOD_VEC (NODE))[CLASSTYPE_CONSTRUCTOR_SLOT])
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* A FUNCTION_DECL for the destructor for NODE. These are the
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
destructors that take an in-charge parameter. If
CLASSTYPE_LAZY_DESTRUCTOR is true, then this entry will be NULL
until the destructor is created with lazily_declare_fn. */
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
#define CLASSTYPE_DESTRUCTORS(NODE) \
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
(CLASSTYPE_METHOD_VEC (NODE) \
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
? (*CLASSTYPE_METHOD_VEC (NODE))[CLASSTYPE_DESTRUCTOR_SLOT] \
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
: NULL_TREE)
hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.c (ht_lookup): Use it when searching, remember. (ht_expand): Do not recompute. * tree.h (IDENTIFIER_HASH_VALUE): New macro. cp/ * cp-tree.h (struct lang_type_class): Replace data member tags with hash-table nested_udts. (CLASSTYPE_NESTED_UTDS): Rename from CLASSTYPE_TAGS. * class.c (unreverse_member_declarations): Don't touch CLASSTYPE_TAGS. (pushclass): Use cxx_remember_type_decls. * decl.c (struct cp_binding_level): Replace data member tags with hash-table type_decls. (pop_binding_level): Handle level->type_decls. (kept_level_p): Adjust. (poplevel): Remove unused local variable. (bt_print_entry): New function. (print_binding_level): Use it. (push_namespace): Build current_binding_level->type_decls. (maybe_process_template_type_declaration): Adjust. (pushtag): Likewise. (clear_anon_tags): Use binding_table_remove_anonymous_types. (gettags): Remove. (cxx_remember_type_decls): Rename from storetags. Adjust. (lookup_tag): Use binding_table_find_anon_type. Tidy. (lookup_tag_reverse): Use binding_table_reverse_maybe_remap. (cxx_init_decl_processing): Build global_binding_level->type_decls. (store_parm_decls): Remove pointless code. * name-lookup.c (free_binding_entry): New variable. (ENTRY_INDEX): New macro. (struct binding_table_s): New datatype. (binding_entry_make): New function. (binding_entry_free): Likewise. (binding_table_construct): Likewise. (binding_table_free): Likewise. (binding_table_new): Likewise. (binding_table_expand): Likewise. (binding_table_insert): Likewise. (binding_table_find): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. * name-lookup.h (binding_table): New type. (binding_entry): Likewise. (bt_foreach_proc): Likewise. (struct binding_entry_s): New datatype. (SCOPE_DEFAULT_HT_SIZE): New macro. (CLASS_SCOPE_HT_SIZE): Likewise. (NAMESPACE_ORDINARY_HT_SIZE): Likewise. (NAMESPACE_STD_HT_SIZE): Likewise. (GLOBAL_SCOPE_HT_SIZE): Likewise. (binding_table_new): Declare. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. (binding_table_find): Likewise. (cxx_remember_type_decls): Likewise. * pt.c (bt_instantiate_type_proc): New function. (do_type_instantiation): Use it. * search.c (lookup_field_r): Use binding_table_find. From-SVN: r66930
2003-05-18 15:40:54 +02:00
/* A dictionary of the nested user-defined-types (class-types, or enums)
found within this class. This table includes nested member class
templates. */
#define CLASSTYPE_NESTED_UTDS(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->nested_udts)
1994-02-24 02:02:37 +01:00
/* Nonzero if NODE has a primary base class, i.e., a base class with
which it shares the virtual function table pointer. */
#define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
Allow indirect primary bases. * cp-tree.h (struct lang_type): Remove vfield_parent. Add primary_base. (CLASSTYPE_VFIELD_PARENT): Remove. (CLASSTYPE_PRIMARY_BINFO): Reimplement. (BINFO_PRIMARY_BINFO): Remove. (CLASSTYPE_HAS_PRIMARY_BASE_P): Reimplement. (BINFO_VBASE_PRIMARY_P): Likewise. (BINFO_PRIMARY_BASE_OF): New macro. (BINFO_INDIRECT_PRIMARY_P): Likewise. (get_primary_binfo): New function. * decl.c (lang_mark_tree): Make lang_type::primary_base. * class.c (vcall_offset_data_s): Rename to ... (vtbl_init_data_s): ... this. Rename primary_p to primary_vtbl_p, and add ctor_vtbl_p. (get_derived_offset): Use get_primary_binfo. (dfs_mark_primary_bases): Adjust handling of virtual primary bases. (mark_primary_bases): Likewise. (set_primary_base): Take a binfo, not an integer, as a representation of the primary base. (indirect_primary_base_p): Remove. (determine_primary_base): Adjust for indirect primary bases. (dfs_find_final_overrider): Fix typo in coment. (update_vtable_entry_for_fn): Use get_primary_binfo. (layout_nonempty_base_or_field): Tweak. (build_base_fields): Adjust for new primary base semantics. (dfs_propagate_binfo_offsets): Remove. (propagate_binfo_offsets): Rewrite. (dfs_set_offset_for_shared_vbases): Remove. (layout_virtual_bases): Don't use it. (layout_class_type): Set CLASSTYPE_SIZE correctly under the new ABI. (finish_struct_1): Set CLASSTYPE_PRIMARY_BINFO, not CLASSTYPE_VFIELD_PARENT. (dfs_get_primary_binfo): New function. (get_primary_binfo): Likewise. (dump_class_hierarchy_r): Tweak printing of primary bases. (build_vtbl_initializer): Fix typo in comments. Use vtbl_init_data. (build_vcall_and_vbase_vtbl_entries): Likewise. (build_vbaes_offset_vtbl_entries): Likewise. (dfs_build_vcall_offset_vtbl_entries): Adjust setting of BV_VCALL_INDEX to handle indirect primary bases. (build_vcall_offset_vtbl_entries): Use vtbl_init_data. (build_rtti_vtbl_entries): Likewise. * search.c (get_shared_vbase_if_not_primary): Tweak. (find_vbase_instance): Likewise. (binfo_for_vtable): Simplify. * tree.c (unshare_base_binfos): Clear BINFO_PRIMARY_BASE_OF. (make_binfo): Make it have 11 entries. From-SVN: r35360
2000-07-31 02:24:44 +02:00
(CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE)
/* If non-NULL, this is the binfo for the primary base class, i.e.,
the base class which contains the virtual function table pointer
for this class. */
#define CLASSTYPE_PRIMARY_BINFO(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->primary_base)
/* A vector of BINFOs for the direct and indirect virtual base classes
Correct many new ABI issues regarding vbase and vcall offset layout. Correct many new ABI issues regarding vbase and vcall offset layout. * cp-tree.h (BINFO_VTABLE): Document. (struct lang_type): Tweak formatting. (BINFO_PRIMARY_BINFO): Add to documentation. (CLASSTYPE_VSIZE): Fix typo in comment. (CLASSTYPE_VBASECLASSES): Update documentation. (BINFO_VBASE_MARKED): Remove. (SET_BINFO_VBASE_MARKED): Likewise. (CLEAR_BINFO_VBASE_MARKED): Likewise. (BINFO_FIELDS_MARKED): Remove. (SET_BINFO_FIELDS_MARKED): Likewise. (CLEAR_BINFO_FIELDS_MARKED): Likewise. (enum access_kind): New enumeration. (num_extra_vtbl_entries): Remove declaration. (size_extra_vtbl_entries): Likewise. (get_vtbl_decl_for_binfo): New function. (dfs_vbase_unmark): Remove declaration. (mark_primary_bases): Likewise. * class.c (SAME_FN): Remove. (struct vcall_offset_data_s): Move definition. (build_vbase_pointer): Use `build', not `build_binary_op', to access the vbase pointer under the new ABI. (build_vtable_entry_ref): Use get_vtbl_decl_for_binfo. (build_primary_vtable): Likewise. (dfs_mark_primary_bases): Move here from search.c. (mark_primary_bases): Likewise. (determine_primary_bases): Under the new ABI, don't make a base class a primary base just because we don't yet have any virtual functions. (layout_vtable_decl): Use get_vtbl_decl_for_binfo. (num_vfun_entries): Remove. (dfs_count_virtuals): Likewise. (num_extra_vtbl_entries): Likewise. (size_extra_vtbl_entries): Likewise. (layout_virtual_bases): Iterate in inheritance graph order under the new ABI. (finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to indicate that a vfield is present. (init_class_processing): Initialize access_public_node, etc., from ak_public, etc. (get_vtbl_decl_for_binfo): New function. (dump_class_hierarchy_r): Likewise. (dump_class_hierarchy): Use it. (finish_vtbls): Build the vtbls in inheritance graph order. (dfs_finish_vtbls): Adjust call to build_vtbl_initializer. (initialize_vtable): Use get_vtbl_decl_for_binfo. (accumulate_vtbl_inits): Add comments explaining why a pre-order walk is required. (dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location where the vptr points, even for primary vtables. (build_vtbl_initializer): Adjust handling of vbase and vcall offsets. (build_vcall_and_vbase_vtable_entries): New function. (dfs_build_vbase_offset_vtbl_entries): Remove. (build_vbase_offset_vtbl_entries): Reimplement. (dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that were already handled in a primary base class vtable. (build_vcall_offset_vtbl_entries): Adjust. (build_rtti_vtbl_entries): Adjust. * decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo. * init.c (expand_virtual_init): Simplify. * repo.c (repo_get_id): Use get_vtbl_decl_for_binfo. * rtti.c (create_pseudo_type_info): Adjust calculation of vptr. * search.c (BINFO_ACCESS): New macro. (SET_BINFO_ACCESS): Likewise. (dfs_access_in_type): Manipulate access_kinds, not access nodes. (access_in_type): Likewise. (dfs_accessible_p): Likewise. (protected_accessible_p): Likewise. (lookup_fnfields_1): Adjust documentation. (dfs_mark_primary_bases): Move to class.c (mark_primary_bases): Likewise. (dfs_vbase_unmark): Remove. (virtual_context): Use BINFO_FOR_VBASE. (dfs_get_vbase_types): Simplify. (dfs_build_inheritance_graph_order): New function. (get_vbase_types): Use it. * tree.c (debug_binfo): Use get_vtbl_decl_for_binfo. * tinfo.cc (get_vbase_offset): New function. (__vmi_class_type_info::do_find_public_src): Use it. (__vmi_class_type_info::do_dyncast): Likewise. (__vmi_class_type_info::do_upcast): Likewise. From-SVN: r32905
2000-04-04 20:13:22 +02:00
that this type uses in a post-order depth-first left-to-right
order. (In other words, these bases appear in the order that they
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
should be initialized.) */
#define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases)
store-layout.c (finish_record_layout): Add free_p parameter. * store-layout.c (finish_record_layout): Add free_p parameter. (layout_type): Pass it. * tree.h (finish_record_layout): Update prototype. * class.c (walk_subobject_offsets): Correct the calculation of offsets for virtual bases. Correct the counting of array elements. (layout_nonempty_base_or_field): Simplify. Correct the calculation of offsets to be propagated through the binfo hierarchy. (build_base_field): Avoid creating a FIELD_DECL for empty bases. Add the FIELD_DECL to TYPE_FIELDS. (build_base_fields): Adjust accordingly. (layout_virtual_bases): Use build_base_field. (end_of_class): Return a tree, not an integer. (warn_about_ambiguous_direct_bases): Rename to ... (warn_about_ambiguous_bases): ... this. (include_empty_classes): New function. (layout_class_type): Create an alternative version of the type to be used when as a base class type. Do not call finish_record_layout until we are done laying out the class. * cp-tree.h (lang_type_class): Remove size, size_unit. Add as_base. (CLASSTYPE_SIZE): Reimplement. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN): Likweise. (CLASSTYPE_USER_ALIGN): Likewise. (CLASSTYPE_AS_BASE): New macro. (DECL_INITIALIZED_P): Likewise. (extract_init): Remove prototype. (build_forced_zero_init): Rename to ... (build_zero_init): ... this. (force_store_init_value): Remove. * decl.c (obscure_complex_init): Remove. (duplicate_decls): Copy DECL_INITIALIZED_P. (check_initializer): Do not leave junk in DECL_INITIAL. (cp_finish_decl): Handle zero-initialization of entities with static storage duration. * expr.c (extract_init): Remove. * init.c (build_forced_zero_init): Remove. (build_zero_init): New function. (build_default_init): Use it. (build_field_list): Skip FIELD_DECLs for base subobjects. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. (synthesize_exception_spec): Likewise. * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P. (regenerate_decl_from_template): To not set DECL_INITIAL for a static data member whose initialization took place in its class. (instantiate_decl): Do not pass an initializer to cp_finish_decl in that situation. * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects. (dfs_unuse_fields): Likewise. * tree.c (pod_type_p): Handle error_mark_node. (zero_init_p): Likewise. * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base subobjects. * typeck2.c (store_init_value): Remove #if 0'd code. (force_store_init_value): Remove. (process_init_constructor): Use build_zero_init. * g++.dg/abi/empty7.C: New test. * g++.dg/init/pm2.C: Likewise. From-SVN: r57654
2002-09-30 18:52:19 +02:00
/* The type corresponding to NODE when NODE is used as a base class,
i.e., NODE without virtual base classes or tail padding. */
store-layout.c (finish_record_layout): Add free_p parameter. * store-layout.c (finish_record_layout): Add free_p parameter. (layout_type): Pass it. * tree.h (finish_record_layout): Update prototype. * class.c (walk_subobject_offsets): Correct the calculation of offsets for virtual bases. Correct the counting of array elements. (layout_nonempty_base_or_field): Simplify. Correct the calculation of offsets to be propagated through the binfo hierarchy. (build_base_field): Avoid creating a FIELD_DECL for empty bases. Add the FIELD_DECL to TYPE_FIELDS. (build_base_fields): Adjust accordingly. (layout_virtual_bases): Use build_base_field. (end_of_class): Return a tree, not an integer. (warn_about_ambiguous_direct_bases): Rename to ... (warn_about_ambiguous_bases): ... this. (include_empty_classes): New function. (layout_class_type): Create an alternative version of the type to be used when as a base class type. Do not call finish_record_layout until we are done laying out the class. * cp-tree.h (lang_type_class): Remove size, size_unit. Add as_base. (CLASSTYPE_SIZE): Reimplement. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN): Likweise. (CLASSTYPE_USER_ALIGN): Likewise. (CLASSTYPE_AS_BASE): New macro. (DECL_INITIALIZED_P): Likewise. (extract_init): Remove prototype. (build_forced_zero_init): Rename to ... (build_zero_init): ... this. (force_store_init_value): Remove. * decl.c (obscure_complex_init): Remove. (duplicate_decls): Copy DECL_INITIALIZED_P. (check_initializer): Do not leave junk in DECL_INITIAL. (cp_finish_decl): Handle zero-initialization of entities with static storage duration. * expr.c (extract_init): Remove. * init.c (build_forced_zero_init): Remove. (build_zero_init): New function. (build_default_init): Use it. (build_field_list): Skip FIELD_DECLs for base subobjects. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. (synthesize_exception_spec): Likewise. * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P. (regenerate_decl_from_template): To not set DECL_INITIAL for a static data member whose initialization took place in its class. (instantiate_decl): Do not pass an initializer to cp_finish_decl in that situation. * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects. (dfs_unuse_fields): Likewise. * tree.c (pod_type_p): Handle error_mark_node. (zero_init_p): Likewise. * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base subobjects. * typeck2.c (store_init_value): Remove #if 0'd code. (force_store_init_value): Remove. (process_init_constructor): Use build_zero_init. * g++.dg/abi/empty7.C: New test. * g++.dg/init/pm2.C: Likewise. From-SVN: r57654
2002-09-30 18:52:19 +02:00
#define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base)
/* True iff NODE is the CLASSTYPE_AS_BASE version of some type. */
#define IS_FAKE_BASE_TYPE(NODE) \
(TREE_CODE (NODE) == RECORD_TYPE \
&& TYPE_CONTEXT (NODE) && CLASS_TYPE_P (TYPE_CONTEXT (NODE)) \
&& CLASSTYPE_AS_BASE (TYPE_CONTEXT (NODE)) == (NODE))
/* These are the size and alignment of the type without its virtual
base classes, for when we use this type as a base itself. */
store-layout.c (finish_record_layout): Add free_p parameter. * store-layout.c (finish_record_layout): Add free_p parameter. (layout_type): Pass it. * tree.h (finish_record_layout): Update prototype. * class.c (walk_subobject_offsets): Correct the calculation of offsets for virtual bases. Correct the counting of array elements. (layout_nonempty_base_or_field): Simplify. Correct the calculation of offsets to be propagated through the binfo hierarchy. (build_base_field): Avoid creating a FIELD_DECL for empty bases. Add the FIELD_DECL to TYPE_FIELDS. (build_base_fields): Adjust accordingly. (layout_virtual_bases): Use build_base_field. (end_of_class): Return a tree, not an integer. (warn_about_ambiguous_direct_bases): Rename to ... (warn_about_ambiguous_bases): ... this. (include_empty_classes): New function. (layout_class_type): Create an alternative version of the type to be used when as a base class type. Do not call finish_record_layout until we are done laying out the class. * cp-tree.h (lang_type_class): Remove size, size_unit. Add as_base. (CLASSTYPE_SIZE): Reimplement. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN): Likweise. (CLASSTYPE_USER_ALIGN): Likewise. (CLASSTYPE_AS_BASE): New macro. (DECL_INITIALIZED_P): Likewise. (extract_init): Remove prototype. (build_forced_zero_init): Rename to ... (build_zero_init): ... this. (force_store_init_value): Remove. * decl.c (obscure_complex_init): Remove. (duplicate_decls): Copy DECL_INITIALIZED_P. (check_initializer): Do not leave junk in DECL_INITIAL. (cp_finish_decl): Handle zero-initialization of entities with static storage duration. * expr.c (extract_init): Remove. * init.c (build_forced_zero_init): Remove. (build_zero_init): New function. (build_default_init): Use it. (build_field_list): Skip FIELD_DECLs for base subobjects. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. (synthesize_exception_spec): Likewise. * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P. (regenerate_decl_from_template): To not set DECL_INITIAL for a static data member whose initialization took place in its class. (instantiate_decl): Do not pass an initializer to cp_finish_decl in that situation. * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects. (dfs_unuse_fields): Likewise. * tree.c (pod_type_p): Handle error_mark_node. (zero_init_p): Likewise. * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base subobjects. * typeck2.c (store_init_value): Remove #if 0'd code. (force_store_init_value): Remove. (process_init_constructor): Use build_zero_init. * g++.dg/abi/empty7.C: New test. * g++.dg/init/pm2.C: Likewise. From-SVN: r57654
2002-09-30 18:52:19 +02:00
#define CLASSTYPE_SIZE(NODE) TYPE_SIZE (CLASSTYPE_AS_BASE (NODE))
#define CLASSTYPE_SIZE_UNIT(NODE) TYPE_SIZE_UNIT (CLASSTYPE_AS_BASE (NODE))
#define CLASSTYPE_ALIGN(NODE) TYPE_ALIGN (CLASSTYPE_AS_BASE (NODE))
#define CLASSTYPE_USER_ALIGN(NODE) TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE))
1994-02-24 02:02:37 +01:00
/* The alignment of NODE, without its virtual bases, in bytes. */
#define CLASSTYPE_ALIGN_UNIT(NODE) \
(CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT)
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
/* A vec<tree> of virtual functions which cannot be inherited by
1994-02-24 02:02:37 +01:00
derived classes. When deriving from this type, the derived
class must provide its own definition for each of these functions. */
#define CLASSTYPE_PURE_VIRTUALS(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals)
1994-02-24 02:02:37 +01:00
/* Nonzero means that this type is an abstract class type. */
#define ABSTRACT_CLASS_TYPE_P(NODE) \
(CLASS_TYPE_P (NODE) && CLASSTYPE_PURE_VIRTUALS(NODE))
1994-02-24 02:02:37 +01:00
/* Nonzero means that this type has an X() constructor. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor)
1994-02-24 02:02:37 +01:00
/* Nonzero means that this type contains a mutable member. */
#define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable)
#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
/* Nonzero means that this class type is not POD for the purpose of layout
(as defined in the ABI). This is different from the language's POD. */
#define CLASSTYPE_NON_LAYOUT_POD_P(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class)
/* Nonzero means that this class type is a non-standard-layout class. */
#define CLASSTYPE_NON_STD_LAYOUT(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->non_std_layout)
/* Nonzero means that this class type does have unique object
representations. */
#define CLASSTYPE_UNIQUE_OBJ_REPRESENTATIONS(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->unique_obj_representations)
/* Nonzero means that this class type has
CLASSTYPE_UNIQUE_OBJ_REPRESENTATIONS computed. */
#define CLASSTYPE_UNIQUE_OBJ_REPRESENTATIONS_SET(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->unique_obj_representations_set)
/* Nonzero means that this class contains pod types whose default
initialization is not a zero initialization (namely, pointers to
data members). */
#define CLASSTYPE_NON_ZERO_INIT_P(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init)
/* Nonzero if this class is "empty" in the sense of the C++ ABI. */
#define CLASSTYPE_EMPTY_P(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->empty_p)
/* Nonzero if this class is "nearly empty", i.e., contains only a
virtual function table pointer. */
#define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p)
/* Nonzero if this class contains an empty subobject. */
#define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->contains_empty_class_p)
/* A list of class types of which this type is a friend. The
TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
case of a template friend. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define CLASSTYPE_FRIEND_CLASSES(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->friend_classes)
1994-02-24 02:02:37 +01:00
/* A list of the classes which grant friendship to this class. */
#define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes)
/* The associated LAMBDA_EXPR that made this class. */
#define CLASSTYPE_LAMBDA_EXPR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->lambda_expr)
/* The extra mangling scope for this closure type. */
#define LAMBDA_TYPE_EXTRA_SCOPE(NODE) \
(LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR (NODE)))
1994-02-24 02:02:37 +01:00
/* Say whether this node was declared as a "class" or a "struct". */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define CLASSTYPE_DECLARED_CLASS(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->declared_class)
1994-02-24 02:02:37 +01:00
/* Nonzero if this class has const members
which have no specified initialization. */
#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
(TYPE_LANG_SPECIFIC (NODE) \
? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0)
#define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE))
/* Nonzero if this class has ref members
which have no specified initialization. */
#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
(TYPE_LANG_SPECIFIC (NODE) \
? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0)
#define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE))
1994-02-24 02:02:37 +01:00
/* Nonzero if this class is included from a header file which employs
`#pragma interface', and it is not included in its implementation file. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define CLASSTYPE_INTERFACE_ONLY(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->interface_only)
1994-02-24 02:02:37 +01:00
/* True if we have already determined whether or not vtables, VTTs,
typeinfo, and other similar per-class data should be emitted in
this translation unit. This flag does not indicate whether or not
these items should be emitted; it only indicates that we know one
way or the other. */
#define CLASSTYPE_INTERFACE_KNOWN(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown == 0)
/* The opposite of CLASSTYPE_INTERFACE_KNOWN. */
#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown)
#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \
(LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = !!(X))
#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 1)
#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 0)
1994-02-24 02:02:37 +01:00
/* Nonzero if a _DECL node requires us to output debug info for this class. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define CLASSTYPE_DEBUG_REQUESTED(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->debug_requested)
1994-02-24 02:02:37 +01:00
/* Additional macros for inheritance information. */
/* Nonzero means that this class is on a path leading to a new vtable. */
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
#define BINFO_VTABLE_PATH_MARKED(NODE) BINFO_FLAG_1 (NODE)
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
/* Nonzero means B (a BINFO) has its own vtable. Any copies will not
have this flag set. */
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
#define BINFO_NEW_VTABLE_MARKED(B) (BINFO_FLAG_2 (B))
/* Compare a BINFO_TYPE with another type for equality. For a binfo,
this is functionally equivalent to using same_type_p, but
measurably faster. At least one of the arguments must be a
BINFO_TYPE. The other can be a BINFO_TYPE or a regular type. If
BINFO_TYPE(T) ever stops being the main variant of the class the
binfo is for, this macro must change. */
#define SAME_BINFO_TYPE_P(A, B) ((A) == (B))
/* Any subobject that needs a new vtable must have a vptr and must not
invoke.texi (-fdump-class-layout): Document. gcc: * invoke.texi (-fdump-class-layout): Document. (-fdump-translation-unit): Use `=' as filename separator. cp: Fix specification and implementation bugs in V3 ABI construction vtables. * cp-tree.h (flag_dump_class_layout): New flag. (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove. (BINFO_LOST_PRIMARY_P): New flag. (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts. (BINFO_PRIMARY_MARKED_P): Rename to ... (BINFO_PRIMARY_P): ... here. (binfo_via_virtual): New prototype. * decl2.c (flag_dump_class_layout): New flag. (cxx_decode_option): Set it. Adjust -fdump-translation-unit to use `=' as a file name separator. * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary bases. (build_vtbl_address): If this is a virtual primary base, then get the vtbl of what it is ultimately primary for. * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust for BINFO_PRIMARY_P. (dfs_skip_nonprimary_vbases_markedp): Likewise. (get_shared_vbase_if_not_primary): Likewise. (dfs_get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. (fixup_virtual_upcast_offsets): Likewise. (dfs_find_vbase_instance): Likewise. (find_vbase_instance): Likewise. (binfo_from_vbase): Adjust comment to reflect reality. (binfo_via_virtual): New function. * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros for binfo walking during VTT construction. (dfs_mark_primary_bases): Remove. (force_canonical_binfo_r): New function. (force_canonical_binfo): New function. (mark_primary_virtual_base): New function. (mark_primary_bases): Walk in inheritance graph order, use mark_primary_virtual_base. (determine_primary_base): Use some more intermediate variables. (dfs_find_final_overrider): Don't check for overriding along a virtual path. (dfs_modify_vtables): Walk into primary virtual bases too. (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P. (build_base_fields): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. (end_of_class): Likewise. (finish_struct_1): Call dump_class_hierarchy, if requested. (dfs_get_primary_binfo): Use BINFO_TYPE for binfos. (dump_class_hierarchy_r): Add stream parameter. Emit more information. (dump_class_hierarchy): Add file parameter. Append to file, if required. (finish_vtbls): Adjust accumulate_vtbl_inits call. Use canonical base for virtual bases. (build_vtt): Add more comments. Adjust build_vtt_inits call. (build_vtt_inits): Remove VIRTUAL_VTTS_P parm. Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for virtual VTTs. (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P from DATA. We want virtual primary bases and all bases via virtual. Only set BINFO_VPTR_INDEX for top level. Look up from a primary virtual base when not a construction vtable. (dfs_ctor_vtable_bases_queue_p): New DFS predicate. (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call. Use canonical bases when processing virtual bases. (accumulate_vtbl_inits): We're interested in any base via a virtual path. (dfs_accumulate_vtbl_inits): If this is a primary virtual base within a construction vtable, determine what is being overridden. (build_vtbl_initializer): Add more comments (add_vcall_offset_vtbl_entries_1): Adjust comment. (build_rtti_vtbl_entries): Check if the base has lost its primary. testsuite: * g++.old-deja/g++.abi/primary2.C: New test. * g++.old-deja/g++.abi/primary3.C: New test. * g++.old-deja/g++.abi/primary4.C: New test. * g++.old-deja/g++.abi/primary5.C: New test. * g++.old-deja/g++.abi/vtable3.h: New test. * g++.old-deja/g++.abi/vtable3a.C: New test. * g++.old-deja/g++.abi/vtable3b.C: New test. * g++.old-deja/g++.abi/vtable3c.C: New test. * g++.old-deja/g++.abi/vtable3d.C: New test. * g++.old-deja/g++.abi/vtable3e.C: New test. * g++.old-deja/g++.abi/vtable3f.C: New test. * g++.old-deja/g++.abi/vtable3g.C: New test. * g++.old-deja/g++.abi/vtable3h.C: New test. * g++.old-deja/g++.abi/vtable3i.C: New test. * g++.old-deja/g++.abi/vtable3j.C: New test. * g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL. From-SVN: r39455
2001-02-05 12:45:16 +01:00
be a non-virtual primary base (since it would then use the vtable from a
derived class and never become non-primary.) */
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
#define SET_BINFO_NEW_VTABLE_MARKED(B) \
(BINFO_NEW_VTABLE_MARKED (B) = 1, \
gcc_assert (!BINFO_PRIMARY_P (B) || BINFO_VIRTUAL_P (B)), \
gcc_assert (TYPE_VFIELD (BINFO_TYPE (B))))
1994-02-24 02:02:37 +01:00
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
/* Nonzero if this binfo is for a dependent base - one that should not
be searched. */
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
#define BINFO_DEPENDENT_BASE_P(NODE) BINFO_FLAG_3 (NODE)
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
invoke.texi (-fdump-class-layout): Document. gcc: * invoke.texi (-fdump-class-layout): Document. (-fdump-translation-unit): Use `=' as filename separator. cp: Fix specification and implementation bugs in V3 ABI construction vtables. * cp-tree.h (flag_dump_class_layout): New flag. (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove. (BINFO_LOST_PRIMARY_P): New flag. (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts. (BINFO_PRIMARY_MARKED_P): Rename to ... (BINFO_PRIMARY_P): ... here. (binfo_via_virtual): New prototype. * decl2.c (flag_dump_class_layout): New flag. (cxx_decode_option): Set it. Adjust -fdump-translation-unit to use `=' as a file name separator. * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary bases. (build_vtbl_address): If this is a virtual primary base, then get the vtbl of what it is ultimately primary for. * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust for BINFO_PRIMARY_P. (dfs_skip_nonprimary_vbases_markedp): Likewise. (get_shared_vbase_if_not_primary): Likewise. (dfs_get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. (fixup_virtual_upcast_offsets): Likewise. (dfs_find_vbase_instance): Likewise. (find_vbase_instance): Likewise. (binfo_from_vbase): Adjust comment to reflect reality. (binfo_via_virtual): New function. * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros for binfo walking during VTT construction. (dfs_mark_primary_bases): Remove. (force_canonical_binfo_r): New function. (force_canonical_binfo): New function. (mark_primary_virtual_base): New function. (mark_primary_bases): Walk in inheritance graph order, use mark_primary_virtual_base. (determine_primary_base): Use some more intermediate variables. (dfs_find_final_overrider): Don't check for overriding along a virtual path. (dfs_modify_vtables): Walk into primary virtual bases too. (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P. (build_base_fields): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. (end_of_class): Likewise. (finish_struct_1): Call dump_class_hierarchy, if requested. (dfs_get_primary_binfo): Use BINFO_TYPE for binfos. (dump_class_hierarchy_r): Add stream parameter. Emit more information. (dump_class_hierarchy): Add file parameter. Append to file, if required. (finish_vtbls): Adjust accumulate_vtbl_inits call. Use canonical base for virtual bases. (build_vtt): Add more comments. Adjust build_vtt_inits call. (build_vtt_inits): Remove VIRTUAL_VTTS_P parm. Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for virtual VTTs. (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P from DATA. We want virtual primary bases and all bases via virtual. Only set BINFO_VPTR_INDEX for top level. Look up from a primary virtual base when not a construction vtable. (dfs_ctor_vtable_bases_queue_p): New DFS predicate. (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call. Use canonical bases when processing virtual bases. (accumulate_vtbl_inits): We're interested in any base via a virtual path. (dfs_accumulate_vtbl_inits): If this is a primary virtual base within a construction vtable, determine what is being overridden. (build_vtbl_initializer): Add more comments (add_vcall_offset_vtbl_entries_1): Adjust comment. (build_rtti_vtbl_entries): Check if the base has lost its primary. testsuite: * g++.old-deja/g++.abi/primary2.C: New test. * g++.old-deja/g++.abi/primary3.C: New test. * g++.old-deja/g++.abi/primary4.C: New test. * g++.old-deja/g++.abi/primary5.C: New test. * g++.old-deja/g++.abi/vtable3.h: New test. * g++.old-deja/g++.abi/vtable3a.C: New test. * g++.old-deja/g++.abi/vtable3b.C: New test. * g++.old-deja/g++.abi/vtable3c.C: New test. * g++.old-deja/g++.abi/vtable3d.C: New test. * g++.old-deja/g++.abi/vtable3e.C: New test. * g++.old-deja/g++.abi/vtable3f.C: New test. * g++.old-deja/g++.abi/vtable3g.C: New test. * g++.old-deja/g++.abi/vtable3h.C: New test. * g++.old-deja/g++.abi/vtable3i.C: New test. * g++.old-deja/g++.abi/vtable3j.C: New test. * g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL. From-SVN: r39455
2001-02-05 12:45:16 +01:00
/* Nonzero if this binfo has lost its primary base binfo (because that
is a nearly-empty virtual base that has been taken by some other
base in the complete hierarchy. */
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
#define BINFO_LOST_PRIMARY_P(NODE) BINFO_FLAG_4 (NODE)
/* Nonzero if this BINFO is a primary base class. */
#define BINFO_PRIMARY_P(NODE) BINFO_FLAG_5(NODE)
Allow indirect primary bases. * cp-tree.h (struct lang_type): Remove vfield_parent. Add primary_base. (CLASSTYPE_VFIELD_PARENT): Remove. (CLASSTYPE_PRIMARY_BINFO): Reimplement. (BINFO_PRIMARY_BINFO): Remove. (CLASSTYPE_HAS_PRIMARY_BASE_P): Reimplement. (BINFO_VBASE_PRIMARY_P): Likewise. (BINFO_PRIMARY_BASE_OF): New macro. (BINFO_INDIRECT_PRIMARY_P): Likewise. (get_primary_binfo): New function. * decl.c (lang_mark_tree): Make lang_type::primary_base. * class.c (vcall_offset_data_s): Rename to ... (vtbl_init_data_s): ... this. Rename primary_p to primary_vtbl_p, and add ctor_vtbl_p. (get_derived_offset): Use get_primary_binfo. (dfs_mark_primary_bases): Adjust handling of virtual primary bases. (mark_primary_bases): Likewise. (set_primary_base): Take a binfo, not an integer, as a representation of the primary base. (indirect_primary_base_p): Remove. (determine_primary_base): Adjust for indirect primary bases. (dfs_find_final_overrider): Fix typo in coment. (update_vtable_entry_for_fn): Use get_primary_binfo. (layout_nonempty_base_or_field): Tweak. (build_base_fields): Adjust for new primary base semantics. (dfs_propagate_binfo_offsets): Remove. (propagate_binfo_offsets): Rewrite. (dfs_set_offset_for_shared_vbases): Remove. (layout_virtual_bases): Don't use it. (layout_class_type): Set CLASSTYPE_SIZE correctly under the new ABI. (finish_struct_1): Set CLASSTYPE_PRIMARY_BINFO, not CLASSTYPE_VFIELD_PARENT. (dfs_get_primary_binfo): New function. (get_primary_binfo): Likewise. (dump_class_hierarchy_r): Tweak printing of primary bases. (build_vtbl_initializer): Fix typo in comments. Use vtbl_init_data. (build_vcall_and_vbase_vtbl_entries): Likewise. (build_vbaes_offset_vtbl_entries): Likewise. (dfs_build_vcall_offset_vtbl_entries): Adjust setting of BV_VCALL_INDEX to handle indirect primary bases. (build_vcall_offset_vtbl_entries): Use vtbl_init_data. (build_rtti_vtbl_entries): Likewise. * search.c (get_shared_vbase_if_not_primary): Tweak. (find_vbase_instance): Likewise. (binfo_for_vtable): Simplify. * tree.c (unshare_base_binfos): Clear BINFO_PRIMARY_BASE_OF. (make_binfo): Make it have 11 entries. From-SVN: r35360
2000-07-31 02:24:44 +02:00
/* Used by various search routines. */
#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
1994-02-24 02:02:37 +01:00
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
/* A vec<tree_pair_s> of the vcall indices associated with the class
NODE. The PURPOSE of each element is a FUNCTION_DECL for a virtual
function. The VALUE is the index into the virtual table where the
vcall offset for that function is stored, when NODE is a virtual
base. */
call.c (build_special_member_call): Do not try to lookup VTTs by name. * call.c (build_special_member_call): Do not try to lookup VTTs by name. * class.c (vtbl_init_data): Add generate_vcall_entries. (get_vtable_decl): Do not look up virtual tables by name. (copy_virtuals): Do not use BV_USE_VCALL_INDEX_P. (set_primary_base): Do not set CLASSTYPE_RTTI. (determine_primary_base): Likewise. (get_matching_virtual): Remove. (get_vcall_index): New function. (update_vtable_entry_for_fn): Do not try to use virtual thunks when they are not required. Assign vcall indices at this point. (finish_struct_1): Do not set CLASSTYPE_NEEDS_VIRTUAL_REINIT. Do update dynamic_classes. (build_vtt): Do not add VTTs to the symbol table. (build_ctor_vtbl_group): Likewise. (build_vtbl_initializer): Simplify handling of vcall indices. (build_vcall_offset_vtbl_entries): Pretend to build vcall offsets for the most derived class. (add_vcall_offset_vtbl_entries_1): But do not actually add them to the vtable. * cp-tree.h (dynamic_classes): New macro. (lang_type_class): Remove rtti. Add vtables. Add vcall_indices. (CLASSTYPE_RTTI): Remove. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Remove. (CLASSTYPE_VCALL_INDICES): New macro. (CLASSTYPE_VTABLES): Likewise. (BV_USE_VCALL_INDEX_P): Remove. (build_vtable_path): Remove. * decl2.c (finish_vtable_vardecl): Remove. (key_method): Remove #if 0'd code. (finish_vtable_vardecl): Rename to ... (maybe_emit_vtables): ... this. (finish_file): Use it. * search.c (look_for_overrides_here): Update comment. * g++.dg/abi/thunk1.C: New test. * g++.dg/abi/thunk2.C: Likewise. * g++.dg/abi/vtt1.C: Likewise. From-SVN: r58779
2002-11-04 02:45:58 +01:00
#define CLASSTYPE_VCALL_INDICES(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices)
/* The various vtables for the class NODE. The primary vtable will be
first, followed by the construction vtables and VTT, if any. */
#define CLASSTYPE_VTABLES(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->vtables)
/* The std::type_info variable representing this class, or NULL if no
such variable has been created. This field is only set for the
TYPE_MAIN_VARIANT of the class. */
#define CLASSTYPE_TYPEINFO_VAR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->typeinfo_var)
/* Accessor macros for the BINFO_VIRTUALS list. */
/* The number of bytes by which to adjust the `this' pointer when
calling this virtual function. Subtract this value from the this
pointer. Always non-NULL, might be constant zero though. */
#define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
/* If non-NULL, the vtable index at which to find the vcall offset
when calling this virtual function. Add the value at that vtable
index to the this pointer. */
#define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
/* The function to call. */
#define BV_FN(NODE) (TREE_VALUE (NODE))
/* Whether or not this entry is for a lost primary virtual base. */
#define BV_LOST_PRIMARY(NODE) (TREE_LANG_FLAG_0 (NODE))
1994-02-24 02:02:37 +01:00
/* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
lang-specs.h (c++-cpp-output): Pass -fpreprocessed. * lang-specs.h (c++-cpp-output): Pass -fpreprocessed. * lex.c (token_getch, token_put_back): New fns. (real_yylex): Use them. * lex.c (lang_init): Generalize. (lang_init_options): Tell cpplib this is C++. (nextchar): Remove. Replace uses with put_back. (skip_white_space): Handle linemode here. Optimize for cpplib. (extend_token_buffer_to): New fn. (extend_token_buffer): Use it. (read_line_number, check_newline): Just deal with tokens. (real_yylex): More cpplib optimizations. Simplify. Don't produce EXTERN_LANG_STRING, LEFT_RIGHT or PAREN_STAR_PAREN here. * spew.c (yylex): Produce LEFT_RIGHT and EXTERN_LANG_STRING. * parse.y (PAREN_STAR_PAREN): Remove. * input.c: Don't use the putback machinery with cpplib. (sub_getch): Fold back into getch. (getch): Don't handle linemode here. (feed_input): Unget any text in the token buffer. * lex.c (set_typedecl_interface_info, set_vardecl_interface_info, nextyychar, nextyylval): Remove. * lex.c (indent_level): New variable. (init_parse): Set cpp_token to CPP_DIRECTIVE. (consume_string): Make this smart about USE_CPPLIB. (yyungetc): Use put_back function. (pragma_getc, pragma_ungetc): Functions deleted. (check_newline): Rewrite to be intelligent about USE_CPPLIB. Also, call HANDLE_PRAGMA with getch, yyungetc, not pragma_getc and pragma_ungetc. (real_yylex): Rewrite to be intelligent about USE_CPPLIB. Also, clean up cases where we redundantly set token_buffer[0]. (read_line_number): New fn. * input.c (feed_input): Use integrated cpplib if USE_CPPLIB. (end_input): Call cpp_pop_buffer if USE_CPPLIB. (sub_getch): Conditionalize out code that's not appropriate if USE_CPPLIB. (put_back): Rewrite in case USE_CPPLIB is defined. (input_redirected): Ditto. From-SVN: r28193
1999-07-20 21:53:38 +02:00
will be NULL_TREE to indicate a throw specification of `()', or
no exceptions allowed. For a noexcept specification, TREE_VALUE
is NULL_TREE and TREE_PURPOSE is the constant-expression. For
a deferred noexcept-specification, TREE_PURPOSE is a DEFERRED_NOEXCEPT
(for templates) or an OVERLOAD list of functions (for implicitly
declared functions). */
#define TYPE_RAISES_EXCEPTIONS(NODE) \
TYPE_LANG_SLOT_1 (FUNC_OR_METHOD_CHECK (NODE))
/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'
or noexcept(true). */
#define TYPE_NOTHROW_P(NODE) nothrow_spec_p (TYPE_RAISES_EXCEPTIONS (NODE))
/* For FUNCTION_TYPE or METHOD_TYPE, true if NODE is noexcept. This is the
case for things declared noexcept(true) and, with -fnothrow-opt, for
throw() functions. */
#define TYPE_NOEXCEPT_P(NODE) type_noexcept_p (NODE)
1996-07-11 03:13:25 +02:00
/* The binding level associated with the namespace. */
#define NAMESPACE_LEVEL(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_NS_CHECK (NODE)->level)
1994-02-24 02:02:37 +01:00
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
/* Flags shared by all forms of DECL_LANG_SPECIFIC.
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
Some of the flags live here only to make lang_decl_min/fn smaller. Do
not make this struct larger than 32 bits; instead, make sel smaller. */
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
struct GTY(()) lang_decl_base {
unsigned selector : 16; /* Larger than necessary for faster access. */
Implement P0386R2 - C++17 inline variables 2016-10-11 Jakub Jelinek <jakub@redhat.com> * dwarf2out.c (gen_member_die): Handle inline static data member definitions. c-family/ * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_inline_variables. cp/ * cp-tree.h (struct lang_type): Shrink language field to 1 bit from 4. Add var_declared_inline_p field. Mention 2 spare bits. (DECL_VAR_DECLARED_INLINE_P): Define. (SET_DECL_VAR_DECLARED_INLINE_P): Define. (DECL_INLINE_VAR_P): Define. (diagnose_inline_vars_for_namespace): Declare. * decl.c (diagnose_inline_vars_for_namespace): New function. (duplicate_decls): For static data members copy DECL_DECLARED_CONSTEXPR_P. (redeclaration_error_message): Handle C++17 redundant redeclaration of constexpr static data member outside of class. (maybe_commonize_var): Handle inline variables. (check_initializer): Ignore inline variables for diagnostics. Adjust diagnostic wording for C++17. (make_rtl_for_nonlocal_decl): Allow in-class definition of inline static data members. (bad_specifiers): Don't diagnose inline on variables here. (grokvardecl): Add inlinep argument, non-static const inline variables are TREE_PUBLIC. (check_static_variable_definition): Return early also for inline variables. (grokdeclarator): Handle inline variables and inline static data members. * typeck2.c (store_init_value): Don't diagnose non-constant initializers for non-constexpr inline static data members. * decl2.c (vague_linkage_p): Return true for inline variables. (c_parse_final_cleanups): In-class declaration of inline static data members is a definition. Call diagnose_inline_vars_for_namespace through walk_namespaces. * pt.c (instantiate_decl): Set pattern_defined for in-class definitions of inline static data members. From-SVN: r241137
2016-10-13 21:26:54 +02:00
ENUM_BITFIELD(languages) language : 1;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
unsigned use_template : 2;
unsigned not_really_extern : 1; /* var or fn */
unsigned initialized_in_class : 1; /* var or fn */
unsigned repo_available_p : 1; /* var or fn */
unsigned threadprivate_or_deleted_p : 1; /* var or fn */
unsigned anticipated_p : 1; /* fn, type or template */
builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, [...]): New. gcc/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. * cgraph.h (enum cgraph_simd_clone_arg_type): Add SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP, SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP. (struct cgraph_simd_clone_arg): Adjust comment. * coretypes.h (struct gomp_ordered): New forward decl. * gimple.c (gimple_build_omp_critical): Add CLAUSES argument, set critical clauses to it. (gimple_build_omp_ordered): Return gomp_ordered * instead of gimple *. Add CLAUSES argument, set ordered clauses to it. (gimple_copy): Unshare clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimple.def (GIMPLE_OMP_ORDERED): Change from GSS_OMP to GSS_OMP_SINGLE_LAYOUT, move it after GIMPLE_OMP_TEAMS. * gimple.h (enum gf_mask): Add GF_OMP_TASK_TASKLOOP. Add another bit to GF_OMP_FOR_KIND_MASK mask. Add GF_OMP_FOR_KIND_TASKLOOP, renumber GF_OMP_FOR_KIND_CILKFOR and GF_OMP_FOR_KIND_OACC_LOOP. Adjust GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED and GF_OMP_FOR_COMBINED_INTO. Add another bit to GF_OMP_TARGET_KIND_MASK mask. Add GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, renumber GF_OMP_TARGET_KIND_OACC_{PARALLEL,KERNELS,DATA,UPDATE,ENTER_EXIT_DATA}. (gomp_critical): Add clauses field. (gomp_ordered): New struct. (is_a_helper <gomp_ordered *>::test): New inline. (gimple_build_omp_critical): Add CLAUSES argument. (gimple_build_omp_ordered): Likewise. Return gomp_ordered * instead of gimple *. (gimple_omp_critical_clauses, gimple_omp_critical_clauses_ptr, gimple_omp_critical_set_clauses, gimple_omp_ordered_clauses, gimple_omp_ordered_clauses_ptr, gimple_omp_ordered_set_clauses, gimple_omp_task_taskloop_p, gimple_omp_task_set_taskloop_p): New inline functions. * gimple-pretty-print.c (dump_gimple_omp_for): Handle taskloop. (dump_gimple_omp_target): Handle enter data and exit data. (dump_gimple_omp_block): Don't handle GIMPLE_OMP_ORDERED here. (dump_gimple_omp_critical): Print clauses. (dump_gimple_omp_ordered): New function. (dump_gimple_omp_task): Handle taskloop. (pp_gimple_stmt_1): Use dump_gimple_omp_ordered for GIMPLE_OMP_ORDERED. * gimple-walk.c (walk_gimple_op): Walk clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_0LEN_ARRAY. (enum omp_region_type): Add ORT_COMBINED_TARGET and ORT_NONE. (struct gimplify_omp_ctx): Add loop_iter_var, target_map_scalars_firstprivate, target_map_pointers_as_0len_arrays and target_firstprivatize_array_bases fields. (delete_omp_context): Release loop_iter_var. (gimplify_bind_expr): Handle ORT_NONE. (maybe_fold_stmt): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (is_gimple_stmt): Return true for OMP_TASKLOOP, OMP_TEAMS and OMP_TARGET{,_DATA,_UPDATE,_ENTER_DATA,_EXIT_DATA}. (omp_firstprivatize_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle ctx->target_map_scalars_firstprivate. (omp_add_variable): Handle ORT_NONE. Allow map clause together with data sharing clauses. For data sharing clause with VLA decl on omp target/target data don't add firstprivate for the pointer. Call omp_notice_variable on TYPE_SIZE_UNIT only if it is a DECL_P. (omp_notice_threadprivate_variable): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (omp_notice_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle implicit mapping of pointers as zero length array sections and ctx->target_map_scalars_firstprivate mapping of scalars as firstprivate data sharing. (omp_check_private): Handle omp_member_access_dummy_var vars. (find_decl_expr): New function. (gimplify_scan_omp_clauses): Add CODE argument. For OMP_CLAUSE_IF complain if OMP_CLAUSE_IF_MODIFIER is present and does not match code. Handle OMP_CLAUSE_GANG separately. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. Diagnose linear clause on combined distribute {, parallel for} simd construct, unless it is the loop iterator. Handle struct element GOMP_MAP_FIRSTPRIVATE_POINTER. Handle map clauses with COMPONENT_REF. Initialize ctx->target_map_scalars_firstprivate, ctx->target_firstprivatize_array_bases and ctx->target_map_pointers_as_0len_arrays. Add firstprivate for linear clause even to target region if combined. Remove map clauses with GOMP_MAP_FIRSTPRIVATE_POINTER kind from OMP_TARGET_{,ENTER_,EXIT_}DATA. For GOMP_MAP_FIRSTPRIVATE_POINTER map kind with non-INTEGER_CST OMP_CLAUSE_SIZE firstprivatize the bias. Handle OMP_CLAUSE_DEPEND_{SINK,SOURCE}. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. For linear clause on worksharing loop combined with parallel add shared clause on the parallel. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set DECL_NAME on omp_member_access_dummy_var vars. Add lastprivate clause to outer taskloop if needed. (gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_0LEN_ARRAY. If gimplify_omp_ctxp->target_firstprivatize_array_bases, use GOMP_MAP_FIRSTPRIVATE_POINTER map kind instead of GOMP_MAP_POINTER. (gimplify_adjust_omp_clauses): Add CODE argument. Handle removal of GOMP_MAP_FIRSTPRIVATE_POINTER struct elements for struct not seen in target body. Handle removal of struct mapping if struct is not seen in target body. Remove GOMP_MAP_STRUCT map clause on OMP_TARGET_EXIT_DATA. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Use GOMP_MAP_FIRSTPRIVATE_POINTER instead of GOMP_MAP_POINTER if ctx->target_firstprivatize_array_bases for VLAs. Set OMP_CLAUSE_MAP_PRIVATE if both data sharing and map clause appear together. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. Don't remove map clause if it has map-type-modifier always. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. (gimplify_oacc_cache, gimplify_omp_parallel, gimplify_omp_task): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. (gimplify_omp_for): Likewise. Handle OMP_TASKLOOP. Initialize loop_iter_var. Use OMP_FOR_ORIG_DECLS. Fix handling of lastprivate iterators in doacross loops. (gimplify_omp_workshare): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Use ORT_COMBINED_TARGET for OMP_TARGET_COMBINED. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (gimplify_omp_target_update): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Handle OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. (gimplify_omp_ordered): New function. (gimplify_expr): Handle OMP_TASKLOOP, OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. Use gimplify_omp_ordered for OMP_ORDERED. Gimplify clauses on OMP_CRITICAL. * internal-fn.c (expand_GOMP_SIMD_ORDERED_START, expand_GOMP_SIMD_ORDERED_END): New functions. * internal-fn.def (GOMP_SIMD_ORDERED_START, GOMP_SIMD_ORDERED_END): New internal functions. * omp-builtins.def (BUILT_IN_GOMP_LOOP_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_DOACROSS_POST, BUILT_IN_GOMP_DOACROSS_WAIT, BUILT_IN_GOMP_DOACROSS_ULL_POST, BUILT_IN_GOMP_DOACROSS_ULL_WAIT, BUILT_IN_GOMP_TARGET_ENTER_EXIT_DATA, BUILT_IN_GOMP_TASKLOOP, BUILT_IN_GOMP_TASKLOOP_ULL): New built-ins. (BUILT_IN_GOMP_TASK): Add INT argument to the end. (BUILT_IN_GOMP_TARGET): Rename from GOMP_target to GOMP_target_41, adjust type. (BUILT_IN_GOMP_TARGET_DATA): Rename from GOMP_target_data to GOMP_target_data_41, adjust type. (BUILT_IN_GOMP_TARGET_UPDATE): Rename from GOMP_target_update to GOMP_target_update_41, adjust type. * omp-low.c (struct omp_region): Adjust comments, add ord_stmt field. (struct omp_for_data): Add ordered and simd_schedule fields. (omp_member_access_dummy_var, unshare_and_remap_1, unshare_and_remap, is_taskloop_ctx): New functions. (is_taskreg_ctx): Use is_parallel_ctx and is_task_ctx. (extract_omp_for_data): Handle taskloops and doacross loops and simd schedule modifier. (omp_adjust_chunk_size): New function. (get_ws_args_for): Use it. (lookup_sfield): Change first argument to splay_tree_key, add overload with first argument tree. (maybe_lookup_field): Likewise. (use_pointer_for_field): Handle omp_member_access_dummy_var. (omp_copy_decl_2): If var is TREE_ADDRESSABLE listed in task_shared_vars, clear TREE_ADDRESSABLE on the copy. (build_outer_var_ref): Add LASTPRIVATE argument, handle taskloops and omp_member_access_dummy_var vars. (build_sender_ref): Change first argument to splay_tree_key, add overload with first argument tree. (install_var_field): For mask & 8 use &DECL_UID as key instead of the tree itself. (fixup_child_record_type): Const qualify *.omp_data_i. (scan_sharing_clauses): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE, C/C++ array reductions, OMP_CLAUSE_{IS,USE}_DEVICE_PTR clauses, OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,SIMDLEN,THREADS,SIMD} and OMP_CLAUSE_{NOGROUP,DEFAULTMAP} clauses, OMP_CLAUSE__LOOPTEMP_ clause on taskloop, GOMP_MAP_FIRSTPRIVATE_POINTER, OMP_CLAUSE_MAP_PRIVATE. (create_omp_child_function): Set TREE_READONLY on .omp_data_i. (find_combined_for): Allow searching for different GIMPLE_OMP_FOR kinds. (add_taskreg_looptemp_clauses): New function. (scan_omp_parallel): Use it. (scan_omp_task): Likewise. (finish_taskreg_scan): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. For taskloop, move fields for the first two _LOOPTEMP_ clauses first. (check_omp_nesting_restrictions): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Formatting fixes. Allow the sandwiched taskloop constructs. Type check OMP_CLAUSE_DEPEND_{KIND,SOURCE}. Allow ordered simd inside of simd region. Diagnose depend(source) or depend(sink:...) on target constructs or task/taskloop. (handle_simd_reference): Use get_name. (lower_rec_input_clauses): Likewise. Ignore all OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses on taskloop construct. Allow _LOOPTEMP_ clause on GOMP_TASK. Unshare new_var before passing it to omp_clause_{default,copy}_ctor. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set lastprivate_firstprivate flag for linear that needs copyin and copyout. Use BUILT_IN_ALLOCA_WITH_ALIGN instead of BUILT_IN_ALLOCA. (lower_lastprivate_clauses): For OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE on taskloop lookup decl in outer context. Pass true to build_outer_var_ref lastprivate argument. Handle OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV lastprivate if the decl is global outside of outer taskloop for. (lower_reduction_clauses): Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. (lower_send_clauses): Ignore first two _LOOPTEMP_ clauses in taskloop GOMP_TASK. Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. Handle omp_member_access_dummy_var vars. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Use new lookup_sfield overload. (lower_send_shared_vars): Ignore fields with NULL or FIELD_DECL abstract origin. Handle omp_member_access_dummy_var vars. (expand_parallel_call): Use expand_omp_build_assign. (expand_task_call): Handle taskloop construct expansion. Add REGION argument. Use GOMP_TASK_* defines instead of hardcoded integers. Add priority argument to GOMP_task* calls. Or in GOMP_TASK_FLAG_PRIORITY into flags if priority is present for GOMP_task call. (expand_omp_build_assign): Add prototype. Add AFTER argument, if true emit statements after *GSI_P and continue linking. (expand_omp_taskreg): Adjust expand_task_call caller. (expand_omp_for_init_counts): Rename zero_iter_bb argument to zero_iter1_bb and first_zero_iter to first_zero_iter1, add zero_iter2_bb and first_zero_iter2 arguments, handle computation of counts even for ordered loops. (expand_omp_for_init_vars): Handle GOMP_TASK inner_stmt. (expand_omp_ordered_source, expand_omp_ordered_sink, expand_omp_ordered_source_sink, expand_omp_for_ordered_loops): New functions. (expand_omp_for_generic): Use omp_adjust_chunk_size. Handle linear clauses on worksharing loop. Handle DOACROSS loop expansion. (expand_omp_for_static_nochunk): Handle linear clauses on worksharing loop. Adjust expand_omp_for_init_counts callers. (expand_omp_for_static_chunk): Likewise. Use omp_adjust_chunk_size. (expand_omp_simd): Handle addressable fd->loop.v. Adjust expand_omp_for_init_counts callers. (expand_omp_taskloop_for_outer, expand_omp_taskloop_for_inner): New functions. (expand_omp_for): Call expand_omp_taskloop_for_* for taskloop. Handle doacross loops. (expand_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Pass flags and depend arguments to GOMP_target_{41,update_41,enter_exit_data} libcalls. (expand_omp): Don't expand ordered depend constructs here, record ord_stmt instead for later expand_omp_for_generic. (build_omp_regions_1): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (lower_omp_ordered_clauses): New function. (lower_omp_ordered): Handle OMP_CLAUSE_SIMD, for OMP_CLAUSE_DEPEND don't lower anything. (lower_omp_for_lastprivate): Use last _looptemp_ clause on taskloop for comparison. (lower_omp_for): Handle taskloop constructs. Adjust OMP_CLAUSE_DECL and OMP_CLAUSE_LINEAR_STEP so that expand_omp_for_* can use it during expansion for linear adjustments. (create_task_copyfn): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. (lower_depend_clauses): Assert not seeing sink/source depend kinds. Set TREE_ADDRESSABLE on array. Change first argument from gimple * to tree * pointing to the stmt's clauses. (lower_omp_taskreg): Adjust lower_depend_clauses caller. (lower_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, depend clauses, GOMP_MAP_{RELEASE,ALWAYS_{TO,FROM,TOFROM},FIRSTPRIVATE_POINTER,STRUCT} map kinds, OMP_CLAUSE_{FIRSTPRIVATE,PRIVATE,{IS,USE}_DEVICE_PTR clauses. Always use short kind and 8-bit align shift. (lower_omp_regimplify_p): Use IS_TYPE_OR_DECL_P macro. (struct lower_omp_regimplify_operands_data): New type. (lower_omp_regimplify_operands_p, lower_omp_regimplify_operands): New functions. (lower_omp_1): Use lower_omp_regimplify_operands instead of gimple_regimplify_operands. (make_gimple_omp_edges): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (simd_clone_clauses_extract): Honor OMP_CLAUSE_LINEAR_KIND. (simd_clone_mangle): Mangle the various linear kinds per the new ABI. (simd_clone_adjust_argument_types): Handle SIMD_CLONE_ARG_TYPE_LINEAR_*_CONSTANT_STEP. (simd_clone_init_simd_arrays): Don't do anything for uval. (simd_clone_adjust): Handle SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP. Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP. * omp-low.h (omp_member_access_dummy_var): New prototype. * passes.def (pass_simduid_cleanup): Schedule another copy of the pass after all optimizations. * tree.c (omp_clause_code_name): Add entries for OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (omp_clause_num_ops): Likewise. Bump number of OMP_CLAUSE_REDUCTION arguments to 5 and for OMP_CLAUSE_ORDERED to 1. (walk_tree_1): Adjust for OMP_CLAUSE_ORDERED having 1 argument and OMP_CLAUSE_REDUCTION 5 arguments. Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD} clauses. * tree-core.h (enum omp_clause_linear_kind): New. (struct tree_omp_clause): Change type of map_kind from unsigned char to unsigned int. Add subcode.if_modifier and subcode.linear_kind fields. (enum omp_clause_code): Add OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (OMP_CLAUSE_REDUCTION): Document OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_{SOURCE,SINK}. * tree.def (OMP_FOR): Add OMP_FOR_ORIG_DECLS operand. (OMP_CRITICAL): Move before OMP_SINGLE. Add OMP_CRITICAL_CLAUSES operand. (OMP_ORDERED): Move before OMP_SINGLE. Add OMP_ORDERED_CLAUSES operand. (OMP_TASKLOOP, OMP_TARGET_ENTER_DATA, OMP_TARGET_EXIT_DATA): New tree codes. * tree.h (OMP_BODY): Replace OMP_CRITICAL with OMP_TASKGROUP. (OMP_CLAUSE_SET_MAP_KIND): Cast to unsigned int rather than unsigned char. (OMP_CRITICAL_NAME): Adjust to be 3rd operand instead of 2nd. (OMP_CLAUSE_NUM_TASKS_EXPR): Formatting fix. (OMP_STANDALONE_CLAUSES): Adjust to cover OMP_TARGET_{ENTER,EXIT}_DATA. (OMP_CLAUSE_DEPEND_SINK_NEGATIVE, OMP_TARGET_COMBINED, OMP_CLAUSE_MAP_PRIVATE, OMP_FOR_ORIG_DECLS, OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION, OMP_CRITICAL_CLAUSES, OMP_CLAUSE_PRIVATE_TASKLOOP_IV, OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, OMP_CLAUSE_HINT_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER, OMP_CLAUSE_SHARED_FIRSTPRIVATE, OMP_ORDERED_CLAUSES, OMP_TARGET_ENTER_DATA_CLAUSES, OMP_TARGET_EXIT_DATA_CLAUSES, OMP_CLAUSE_NUM_TASKS_EXPR, OMP_CLAUSE_GRAINSIZE_EXPR, OMP_CLAUSE_PRIORITY_EXPR, OMP_CLAUSE_ORDERED_EXPR): Define. * tree-inline.c (remap_gimple_stmt): Handle clauses on GIMPLE_OMP_ORDERED and GIMPLE_OMP_CRITICAL. For IFN_GOMP_SIMD_ORDERED_{START,END} set has_simduid_loops. * tree-nested.c (convert_nonlocal_omp_clauses): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (convert_local_omp_clauses): Likewise. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_ORDERED_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_DEPEND_{SOURCE,SINK}. Use "delete" for GOMP_MAP_FORCE_DEALLOC. Handle GOMP_MAP_{ALWAYS_{TO,FROM,TOFROM},RELEASE,FIRSTPRIVATE_POINTER,STRUCT}. (dump_generic_node): Handle OMP_TASKLOOP, OMP_TARGET_{ENTER,EXIT}_DATA and clauses on OMP_ORDERED and OMP_CRITICAL. * tree-vectorizer.c (adjust_simduid_builtins): Adjust comment. Remove IFN_GOMP_SIMD_ORDERED_{START,END}. (vectorize_loops): Adjust comments. (pass_simduid_cleanup::execute): Likewise. * tree-vect-stmts.c (vectorizable_simd_clone_call): Handle SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_CONSTANT_STEP. * wide-int.h (wi::gcd): New. gcc/c-family/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-common.c (enum c_builtin_type): Define DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10 and DEF_FUNCTION_TYPE_11. (c_define_builtins): Likewise. * c-common.h (enum c_omp_clause_split): Add C_OMP_CLAUSE_SPLIT_TASKLOOP. (c_finish_omp_critical, c_finish_omp_ordered): Add CLAUSES argument. (c_finish_omp_for): Add ORIG_DECLV argument. * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP as 201511 instead of 201307. * c-omp.c (c_finish_omp_critical): Add CLAUSES argument, set OMP_CRITICAL_CLAUSES to it. (c_finish_omp_ordered): Add CLAUSES argument, set OMP_ORDERED_CLAUSES to it. (c_finish_omp_for): Add ORIG_DECLV argument, set OMP_FOR_ORIG_DECLS to it if OMP_FOR. Clear DECL_INITIAL on the IVs. (c_omp_split_clauses): Handle OpenMP 4.5 combined/composite constructs and new OpenMP 4.5 clauses. Clear OMP_CLAUSE_SCHEDULE_SIMD if not combined with OMP_SIMD. Add verification code. * c-pragma.c (omp_pragmas_simd): Add taskloop. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKLOOP. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_{DEFAULTMAP,GRAINSIZE,HINT,{IS,USE}_DEVICE_PTR} and PRAGMA_OMP_CLAUSE_{LINK,NOGROUP,NUM_TASKS,PRIORITY,SIMD,THREADS}. gcc/c/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-parser.c (c_parser_pragma): Handle PRAGMA_OMP_ORDERED here. (c_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (c_parser_omp_variable_list): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Formatting fixes. (c_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize, c_parser_omp_clause_priority, c_parser_omp_clause_hint, c_parser_omp_clause_defaultmap, c_parser_omp_clause_use_device_ptr, c_parser_omp_clause_is_device_ptr): New functions. (c_parser_omp_clause_ordered): Parse optional parameter. (c_parser_omp_clause_reduction): Handle array reductions. (c_parser_omp_clause_schedule): Parse optional simd modifier. (c_parser_omp_clause_nogroup, c_parser_omp_clause_orderedkind): New functions. (c_parser_omp_clause_linear): Parse linear clause modifiers. (c_parser_omp_clause_depend_sink): New function. (c_parser_omp_clause_depend): Parse source/sink depend kinds. (c_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (c_parser_oacc_all_clauses): Adjust c_parser_omp_clause_if and c_finish_omp_clauses callers. (c_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (c_parser_oacc_cache): Adjust c_finish_omp_clauses caller. (OMP_CRITICAL_CLAUSE_MASK): Define. (c_parser_omp_critical): Parse critical clauses. (c_parser_omp_for_loop): Handle doacross loops, adjust c_finish_omp_for and c_finish_omp_clauses callers. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (c_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (c_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (c_parser_omp_ordered): Add CONTEXT argument, remove LOC argument, parse clauses and if depend clause is found, don't parse a body. (c_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (c_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (c_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (c_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (c_parser_omp_declare_reduction): Use STRIP_NOPS when checking for &omp_priv. (OMP_TASKLOOP_CLAUSE_MASK): Define. (c_parser_omp_taskloop): New function. (c_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (c_parser_cilk_for): Adjust c_finish_omp_clauses callers. * c-tree.h (c_finish_omp_clauses): Add two new arguments. * c-typeck.c (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (c_finish_omp_clauses): Add IS_OMP and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones. gcc/cp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * class.c (finish_struct_1): Call finish_omp_declare_simd_methods. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_TASKLOOP. (cp_genericize_r): Likewise. (cxx_omp_finish_clause): Don't diagnose references. (cxx_omp_disregard_value_expr): New function. * cp-objcp-common.h (LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR): Redefine. * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Document for OMP_TASKLOOP. (DECL_OMP_PRIVATIZED_MEMBER): Define. (finish_omp_declare_simd_methods, push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses, omp_privatize_field, cxx_omp_disregard_value_expr): New prototypes. (finish_omp_clauses): Add two new arguments. (finish_omp_for): Add ORIG_DECLV argument. * parser.c (cp_parser_lambda_body): Call save_omp_privatization_clauses and restore_omp_privatization_clauses. (cp_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (cp_parser_omp_var_list_no_open): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Parse this keyword. Formatting fixes. (cp_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority, cp_parser_omp_clause_hint, cp_parser_omp_clause_defaultmap): New functions. (cp_parser_omp_clause_ordered): Parse optional parameter. (cp_parser_omp_clause_reduction): Handle array reductions. (cp_parser_omp_clause_schedule): Parse optional simd modifier. (cp_parser_omp_clause_nogroup, cp_parser_omp_clause_orderedkind): New functions. (cp_parser_omp_clause_linear): Parse linear clause modifiers. (cp_parser_omp_clause_depend_sink): New function. (cp_parser_omp_clause_depend): Parse source/sink depend kinds. (cp_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_if and finish_omp_clauses callers. (cp_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (OMP_CRITICAL_CLAUSE_MASK): Define. (cp_parser_omp_critical): Parse critical clauses. (cp_parser_omp_for_incr): Use cp_tree_equal if processing_template_decl. (cp_parser_omp_for_loop_init): Return tree instead of bool. Handle non-static data member iterators. (cp_parser_omp_for_loop): Handle doacross loops, adjust finish_omp_for and finish_omp_clauses callers. (cp_omp_split_clauses): Adjust finish_omp_clauses caller. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (cp_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (cp_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (cp_parser_omp_ordered): Add CONTEXT argument, return bool instead of tree, parse clauses and if depend clause is found, don't parse a body. (cp_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (cp_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (cp_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (cp_parser_oacc_cache): Adjust finish_omp_clauses caller. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (cp_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (OMP_TASKLOOP_CLAUSE_MASK): Define. (cp_parser_omp_taskloop): New function. (cp_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (cp_parser_pragma): Handle PRAGMA_OMP_ORDERED here directly, handle PRAGMA_OMP_TASKLOOP, call push_omp_privatization_clauses and pop_omp_privatization_clauses around parsing calls. (cp_parser_cilk_for): Adjust finish_omp_clauses caller. * pt.c (apply_late_template_attributes): Adjust tsubst_omp_clauses and finish_omp_clauses callers. (tsubst_omp_clause_decl): Return NULL if decl is NULL. For TREE_LIST, copy over OMP_CLAUSE_DEPEND_SINK_NEGATIVE bit. Use tsubst_expr instead of tsubst_copy, undo convert_from_reference effects. (tsubst_omp_clauses): Add ALLOW_FIELDS argument. Handle new OpenMP 4.5 clauses. Use tsubst_omp_clause_decl for more clauses. If ALLOW_FIELDS, handle non-static data members in the clauses. Clear OMP_CLAUSE_LINEAR_STEP if it has been cleared before. (omp_parallel_combined_clauses): New variable. (tsubst_omp_for_iterator): Add ORIG_DECLV argument, recur on OMP_FOR_ORIG_DECLS, handle non-static data member iterators. Improve handling of clauses on combined constructs. (tsubst_expr): Call push_omp_privatization_clauses and pop_omp_privatization_clauses around instantiation of certain OpenMP constructs, improve handling of clauses on combined constructs, handle OMP_TASKLOOP, adjust tsubst_omp_for_iterator, tsubst_omp_clauses and finish_omp_for callers, handle clauses on critical and ordered, handle OMP_TARGET_{ENTER,EXIT}_DATA. (instantiate_decl): Call save_omp_privatization_clauses and restore_omp_privatization_clauses around instantiation. (dependent_omp_for_p): Fix up comment typo. Handle SCOPE_REF. * semantics.c (omp_private_member_map, omp_private_member_vec, omp_private_member_ignore_next): New variables. (finish_non_static_data_member): Return dummy decl for privatized non-static data members. (omp_clause_decl_field, omp_clause_printable_decl, omp_note_field_privatization, omp_privatize_field): New functions. (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (finish_omp_reduction_clause): Handle array sections and arrays. Use omp_clause_printable_decl. (finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink): New functions. (finish_omp_clauses): Add ALLOW_FIELDS and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones, handle non-static data members, reject this keyword when not allowed. (push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses): New functions. (handle_omp_for_class_iterator): Handle OMP_TASKLOOP class iterators. Add collapse and ordered arguments. Fix handling of lastprivate iterators in doacross loops. (finish_omp_for): Add ORIG_DECLV argument, handle doacross loops, adjust c_finish_omp_for, handle_omp_for_class_iterator and finish_omp_clauses callers. Fill in OMP_CLAUSE_LINEAR_STEP on simd loops with non-static data member iterators. gcc/fortran/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * f95-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11, DEF_FUNCTION_TYPE_VAR_1): Define. * trans-openmp.c (gfc_trans_omp_clauses): Set OMP_CLAUSE_IF_MODIFIER to ERROR_MARK, OMP_CLAUSE_ORDERED_EXPR to NULL. (gfc_trans_omp_critical): Adjust for addition of clauses. (gfc_trans_omp_ordered): Likewise. * types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. gcc/lto/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * lto-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/jit/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/ada/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * gcc-interface/utils.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/testsuite/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-c++-common/gomp/cancel-1.c (f2): Add map clause to target data. * c-c++-common/gomp/clauses-1.c: New test. * c-c++-common/gomp/clauses-2.c: New test. * c-c++-common/gomp/clauses-3.c: New test. * c-c++-common/gomp/clauses-4.c: New test. * c-c++-common/gomp/declare-target-1.c: New test. * c-c++-common/gomp/declare-target-2.c: New test. * c-c++-common/gomp/depend-3.c: New test. * c-c++-common/gomp/depend-4.c: New test. * c-c++-common/gomp/doacross-1.c: New test. * c-c++-common/gomp/if-1.c: New test. * c-c++-common/gomp/if-2.c: New test. * c-c++-common/gomp/linear-1.c: New test. * c-c++-common/gomp/map-2.c: New test. * c-c++-common/gomp/map-3.c: New test. * c-c++-common/gomp/nesting-1.c (f_omp_parallel, f_omp_target_data): Add map clause to target data. * c-c++-common/gomp/nesting-warn-1.c (f_omp_target): Likewise. * c-c++-common/gomp/ordered-1.c: New test. * c-c++-common/gomp/ordered-2.c: New test. * c-c++-common/gomp/ordered-3.c: New test. * c-c++-common/gomp/pr61486-1.c (foo): Remove linear clause on non-iterator. * c-c++-common/gomp/pr61486-2.c (test, test2): Remove ordered clause and ordered construct where no longer allowed. * c-c++-common/gomp/priority-1.c: New test. * c-c++-common/gomp/reduction-1.c: New test. * c-c++-common/gomp/schedule-simd-1.c: New test. * c-c++-common/gomp/sink-1.c: New test. * c-c++-common/gomp/sink-2.c: New test. * c-c++-common/gomp/sink-3.c: New test. * c-c++-common/gomp/sink-4.c: New test. * c-c++-common/gomp/udr-1.c: New test. * c-c++-common/taskloop-1.c: New test. * c-c++-common/cpp/openmp-define-3.c: Adjust for the new value of _OPENMP macro. * c-c++-common/cilk-plus/PS/body.c (foo): Adjust expected diagnostics. * c-c++-common/goacc-gomp/nesting-fail-1.c (f_acc_parallel, f_acc_kernels, f_acc_data, f_acc_loop): Add map clause to target data. * gcc.dg/gomp/clause-1.c: * gcc.dg/gomp/reduction-1.c: New test. * gcc.dg/gomp/sink-fold-1.c: New test. * gcc.dg/gomp/sink-fold-2.c: New test. * gcc.dg/gomp/sink-fold-3.c: New test. * gcc.dg/vect/vect-simd-clone-15.c: New test. * g++.dg/gomp/clause-1.C (T::test): Remove dg-error on privatization of non-static data members. * g++.dg/gomp/clause-3.C (foo): Remove one dg-error directive. Add some linear clause tests. * g++.dg/gomp/declare-simd-3.C: New test. * g++.dg/gomp/linear-1.C: New test. * g++.dg/gomp/member-1.C: New test. * g++.dg/gomp/member-2.C: New test. * g++.dg/gomp/pr66571-2.C: New test. * g++.dg/gomp/pr67504.C (foo): Add test for ordered clause with dependent argument. * g++.dg/gomp/pr67522.C (foo): Add test for invalid array section in reduction clause. * g++.dg/gomp/reference-1.C: New test. * g++.dg/gomp/sink-1.C: New test. * g++.dg/gomp/sink-2.C: New test. * g++.dg/gomp/sink-3.C: New test. * g++.dg/gomp/task-1.C: Remove both dg-error directives. * g++.dg/gomp/this-1.C: New test. * g++.dg/gomp/this-2.C: New test. * g++.dg/vect/simd-clone-2.cc: New test. * g++.dg/vect/simd-clone-2.h: New test. * g++.dg/vect/simd-clone-3.cc: New test. * g++.dg/vect/simd-clone-4.cc: New test. * g++.dg/vect/simd-clone-4.h: New test. * g++.dg/vect/simd-clone-5.cc: New test. include/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define. (enum gomp_map_kind): Add GOMP_MAP_FIRSTPRIVATE, GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_DELETE, GOMP_MAP_RELEASE, GOMP_MAP_FIRSTPRIVATE_POINTER. (GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Define. (GOMP_TASK_FLAG_UNTIED, GOMP_TASK_FLAG_FINAL, GOMP_TASK_FLAG_MERGEABLE, GOMP_TASK_FLAG_DEPEND, GOMP_TASK_FLAG_PRIORITY, GOMP_TASK_FLAG_UP, GOMP_TASK_FLAG_GRAINSIZE, GOMP_TASK_FLAG_IF, GOMP_TASK_FLAG_NOGROUP, GOMP_TARGET_FLAG_NOWAIT, GOMP_TARGET_FLAG_EXIT_DATA, GOMP_TARGET_FLAG_UPDATE): Define. libgomp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * config/linux/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/linux/doacross.h: New file. * config/posix/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/posix/doacross.h: New file. * env.c: Include gomp-constants.h. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (gomp_max_task_priority_var): New variable. (parse_schedule): Rename run_sched_modifier to run_sched_chunk_size. (handle_omp_display_env): Change _OPENMP value from 201307 to 201511. Print OMP_MAX_TASK_PRIORITY. (initialize_env): Parse OMP_MAX_TASK_PRIORITY. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size and run_sched_modifier to run_sched_chunk_size. (omp_get_max_task_priority, omp_get_initial_device, omp_get_num_places, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums): New functions. * fortran.c (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_): Rename modifier argument to chunk_size. (omp_get_num_places_, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num_, omp_get_partition_num_places_, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device_, omp_get_max_task_priority_): New functions. * libgomp_g.h (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_doacross_ull_post, GOMP_doacross_wait, GOMP_taskloop, GOMP_taskloop_ull, GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data): New prototypes. (GOMP_task): Add prototype argument. * libgomp.h (_LIBGOMP_CHECKING_): Define to 0 if not yet defined. (struct gomp_doacross_work_share): New type. (struct gomp_work_share): Add doacross field. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (enum gomp_task_kind): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. Add comments. (struct gomp_task_depend_entry): Add comments. (struct gomp_task): Likewise. (struct gomp_taskgroup): Likewise. (struct gomp_target_task): New type. (struct gomp_team): Add comment. (gomp_get_place_proc_ids_8, gomp_doacross_init, gomp_doacross_ull_init, gomp_task_maybe_wait_for_dependencies, gomp_create_target_task, gomp_target_task_fn): New prototypes. (struct target_var_desc): New type. (struct target_mem_desc): Adjust comment. Use struct target_var_desc instead of splay_tree_key for list. (REFCOUNT_INFINITY): Define. (struct splay_tree_key_s): Remove copy_from field. (struct gomp_device_descr): Add dev2dev_func field. (enum gomp_map_vars_kind): New enum. (gomp_map_vars): Add one argument. * libgomp.map (OMP_4.5): Export omp_get_max_task_priority, omp_get_max_task_priority_, omp_get_num_places, omp_get_num_places_, omp_get_place_num_procs, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num, omp_get_place_num_, omp_get_partition_num_places, omp_get_partition_num_places_, omp_get_partition_place_nums, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device, omp_get_initial_device_, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr and omp_target_disassociate_ptr. (GOMP_4.0.2): Renamed to ... (GOMP_4.5): ... this. Export GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data, GOMP_taskloop, GOMP_taskloop_ull, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_doacross_static_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_doacross_ull_post and GOMP_doacross_ull_wait. * libgomp.texi: Document omp_get_max_task_priority. Rename modifier argument to chunk_size for omp_set_schedule and omp_get_schedule. Document OMP_MAX_TASK_PRIORITY env var. * loop.c (GOMP_loop_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ordered_runtime_start): Likewise. (gomp_loop_doacross_static_start, gomp_loop_doacross_dynamic_start, gomp_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_parallel_loop_runtime_start): New functions. (GOMP_parallel_loop_runtime): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start): New functions or aliases. * loop_ull.c (GOMP_loop_ull_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ull_ordered_runtime_start): Likewise. (gomp_loop_ull_doacross_static_start, gomp_loop_ull_doacross_dynamic_start, gomp_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start): New functions. (GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start): New functions or aliases. * oacc-mem.c (acc_map_data, present_create_copy, gomp_acc_insert_pointer): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (gomp_acc_remove_pointer): Use copy_from from target_var_desc. * oacc-parallel.c (GOACC_data_start): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (GOACC_parallel_keyed): Likewise. Use copy_from from target_var_desc. * omp.h.in (omp_lock_hint_t): New type. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr): New prototypes. * omp_lib.f90.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New interfaces. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size. * omp_lib.h.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New functions and subroutines. * ordered.c: Include stdarg.h and string.h. (MAX_COLLAPSED_BITS): Define. (gomp_doacross_init, GOMP_doacross_post, GOMP_doacross_wait, gomp_doacross_ull_init, GOMP_doacross_ull_post, GOMP_doacross_ull_wait): New functions. * target.c: Include errno.h. (resolve_device): If device is not initialized, call gomp_init_device on it. (gomp_map_lookup): New function. (gomp_map_vars_existing): Add tgt_var argument, fill it in. Don't bump refcount if REFCOUNT_INFINITY. Handle GOMP_MAP_ALWAYS_TO_P. (get_kind): Rename is_openacc argument to short_mapkind. (gomp_map_pointer): Use gomp_map_lookup. (gomp_map_fields_existing): New function. (gomp_map_vars): Rename is_openacc argument to short_mapkind and is_target to pragma_kind. Handle GOMP_MAP_VARS_ENTER_DATA, handle GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_STRUCT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION. Adjust for tgt->list changed type and copy_from living in there. (gomp_copy_from_async): Adjust for tgt->list changed type and copy_from living in there. (gomp_unmap_vars): Likewise. (gomp_update): Likewise. Rename is_openacc argument to short_mapkind. Don't fail if object is not mapped. (gomp_load_image_to_device): Initialize refcount to REFCOUNT_INFINITY. (gomp_target_fallback): New function. (gomp_get_target_fn_addr): Likewise. (GOMP_target): Adjust gomp_map_vars caller, use gomp_get_target_fn_addr and gomp_target_fallback. (GOMP_target_41): New function. (gomp_target_data_fallback): New function. (GOMP_target_data): Use it, adjust gomp_map_vars caller. (GOMP_target_data_41): New function. (GOMP_target_update): Adjust gomp_update caller. (GOMP_target_update_41): New function. (gomp_exit_data, GOMP_target_enter_exit_data, gomp_target_task_fn, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect_worker, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr, gomp_load_plugin_for_device): New functions. * task.c: Include gomp-constants.h. Include taskloop.c twice to get GOMP_taskloop and GOMP_taskloop_ull definitions. (gomp_task_handle_depend): New function. (GOMP_task): Use it. Add priority argument. Use gomp-constant.h constants instead of hardcoded numbers. Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (gomp_create_target_task): New function. (verify_children_queue, verify_taskgroup_queue, verify_task_queue): New functions. (gomp_task_run_pre): Call verify_*_queue functions. If an upcoming tied task is about to leave the sibling or taskgroup queues in an invalid state, adjust appropriately. Remove taskgroup argument. Add comments. (gomp_task_run_post_handle_dependers): Add comments. (gomp_task_run_post_remove_parent): Likewise. (gomp_barrier_handle_tasks): Adjust gomp_task_run_pre caller. (GOMP_taskwait): Likewise. Add comments. (gomp_task_maybe_wait_for_dependencies): Fix scheduling problem such that the first non parent_depends_on task does not end up at the end of the children queue. (GOMP_taskgroup_start): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (GOMP_taskgroup_end): Adjust gomp_task_run_pre caller. * taskloop.c: New file. * testsuite/lib/libgomp.exp (check_effective_target_offload_device_nonshared_as): New proc. * testsuite/libgomp.c/affinity-2.c: New test. * testsuite/libgomp.c/doacross-1.c: New test. * testsuite/libgomp.c/doacross-2.c: New test. * testsuite/libgomp.c/examples-4/declare_target-1.c (fib_wrapper): Add map clause to target. * testsuite/libgomp.c/examples-4/declare_target-4.c (accum): Likewise. * testsuite/libgomp.c/examples-4/declare_target-5.c (accum): Likewise. * testsuite/libgomp.c/examples-4/device-1.c (main): Likewise. * testsuite/libgomp.c/examples-4/device-3.c (main): Likewise. * testsuite/libgomp.c/examples-4/target_data-3.c (gramSchmidt): Likewise. * testsuite/libgomp.c/examples-4/teams-2.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-3.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-4.c (dotprod): Likewise. * testsuite/libgomp.c/for-2.h (OMPTGT, OMPTO, OMPFROM): Define if not defined. Use those where needed. * testsuite/libgomp.c/for-4.c: New test. * testsuite/libgomp.c/for-5.c: New test. * testsuite/libgomp.c/for-6.c: New test. * testsuite/libgomp.c/linear-1.c: New test. * testsuite/libgomp.c/ordered-4.c: New test. * testsuite/libgomp.c/pr66199-2.c (f2): Adjust for linear clause only allowed on the loop iterator. * testsuite/libgomp.c/pr66199-3.c: New test. * testsuite/libgomp.c/pr66199-4.c: New test. * testsuite/libgomp.c/reduction-7.c: New test. * testsuite/libgomp.c/reduction-8.c: New test. * testsuite/libgomp.c/reduction-9.c: New test. * testsuite/libgomp.c/reduction-10.c: New test. * testsuite/libgomp.c/target-1.c (fn2, fn3, fn4): Add map(tofrom:s). * testsuite/libgomp.c/target-2.c (fn2, fn3, fn4): Likewise. * testsuite/libgomp.c/target-7.c (foo): Add map(h) where needed. * testsuite/libgomp.c/target-11.c: New test. * testsuite/libgomp.c/target-12.c: New test. * testsuite/libgomp.c/target-13.c: New test. * testsuite/libgomp.c/target-14.c: New test. * testsuite/libgomp.c/target-15.c: New test. * testsuite/libgomp.c/target-16.c: New test. * testsuite/libgomp.c/target-17.c: New test. * testsuite/libgomp.c/target-18.c: New test. * testsuite/libgomp.c/target-19.c: New test. * testsuite/libgomp.c/target-20.c: New test. * testsuite/libgomp.c/target-21.c: New test. * testsuite/libgomp.c/target-22.c: New test. * testsuite/libgomp.c/target-23.c: New test. * testsuite/libgomp.c/target-24.c: New test. * testsuite/libgomp.c/target-25.c: New test. * testsuite/libgomp.c/target-26.c: New test. * testsuite/libgomp.c/target-27.c: New test. * testsuite/libgomp.c/taskloop-1.c: New test. * testsuite/libgomp.c/taskloop-2.c: New test. * testsuite/libgomp.c/taskloop-3.c: New test. * testsuite/libgomp.c/taskloop-4.c: New test. * testsuite/libgomp.c++/ctor-13.C: New test. * testsuite/libgomp.c++/doacross-1.C: New test. * testsuite/libgomp.c++/examples-4/declare_target-2.C: Replace offload_device with offload_device_nonshared_as. * testsuite/libgomp.c++/for-12.C: New test. * testsuite/libgomp.c++/for-13.C: New test. * testsuite/libgomp.c++/for-14.C: New test. * testsuite/libgomp.c++/linear-1.C: New test. * testsuite/libgomp.c++/member-1.C: New test. * testsuite/libgomp.c++/member-2.C: New test. * testsuite/libgomp.c++/member-3.C: New test. * testsuite/libgomp.c++/member-4.C: New test. * testsuite/libgomp.c++/member-5.C: New test. * testsuite/libgomp.c++/ordered-1.C: New test. * testsuite/libgomp.c++/reduction-5.C: New test. * testsuite/libgomp.c++/reduction-6.C: New test. * testsuite/libgomp.c++/reduction-7.C: New test. * testsuite/libgomp.c++/reduction-8.C: New test. * testsuite/libgomp.c++/reduction-9.C: New test. * testsuite/libgomp.c++/reduction-10.C: New test. * testsuite/libgomp.c++/reference-1.C: New test. * testsuite/libgomp.c++/simd14.C: New test. * testsuite/libgomp.c++/target-2.C (fn2): Add map(tofrom: s) clause. * testsuite/libgomp.c++/target-5.C: New test. * testsuite/libgomp.c++/target-6.C: New test. * testsuite/libgomp.c++/target-7.C: New test. * testsuite/libgomp.c++/target-8.C: New test. * testsuite/libgomp.c++/target-9.C: New test. * testsuite/libgomp.c++/target-10.C: New test. * testsuite/libgomp.c++/target-11.C: New test. * testsuite/libgomp.c++/target-12.C: New test. * testsuite/libgomp.c++/taskloop-1.C: New test. * testsuite/libgomp.c++/taskloop-2.C: New test. * testsuite/libgomp.c++/taskloop-3.C: New test. * testsuite/libgomp.c++/taskloop-4.C: New test. * testsuite/libgomp.c++/taskloop-5.C: New test. * testsuite/libgomp.c++/taskloop-6.C: New test. * testsuite/libgomp.c++/taskloop-7.C: New test. * testsuite/libgomp.c++/taskloop-8.C: New test. * testsuite/libgomp.c++/taskloop-9.C: New test. * testsuite/libgomp.fortran/affinity1.f90: New test. * testsuite/libgomp.fortran/affinity2.f90: New test. liboffloadmic/ 2015-10-13 Ilya Verbin <ilya.verbin@intel.com> * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New function. * plugin/offload_target_main.cpp (__offload_target_tgt2tgt): New static function, register it in liboffloadmic. From-SVN: r228777
2015-10-13 21:06:23 +02:00
/* anticipated_p reused as DECL_OMP_PRIVATIZED_MEMBER in var */
unsigned friend_or_tls : 1; /* var, fn, type or template */
unsigned template_conv_p : 1; /* var or template */
unsigned odr_used : 1; /* var or fn */
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
unsigned u2sel : 1;
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
unsigned concept_p : 1; /* applies to vars and functions */
Implement P0386R2 - C++17 inline variables 2016-10-11 Jakub Jelinek <jakub@redhat.com> * dwarf2out.c (gen_member_die): Handle inline static data member definitions. c-family/ * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_inline_variables. cp/ * cp-tree.h (struct lang_type): Shrink language field to 1 bit from 4. Add var_declared_inline_p field. Mention 2 spare bits. (DECL_VAR_DECLARED_INLINE_P): Define. (SET_DECL_VAR_DECLARED_INLINE_P): Define. (DECL_INLINE_VAR_P): Define. (diagnose_inline_vars_for_namespace): Declare. * decl.c (diagnose_inline_vars_for_namespace): New function. (duplicate_decls): For static data members copy DECL_DECLARED_CONSTEXPR_P. (redeclaration_error_message): Handle C++17 redundant redeclaration of constexpr static data member outside of class. (maybe_commonize_var): Handle inline variables. (check_initializer): Ignore inline variables for diagnostics. Adjust diagnostic wording for C++17. (make_rtl_for_nonlocal_decl): Allow in-class definition of inline static data members. (bad_specifiers): Don't diagnose inline on variables here. (grokvardecl): Add inlinep argument, non-static const inline variables are TREE_PUBLIC. (check_static_variable_definition): Return early also for inline variables. (grokdeclarator): Handle inline variables and inline static data members. * typeck2.c (store_init_value): Don't diagnose non-constant initializers for non-constexpr inline static data members. * decl2.c (vague_linkage_p): Return true for inline variables. (c_parse_final_cleanups): In-class declaration of inline static data members is a definition. Call diagnose_inline_vars_for_namespace through walk_namespaces. * pt.c (instantiate_decl): Set pattern_defined for in-class definitions of inline static data members. From-SVN: r241137
2016-10-13 21:26:54 +02:00
unsigned var_declared_inline_p : 1; /* var */
Implement P0217R3 - C++17 structured bindings gcc/ * match.pd: Don't try to compare addresses of variables with DECL_VALUE_EXPR. gcc/cp/ * cp-tree.h (struct lang_decl_base): Add decomposition_p. (DECL_DECOMPOSITION_P): New (enum auto_deduction_context): Add adc_decomp_type. (enum cp_declarator_kind): Add cdk_decomp. * constexpr.c (cxx_eval_constant_expression): Look through DECL_VALUE_EXPR. (potential_constant_expression_1): Likewise. * decl.c (reshape_init): Preserve CONSTRUCTOR_IS_DIRECT_INIT. (check_initializer): Use build_aggr_init for DECL_DECOMPOSITION_P. (cp_finish_decl): Pass adc_decomp_type for decomposition. (find_decomp_class_base, get_tuple_size, get_tuple_element_type) (get_tuple_decomp_init, cp_finish_decomp): New. (grokdeclarator): Handle decomposition. * init.c (build_aggr_init): Handle decomposition array. (build_vec_init): Handle initialization from { array }. * name-lookup.c (add_function): Always wrap TEMPLATE_DECL in OVERLOAD. * parser.c (declarator_can_be_parameter_pack): Handle cdk_decomp. (function_declarator_p, strip_declarator_types) (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_range_for, cp_convert_range_for): Handle decomposition. (cp_parser_simple_declaration): Parse decomposition. (cp_parser_decomposition_declaration): New. * pt.c (tsubst_decomp_names): New. (subst_expr) [DECL_EXPR, RANGE_FOR_STMT]: Handle decomposition. (do_auto_deduction): Handle adc_decomp_type. * semantics.c (finish_decltype_type): Look through DECL_VALUE_EXPR. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. * tree.c (lvalue_kind): Likewise. (cp_build_reference_type): Handle reference collapsing. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r242377
2016-11-14 06:02:58 +01:00
unsigned decomposition_p : 1; /* var */
/* 1 spare bit */
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
};
/* True for DECL codes which have template info and access. */
#define LANG_DECL_HAS_MIN(NODE) \
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_OR_FUNCTION_DECL_P (NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
|| TREE_CODE (NODE) == FIELD_DECL \
|| TREE_CODE (NODE) == CONST_DECL \
|| TREE_CODE (NODE) == TYPE_DECL \
|| TREE_CODE (NODE) == TEMPLATE_DECL \
|| TREE_CODE (NODE) == USING_DECL)
/* DECL_LANG_SPECIFIC for the above codes. */
struct GTY(()) lang_decl_min {
struct lang_decl_base base;
/* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
THUNK_ALIAS.
In a FUNCTION_DECL for which DECL_THUNK_P does not hold,
VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is
DECL_TEMPLATE_INFO. */
tree template_info;
union lang_decl_u2 {
/* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
THUNK_VIRTUAL_OFFSET.
Otherwise this is DECL_ACCESS. */
tree GTY ((tag ("0"))) access;
/* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */
int GTY ((tag ("1"))) discriminator;
} GTY ((desc ("%0.u.base.u2sel"))) u2;
};
/* Additional DECL_LANG_SPECIFIC information for functions. */
struct GTY(()) lang_decl_fn {
struct lang_decl_min min;
/* In an overloaded operator, this is the value of
DECL_OVERLOADED_OPERATOR_P. */
ENUM_BITFIELD (tree_code) operator_code : 16;
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
unsigned global_ctor_p : 1;
unsigned global_dtor_p : 1;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
unsigned assignment_operator_p : 1;
1994-02-24 02:02:37 +01:00
unsigned static_function : 1;
unsigned pure_virtual : 1;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
unsigned defaulted_p : 1;
unsigned has_in_charge_parm_p : 1;
2001-02-21 15:42:27 +01:00
unsigned has_vtt_parm_p : 1;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
unsigned pending_inline_p : 1;
unsigned nonconverting : 1;
unsigned thunk_p : 1;
unsigned this_thunk_p : 1;
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
unsigned hidden_friend_p : 1;
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
unsigned omp_declare_reduction_p : 1;
/* 2 spare bits on 32-bit hosts, 34 on 64-bit hosts. */
1994-02-24 02:02:37 +01:00
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
/* For a non-thunk function decl, this is a tree list of
friendly classes. For a thunk function decl, it is the
thunked to function decl. */
tree befriending_classes;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
/* For a non-virtual FUNCTION_DECL, this is
DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which
DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both
this pointer and result pointer adjusting thunks are
chained here. This pointer thunks to return pointer thunks
will be chained on the return pointer thunk. */
tree context;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
union lang_decl_u5
{
/* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is
DECL_CLONED_FUNCTION. */
tree GTY ((tag ("0"))) cloned_function;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
/* In a FUNCTION_DECL for which THUNK_P holds this is the
THUNK_FIXED_OFFSET. */
HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset;
} GTY ((desc ("%1.thunk_p"))) u5;
union lang_decl_u3
{
struct cp_token_cache * GTY ((tag ("1"))) pending_inline_info;
struct language_function * GTY ((tag ("0")))
saved_language_function;
} GTY ((desc ("%1.pending_inline_p"))) u;
};
/* DECL_LANG_SPECIFIC for namespaces. */
struct GTY(()) lang_decl_ns {
struct lang_decl_base base;
cp_binding_level *level;
tree ns_using;
tree ns_users;
1994-02-24 02:02:37 +01:00
};
/* DECL_LANG_SPECIFIC for parameters. */
struct GTY(()) lang_decl_parm {
struct lang_decl_base base;
int level;
int index;
};
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
/* DECL_LANG_SPECIFIC for all types. It would be nice to just make this a
union rather than a struct containing a union as its only field, but
tree.h declares it as a struct. */
use templates instead of gengtype for typed allocation functions gcc/ChangeLog: * alias.c (record_alias_subset): Adjust. * bitmap.c (bitmap_element_allocate): Likewise. (bitmap_gc_alloc_stat): Likewise. * cfg.c (init_flow): Likewise. (alloc_block): Likewise. (unchecked_make_edge): Likewise. * cfgloop.c (alloc_loop): Likewise. (flow_loops_find): Likewise. (rescan_loop_exit): Likewise. * cfgrtl.c (init_rtl_bb_info): Likewise. * cgraph.c (insert_new_cgraph_node_version): Likewise. (cgraph_allocate_node): Likewise. (cgraph_create_edge_1): Likewise. (cgraph_allocate_init_indirect_info): Likewise. * cgraphclones.c (cgraph_clone_edge): Likewise. * cgraphunit.c (add_asm_node): Likewise. (init_lowered_empty_function): Likewise. * config/aarch64/aarch64.c (aarch64_init_machine_status): Likewise. * config/alpha/alpha.c (alpha_init_machine_status): Likewise. (alpha_use_linkage): Likewise. * config/arc/arc.c (arc_init_machine_status): Likewise. * config/arm/arm.c (arm_init_machine_status): Likewise. * config/avr/avr.c (avr_init_machine_status): Likewise. * config/bfin/bfin.c (bfin_init_machine_status): Likewise. * config/c6x/c6x.c (c6x_init_machine_status): Likewise. * config/cris/cris.c (cris_init_machine_status): Likewise. * config/darwin.c (machopic_indirection_name): Likewise. (darwin_build_constant_cfstring): Likewise. (darwin_enter_string_into_cfstring_table): Likewise. * config/epiphany/epiphany.c (epiphany_init_machine_status): * Likewise. * config/frv/frv.c (frv_init_machine_status): Likewise. * config/i386/i386.c (get_dllimport_decl): Likewise. (ix86_init_machine_status): Likewise. (assign_386_stack_local): Likewise. * config/i386/winnt.c (i386_pe_record_external_function): Likewise. (i386_pe_maybe_record_exported_symbol): Likewise. (i386_pe_record_stub): Likewise. * config/ia64/ia64.c (ia64_init_machine_status): Likewise. * config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise. * config/m32c/m32c.c (m32c_init_machine_status): Likewise. (m32c_note_pragma_address): Likewise. * config/mep/mep.c (mep_init_machine_status): Likewise. (mep_note_pragma_flag): Likewise. * config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise. (mips16_local_alias): Likewise. (mips_init_machine_status): Likewise. * config/mmix/mmix.c (mmix_init_machine_status): Likewise. * config/moxie/moxie.c (moxie_init_machine_status): Likewise. * config/msp430/msp430.c (msp430_init_machine_status): Likewise. * config/nds32/nds32.c (nds32_init_machine_status): Likewise. * config/nios2/nios2.c (nios2_init_machine_status): Likewise. * config/pa/pa.c (pa_init_machine_status): Likewise. (pa_get_deferred_plabel): Likewise. * config/rl78/rl78.c (rl78_init_machine_status): Likewise. * config/rs6000/rs6000.c (builtin_function_type): Likewise. (rs6000_init_machine_status): Likewise. (output_toc): Likewise. * config/s390/s390.c (s390_init_machine_status): Likewise. * config/score/score.c (score_output_external): Likewise. * config/sparc/sparc.c (sparc_init_machine_status): Likewise. * config/spu/spu.c (spu_init_machine_status): Likewise. * config/tilegx/tilegx.c (tilegx_init_machine_status): Likewise. * config/tilepro/tilepro.c (tilepro_init_machine_status): * Likewise. * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise. * coverage.c (coverage_end_function): Likewise. * dbxout.c (dbxout_init): Likewise. * doc/gty.texi: Don't mention variable_size attribute. * dwarf2cfi.c (new_cfi): Adjust. (new_cfi_row): Likewise. (copy_cfi_row): Likewise. (create_cie_data): Likewise. * dwarf2out.c (dwarf2out_alloc_current_fde): Likewise. (new_loc_descr): Likewise. (find_AT_string_in_table): Likewise. (add_addr_table_entry): Likewise. (new_die): Likewise. (add_var_loc_to_decl): Likewise. (clone_die): Likewise. (clone_as_declaration): Likewise. (break_out_comdat_types): Likewise. (new_loc_list): Likewise. (add_loc_descr_to_each): Likewise. (add_location_or_const_value_attribute): Likewise. (add_linkage_name): Likewise. (lookup_filename): Likewise. (dwarf2out_var_location): Likewise. (new_line_info_table): Likewise. (dwarf2out_init): Likewise. (mem_loc_descriptor): Likewise. (loc_descriptor): Likewise. (add_const_value_attribute): Likewise. (tree_add_const_value_attribute): Likewise. (comp_dir_string): Likewise. (dwarf2out_vms_debug_main_pointer): Likewise. (string_cst_pool_decl): Likewise. * emit-rtl.c (set_mem_attrs): Likewise. (get_reg_attrs): Likewise. (start_sequence): Likewise. (init_emit): Likewise. (init_emit_regs): Likewise. * except.c (init_eh_for_function): Likewise. (gen_eh_region): Likewise. (gen_eh_region_catch): Likewise. (gen_eh_landing_pad): Likewise. (add_call_site): Likewise. * function.c (add_frame_space): Likewise. (insert_temp_slot_address): Likewise. (assign_stack_temp_for_type): Likewise. (get_hard_reg_initial_val): Likewise. (allocate_struct_function): Likewise. (prepare_function_start): Likewise. (types_used_by_var_decl_insert): Likewise. * gengtype.c (variable_size_p): Remove function. (enum alloc_quantity): Remove enum. (write_typed_alloc_def): Remove function. (write_typed_struct_alloc_def): Likewise. (write_typed_typedef_alloc_def): Likewise. (write_typed_alloc_defns): Likewise. (main): Adjust. * ggc-common.c (ggc_cleared_alloc_htab_ignore_args): Adjust. (ggc_cleared_alloc_ptr_array_two_args): Likewise. * ggc.h (ggc_alloc): new function. (ggc_cleared_alloc): Likewise. (ggc_vec_alloc): Template on type of vector element, and remove element size argument. (ggc_cleared_vec_alloc): Likewise. * gimple.c (gimple_build_omp_for): Adjust. (gimple_copy): Likewise. * ipa-cp.c (get_replacement_map): Likewise. (find_aggregate_values_for_callers_subset): Likewise. (known_aggs_to_agg_replacement_list): Likewise. * ipa-devirt.c (get_odr_type): Likewise. * ipa-prop.c (ipa_node_duplication_hook): Likewise. (read_agg_replacement_chain): Likewise. * loop-iv.c (get_simple_loop_desc): Likewise. * lto-cgraph.c (input_node_opt_summary): Likewise. * lto-section-in.c (lto_new_in_decl_state): Likewise. * lto-streamer-in.c (lto_input_eh_catch_list): Likewise. (input_eh_region): Likewise. (input_eh_lp): Likewise. (input_cfg): Likewise. * optabs.c (set_optab_libfunc): Likewise. (init_tree_optimization_optabs): Likewise. (set_conv_libfunc): Likewise. * passes.c (do_per_function_toporder): Likewise. * rtl.h: Don't use variable_size gty attribute. * sese.c (if_region_set_false_region): Adjust. * stringpool.c (gt_pch_save_stringpool): Likewise. * target-globals.c (save_target_globals): Likewise. * toplev.c (general_init): Likewise. * trans-mem.c (record_tm_replacement): Likewise. (split_bb_make_tm_edge): Likewise. * tree-cfg.c (move_sese_region_to_fn): Likewise. * tree-data-ref.h (lambda_vector_new): Likewise. * tree-eh.c (add_stmt_to_eh_lp_fn): Likewise. * tree-iterator.c (tsi_link_before): Likewise. (tsi_link_after): Likewise. * tree-scalar-evolution.c (new_scev_info_str): Likewise. * tree-ssa-loop-niter.c (record_estimate): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Likewise. * tree-ssa-operands.h: Don't use variable_size gty attribute. * tree-ssa.c (init_tree_ssa): Adjust. * tree-ssanames.c (set_range_info): Likewise. (get_ptr_info): Likewise. (duplicate_ssa_name_ptr_info): Likewise. (duplicate_ssa_name_range_info): Likewise. * tree-streamer-in.c (unpack_ts_real_cst_value_fields): Likewise. (unpack_ts_fixed_cst_value_fields): Likewise. * tree.c (build_fixed): Likewise. (build_real): Likewise. (build_string): Likewise. (decl_priority_info): Likewise. (decl_debug_expr_insert): Likewise. (decl_value_expr_insert): Likewise. (decl_debug_args_insert): Likewise. (type_hash_add): Likewise. (build_omp_clause): Likewise. * ubsan.c (decl_for_type_insert): Likewise. * varasm.c (get_unnamed_section): Likewise. (get_noswitch_section): Likewise. (get_section): Likewise. (get_block_for_section): Likewise. (create_block_symbol): Likewise. (build_constant_desc): Likewise. (create_constant_pool): Likewise. (force_const_mem): Likewise. (record_tm_clone_pair): Likewise. * varpool.c (varpool_create_empty_node): Likewise. gcc/c/ChangeLog: * c-decl.c (finish_struct): Adjust. (finish_enum): Likewise. (bind): Adjust. (record_inline_static): Likewise. (push_scope): Likewise. (make_label): Likewise. (lookup_label_for_goto): Likewise. (finish_struct): Likewise. (finish_enum): Likewise. (store_parm_decls): Likewise. (c_push_function_context): Likewise. * c-lang.h: Remove usage of variable_size gty attribute. * c-parser.c (c_parse_init): Adjust. (c_parse_file): Likewise. gcc/java/ChangeLog: * class.c (add_method_1): Adjust. (java_treetreehash_new): Likewise. * constants.c (set_constant_entry): Likewise. (cpool_for_class): Likewise. * decl.c (make_binding_level): Likewise. (java_dup_lang_specific_decl): Likewise. * expr.c (add_type_assertion): Likewise. * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise. (lang_decl): don't use variable_size gty attribute. (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Adjust. (lang_type): Don't use variable_size gty attribute. * jcf-parse.c (java_parse_file): Adjust. (process_zip_dir): Likewise. * jcf.h: Remove usage of variable_size gty attribute. * jcf-reader.c (jcf_parse_constant_pool): Adjust. (jcf_parse_bootstrap_methods): Likewise. gcc/objc/ChangeLog: * objc-act.c (objc_build_string_object): Adjust. (continue_class): Likewise. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. * objc-map.c (objc_map_alloc_ggc): Likewise. (objc_map_private_resize): Likewise. * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Likewise. (hash_name_enter): Likewise. gcc/cp/ChangeLog: * class.c (sorted_fields_type_new): Adjust. * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise. * cp-tree.h: Remove usage of variable_size gty attribute. * decl.c (make_label_decl): Adjust. (check_goto): Likewise. (start_preparsed_function): Likewise. (save_function_data): Likewise. * lex.c (init_reswords): Likewise. (retrofit_lang_decl): Likewise. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. * name-lookup.c (binding_entry_make): Likewise. (binding_table_construct): Likewise. (binding_table_new): Likewise. (cxx_binding_make): Likewise. (pushdecl_maybe_friend_1): Likewise. (begin_scope): Likewise. (push_to_top_level): Likewise. * parser.c (cp_lexer_alloc): Likewise. (cp_lexer_new_from_tokens): Likewise. (cp_token_cache_new): Likewise. (cp_parser_context_new): Likewise. (cp_parser_new): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_template_id): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (register_specialization): Likewise. (add_pending_template): Likewise. (lookup_template_class_1): Likewise. (push_tinst_level): Likewise. * semantics.c (register_constexpr_fundef): Likewise. (cxx_eval_call_expression): Likewise. * typeck2.c (abstract_virtuals_error_sfinae): Likewise. gcc/fortran/ChangeLog: * f95-lang.c (pushlevel): Adjust. * trans-decl.c (gfc_allocate_lang_decl): Adjust. (gfc_find_module): Likewise. * trans-types.c (gfc_get_nodesc_array_type): Likewise. (gfc_get_array_type_bounds): Likewise. (gfc_nonrestricted_type): Likewise. * trans.h: Don't use variable_size gty attribute. gcc/ada/ChangeLog: * gcc-interface/ada-tree.h: Remove usage of variable_size gty annotation. * gcc-interface/decl.c (annotate_value): Adjust. * gcc-interface/trans.c (Attribute_to_gnu): Likewise. (push_range_check_info): Likewise. (Loop_Statement_to_gnu): Likewise. (Subprogram_Body_to_gnu): Likewise. (Compilation_Unit_to_gnu): Likewise. (start_stmt_group): Likewise. * gcc-interface/utils.c (init_gnat_utils): Likewise. (gnat_pushlevel): Likewise. (maybe_pad_type): Likewise. gcc/go/ChangeLog: * go-lang.c (struct GTY): Don't use variable_size gty attribute. gcc/c-family/ChangeLog: * c-common.h (sorted_fields_type): Remove variable_size GTY attribute. * c-pragma.c (push_alignment): Adjust. (handle_pragma_push_options): Likewise. gcc/lto/ChangeLog: * lto-tree.h: Don't use variable_size gty attribute. * lto.c (lto_read_in_decl_state): Adjust. (create_subid_section_table): Likewise. (lto_flatten_files): Likewise. (read_cgraph_and_symbols): Likewise. gcc/objcp/ChangeLog: * objcp-decl.h: Adjust. From-SVN: r210566
2014-05-18 01:07:23 +02:00
struct GTY(()) lang_decl {
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
union GTY((desc ("%h.base.selector"))) lang_decl_u {
struct lang_decl_base GTY ((default)) base;
struct lang_decl_min GTY((tag ("0"))) min;
struct lang_decl_fn GTY ((tag ("1"))) fn;
struct lang_decl_ns GTY((tag ("2"))) ns;
struct lang_decl_parm GTY((tag ("3"))) parm;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
} u;
};
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
/* Looks through a template (if present) to find what it declares. */
#define STRIP_TEMPLATE(NODE) \
(TREE_CODE (NODE) == TEMPLATE_DECL ? DECL_TEMPLATE_RESULT (NODE) : NODE)
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
#define LANG_DECL_MIN_CHECK(NODE) __extension__ \
({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
if (!LANG_DECL_HAS_MIN (NODE)) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
&lt->u.min; })
/* We want to be able to check DECL_CONSTRUCTOR_P and such on a function
template, not just on a FUNCTION_DECL. So when looking for things in
lang_decl_fn, look down through a TEMPLATE_DECL into its result. */
#define LANG_DECL_FN_CHECK(NODE) __extension__ \
({ struct lang_decl *lt = DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE)); \
if (!DECL_DECLARES_FUNCTION_P (NODE) || lt->u.base.selector != 1) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
&lt->u.fn; })
#define LANG_DECL_NS_CHECK(NODE) __extension__ \
({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
if (TREE_CODE (NODE) != NAMESPACE_DECL || lt->u.base.selector != 2) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
&lt->u.ns; })
#define LANG_DECL_PARM_CHECK(NODE) __extension__ \
({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
if (TREE_CODE (NODE) != PARM_DECL) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
&lt->u.parm; })
#define LANG_DECL_U2_CHECK(NODE, TF) __extension__ \
({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
if (!LANG_DECL_HAS_MIN (NODE) || lt->u.base.u2sel != TF) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
&lt->u.min.u2; })
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
#else
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
#define LANG_DECL_MIN_CHECK(NODE) \
(&DECL_LANG_SPECIFIC (NODE)->u.min)
#define LANG_DECL_FN_CHECK(NODE) \
(&DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE))->u.fn)
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
#define LANG_DECL_NS_CHECK(NODE) \
(&DECL_LANG_SPECIFIC (NODE)->u.ns)
#define LANG_DECL_PARM_CHECK(NODE) \
(&DECL_LANG_SPECIFIC (NODE)->u.parm)
#define LANG_DECL_U2_CHECK(NODE, TF) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(&DECL_LANG_SPECIFIC (NODE)->u.min.u2)
#endif /* ENABLE_TREE_CHECKING */
1994-02-24 02:02:37 +01:00
/* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the
declaration. Some entities (like a member function in a local
class, or a local variable) do not have linkage at all, and this
macro should not be used in those cases.
Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was
created by language-independent code, and has C linkage. Most
VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but
we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */
#define DECL_LANGUAGE(NODE) \
(DECL_LANG_SPECIFIC (NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
? DECL_LANG_SPECIFIC (NODE)->u.base.language \
: (TREE_CODE (NODE) == FUNCTION_DECL \
? lang_c : lang_cplusplus))
/* Set the language linkage for NODE to LANGUAGE. */
#define SET_DECL_LANGUAGE(NODE, LANGUAGE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_LANG_SPECIFIC (NODE)->u.base.language = (LANGUAGE))
1994-02-24 02:02:37 +01:00
/* For FUNCTION_DECLs and TEMPLATE_DECLs: nonzero means that this function
is a constructor. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define DECL_CONSTRUCTOR_P(NODE) \
DECL_CXX_CONSTRUCTOR_P (STRIP_TEMPLATE (NODE))
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
object. */
#define DECL_COMPLETE_CONSTRUCTOR_P(NODE) \
(DECL_CONSTRUCTOR_P (NODE) \
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
&& DECL_NAME (NODE) == complete_ctor_identifier)
/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base
object. */
#define DECL_BASE_CONSTRUCTOR_P(NODE) \
(DECL_CONSTRUCTOR_P (NODE) \
&& DECL_NAME (NODE) == base_ctor_identifier)
/* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the
specialized in-charge constructor or the specialized not-in-charge
constructor. */
#define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_DECLARES_FUNCTION_P (NODE) && DECL_CONSTRUCTOR_P (NODE) \
&& !DECL_CLONED_FUNCTION_P (NODE))
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */
#define DECL_COPY_CONSTRUCTOR_P(NODE) \
(DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0)
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
/* Nonzero if NODE (a FUNCTION_DECL) is a move constructor. */
#define DECL_MOVE_CONSTRUCTOR_P(NODE) \
(DECL_CONSTRUCTOR_P (NODE) && move_fn_p (NODE))
/* Nonzero if NODE (a FUNCTION_DECL or TEMPLATE_DECL)
is a destructor. */
#define DECL_DESTRUCTOR_P(NODE) \
DECL_CXX_DESTRUCTOR_P (STRIP_TEMPLATE (NODE))
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
specialized in-charge constructor, in-charge deleting constructor,
or the base destructor. */
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
#define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_DECLARES_FUNCTION_P (NODE) && DECL_DESTRUCTOR_P (NODE) \
&& !DECL_CLONED_FUNCTION_P (NODE))
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
object. */
#define DECL_COMPLETE_DESTRUCTOR_P(NODE) \
(DECL_DESTRUCTOR_P (NODE) \
&& DECL_NAME (NODE) == complete_dtor_identifier)
/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base
object. */
#define DECL_BASE_DESTRUCTOR_P(NODE) \
(DECL_DESTRUCTOR_P (NODE) \
&& DECL_NAME (NODE) == base_dtor_identifier)
/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
object that deletes the object after it has been destroyed. */
#define DECL_DELETING_DESTRUCTOR_P(NODE) \
(DECL_DESTRUCTOR_P (NODE) \
&& DECL_NAME (NODE) == deleting_dtor_identifier)
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
destructor. */
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
#define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true))
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* If DECL_CLONED_FUNCTION_P holds, this is the function that was
cloned. */
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
#define DECL_CLONED_FUNCTION(NODE) (*decl_cloned_function_p (NODE, false))
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
/* Perform an action for each clone of FN, if FN is a function with
clones. This macro should be used like:
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
FOR_EACH_CLONE (clone, fn)
{ ... }
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
*/
#define FOR_EACH_CLONE(CLONE, FN) \
if (!(TREE_CODE (FN) == FUNCTION_DECL \
&& (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))))\
; \
else \
for (CLONE = DECL_CHAIN (FN); \
CLONE && DECL_CLONED_FUNCTION_P (CLONE); \
CLONE = DECL_CHAIN (CLONE))
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
2001-03-23 13:04:11 +01:00
/* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */
#define DECL_DISCRIMINATOR_P(NODE) \
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 (NODE) && DECL_FUNCTION_SCOPE_P (NODE))
2001-03-23 13:04:11 +01:00
/* Discriminator for name mangling. */
#define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
2001-03-23 13:04:11 +01:00
/* True iff DECL_DISCRIMINATOR is set for a DECL_DISCRIMINATOR_P decl. */
#define DECL_DISCRIMINATOR_SET_P(NODE) \
(DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->u.base.u2sel == 1)
/* The index of a user-declared parameter in its function, starting at 1.
All artificial parameters will have index 0. */
#define DECL_PARM_INDEX(NODE) \
(LANG_DECL_PARM_CHECK (NODE)->index)
/* The level of a user-declared parameter in its function, starting at 1.
A parameter of the function will have level 1; a parameter of the first
nested function declarator (i.e. t in void f (void (*p)(T t))) will have
level 2. */
#define DECL_PARM_LEVEL(NODE) \
(LANG_DECL_PARM_CHECK (NODE)->level)
/* Nonzero if the VTT parm has been added to NODE. */
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
#define DECL_HAS_VTT_PARM_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->has_vtt_parm_p)
Finish implementation of VTTs. * cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and CPTI_VTT_PARM_IDENTIFIER. (vtt_parm_identifier): New macro. (vtt_parm_type): Likewise. (BINFO_SUBVTT_INDEX): Likewise. (BINFO_VPTR_INDEX): Likewise. (struct lang_decl): Add vtt_parm. (DECL_VTT_PARM): New macro. (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject constructors and destructors. * class.c (get_vtt_name): Give it external linkage. (build_clone): Handle the magic VTT parameters for clones. (clone_function_decl): Fix typo in comment. (build_vtt): Keep track of the indices in the VTTs where various entities are stored. (build_vtt_inits): Likewise. (dfs_build_vtt_inits): Likewise. (build_ctor_vtbl_group): Tweak type of construction vtables. (dfs_accumulate_vtbl_inits): Build vtables for all bases, even primary bases, when building construction vtables. * decl.c (duplicate_decls): Handle DECL_VTT_PARM. (initialize_predefined_identifiers): Add vtt_parm_identifier. (init_decl_processing): Initialize vtt_parm_type. (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Make vtt_parm. * decl2.c (build_artificial_parm): New function. (maybe_retrofit_in_chrg): Use it. Add VTT parameters. (grokclassfn): Use build_artificial_parm. * init.c (initialize_vtbl_ptrs): Call fixup_all_virtual_upcast_offsets directly. (perform_member_init): Use the complete subobject destructor for member cleanups. (build_vtbl_address): New function. (expand_virtual_init): Handle VTTs. * optimize (maybe_clone_body): Likewise. * search.c (fixup_all_virtual_upcast_offsets): Give it external linkage. (expand_indirect_vtbls_init): Remove. * semantics.c (setup_vtbl_ptr): Fix typos in comment. * tree.c (make_binfo): Make them bigger. From-SVN: r34177
2000-05-26 01:27:18 +02:00
/* Nonzero if NODE is a FUNCTION_DECL for which a VTT parameter is
Finish implementation of VTTs. * cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and CPTI_VTT_PARM_IDENTIFIER. (vtt_parm_identifier): New macro. (vtt_parm_type): Likewise. (BINFO_SUBVTT_INDEX): Likewise. (BINFO_VPTR_INDEX): Likewise. (struct lang_decl): Add vtt_parm. (DECL_VTT_PARM): New macro. (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject constructors and destructors. * class.c (get_vtt_name): Give it external linkage. (build_clone): Handle the magic VTT parameters for clones. (clone_function_decl): Fix typo in comment. (build_vtt): Keep track of the indices in the VTTs where various entities are stored. (build_vtt_inits): Likewise. (dfs_build_vtt_inits): Likewise. (build_ctor_vtbl_group): Tweak type of construction vtables. (dfs_accumulate_vtbl_inits): Build vtables for all bases, even primary bases, when building construction vtables. * decl.c (duplicate_decls): Handle DECL_VTT_PARM. (initialize_predefined_identifiers): Add vtt_parm_identifier. (init_decl_processing): Initialize vtt_parm_type. (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Make vtt_parm. * decl2.c (build_artificial_parm): New function. (maybe_retrofit_in_chrg): Use it. Add VTT parameters. (grokclassfn): Use build_artificial_parm. * init.c (initialize_vtbl_ptrs): Call fixup_all_virtual_upcast_offsets directly. (perform_member_init): Use the complete subobject destructor for member cleanups. (build_vtbl_address): New function. (expand_virtual_init): Handle VTTs. * optimize (maybe_clone_body): Likewise. * search.c (fixup_all_virtual_upcast_offsets): Give it external linkage. (expand_indirect_vtbls_init): Remove. * semantics.c (setup_vtbl_ptr): Fix typos in comment. * tree.c (make_binfo): Make them bigger. From-SVN: r34177
2000-05-26 01:27:18 +02:00
required. */
#define DECL_NEEDS_VTT_PARM_P(NODE) \
(CLASSTYPE_VBASECLASSES (DECL_CONTEXT (NODE)) \
Finish implementation of VTTs. * cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and CPTI_VTT_PARM_IDENTIFIER. (vtt_parm_identifier): New macro. (vtt_parm_type): Likewise. (BINFO_SUBVTT_INDEX): Likewise. (BINFO_VPTR_INDEX): Likewise. (struct lang_decl): Add vtt_parm. (DECL_VTT_PARM): New macro. (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject constructors and destructors. * class.c (get_vtt_name): Give it external linkage. (build_clone): Handle the magic VTT parameters for clones. (clone_function_decl): Fix typo in comment. (build_vtt): Keep track of the indices in the VTTs where various entities are stored. (build_vtt_inits): Likewise. (dfs_build_vtt_inits): Likewise. (build_ctor_vtbl_group): Tweak type of construction vtables. (dfs_accumulate_vtbl_inits): Build vtables for all bases, even primary bases, when building construction vtables. * decl.c (duplicate_decls): Handle DECL_VTT_PARM. (initialize_predefined_identifiers): Add vtt_parm_identifier. (init_decl_processing): Initialize vtt_parm_type. (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Make vtt_parm. * decl2.c (build_artificial_parm): New function. (maybe_retrofit_in_chrg): Use it. Add VTT parameters. (grokclassfn): Use build_artificial_parm. * init.c (initialize_vtbl_ptrs): Call fixup_all_virtual_upcast_offsets directly. (perform_member_init): Use the complete subobject destructor for member cleanups. (build_vtbl_address): New function. (expand_virtual_init): Handle VTTs. * optimize (maybe_clone_body): Likewise. * search.c (fixup_all_virtual_upcast_offsets): Give it external linkage. (expand_indirect_vtbls_init): Remove. * semantics.c (setup_vtbl_ptr): Fix typos in comment. * tree.c (make_binfo): Make them bigger. From-SVN: r34177
2000-05-26 01:27:18 +02:00
&& (DECL_BASE_CONSTRUCTOR_P (NODE) \
|| DECL_BASE_DESTRUCTOR_P (NODE)))
/* Nonzero if NODE is a user-defined conversion operator. */
#define DECL_CONV_FN_P(NODE) \
(DECL_NAME (NODE) && IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
/* If FN is a conversion operator, the type to which it converts.
Otherwise, NULL_TREE. */
#define DECL_CONV_FN_TYPE(FN) \
(DECL_CONV_FN_P (FN) ? TREE_TYPE (DECL_NAME (FN)) : NULL_TREE)
/* Nonzero if NODE, which is a TEMPLATE_DECL, is a template
conversion operator to a type dependent on the innermost template
args. */
#define DECL_TEMPLATE_CONV_FN_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_LANG_SPECIFIC (TEMPLATE_DECL_CHECK (NODE))->u.base.template_conv_p)
/* Nonzero if NODE, a static data member, was declared in its class as an
array of unknown bound. */
#define VAR_HAD_UNKNOWN_BOUND(NODE) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \
? DECL_LANG_SPECIFIC (NODE)->u.base.template_conv_p \
: false)
#define SET_VAR_HAD_UNKNOWN_BOUND(NODE) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.template_conv_p = true)
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
/* Set the overloaded operator code for NODE to CODE. */
#define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->operator_code = (CODE))
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
/* If NODE is an overloaded operator, then this returns the TREE_CODE
associated with the overloaded operator.
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine
whether or not NODE is an assignment operator. If NODE is not an
overloaded operator, ERROR_MARK is returned. Since the numerical
value of ERROR_MARK is zero, this macro can be used as a predicate
to test whether or not NODE is an overloaded operator. */
#define DECL_OVERLOADED_OPERATOR_P(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
? LANG_DECL_FN_CHECK (NODE)->operator_code : ERROR_MARK)
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
/* Nonzero if NODE is an assignment operator (including += and such). */
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
#define DECL_ASSIGNMENT_OPERATOR_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->assignment_operator_p)
/* For FUNCTION_DECLs: nonzero means that this function is a
constructor or a destructor with an extra in-charge parameter to
control whether or not virtual bases are constructed. */
#define DECL_HAS_IN_CHARGE_PARM_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->has_in_charge_parm_p)
1994-02-24 02:02:37 +01:00
/* Nonzero if DECL is a declaration of __builtin_constant_p. */
#define DECL_IS_BUILTIN_CONSTANT_P(NODE) \
(TREE_CODE (NODE) == FUNCTION_DECL \
&& DECL_BUILT_IN_CLASS (NODE) == BUILT_IN_NORMAL \
&& DECL_FUNCTION_CODE (NODE) == BUILT_IN_CONSTANT_P)
1994-02-24 02:02:37 +01:00
/* Nonzero for _DECL means that this decl appears in (or will appear
in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
detecting circularity in case members are multiply defined. In the
case of a VAR_DECL, it is also used to determine how program storage
should be allocated. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE))
1994-02-24 02:02:37 +01:00
/* Nonzero for a VAR_DECL means that the variable's initialization (if
any) has been processed. (In general, DECL_INITIALIZED_P is
!DECL_EXTERNAL, but static data members may be initialized even if
not defined.) */
store-layout.c (finish_record_layout): Add free_p parameter. * store-layout.c (finish_record_layout): Add free_p parameter. (layout_type): Pass it. * tree.h (finish_record_layout): Update prototype. * class.c (walk_subobject_offsets): Correct the calculation of offsets for virtual bases. Correct the counting of array elements. (layout_nonempty_base_or_field): Simplify. Correct the calculation of offsets to be propagated through the binfo hierarchy. (build_base_field): Avoid creating a FIELD_DECL for empty bases. Add the FIELD_DECL to TYPE_FIELDS. (build_base_fields): Adjust accordingly. (layout_virtual_bases): Use build_base_field. (end_of_class): Return a tree, not an integer. (warn_about_ambiguous_direct_bases): Rename to ... (warn_about_ambiguous_bases): ... this. (include_empty_classes): New function. (layout_class_type): Create an alternative version of the type to be used when as a base class type. Do not call finish_record_layout until we are done laying out the class. * cp-tree.h (lang_type_class): Remove size, size_unit. Add as_base. (CLASSTYPE_SIZE): Reimplement. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN): Likweise. (CLASSTYPE_USER_ALIGN): Likewise. (CLASSTYPE_AS_BASE): New macro. (DECL_INITIALIZED_P): Likewise. (extract_init): Remove prototype. (build_forced_zero_init): Rename to ... (build_zero_init): ... this. (force_store_init_value): Remove. * decl.c (obscure_complex_init): Remove. (duplicate_decls): Copy DECL_INITIALIZED_P. (check_initializer): Do not leave junk in DECL_INITIAL. (cp_finish_decl): Handle zero-initialization of entities with static storage duration. * expr.c (extract_init): Remove. * init.c (build_forced_zero_init): Remove. (build_zero_init): New function. (build_default_init): Use it. (build_field_list): Skip FIELD_DECLs for base subobjects. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. (synthesize_exception_spec): Likewise. * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P. (regenerate_decl_from_template): To not set DECL_INITIAL for a static data member whose initialization took place in its class. (instantiate_decl): Do not pass an initializer to cp_finish_decl in that situation. * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects. (dfs_unuse_fields): Likewise. * tree.c (pod_type_p): Handle error_mark_node. (zero_init_p): Likewise. * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base subobjects. * typeck2.c (store_init_value): Remove #if 0'd code. (force_store_init_value): Remove. (process_init_constructor): Use build_zero_init. * g++.dg/abi/empty7.C: New test. * g++.dg/init/pm2.C: Likewise. From-SVN: r57654
2002-09-30 18:52:19 +02:00
#define DECL_INITIALIZED_P(NODE) \
(TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE)))
/* Nonzero for a VAR_DECL iff an explicit initializer was provided
or a non-trivial constructor is called. */
#define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \
(TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE)))
re PR c++/11547 (ICE with const temporaries) PR c++/11547 * cp-tree.h (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P): New macro. (DECL_PRETTY_FUNCTION_P): Use VAR_DECL_CHECK. * decl.c (duplicate_decls): Merge DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. * parser.c (cp_parser_postfix_expression): Adjust call to cp_parser_initializer_list and cp_parser_parenthesized_expression_list. (cp_parser_parenthesized_expression_list): Add non_constant_p. (cp_parser_new_placement): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_direct_new_declarator): Likewise. (cp_parser_conditional_expression): Remove. (cp_parser_constant_expression): Parse an assignment-expression, not a conditional-expression. (cp_parser_simple_declaration): Resolve expression/declaration ambiguity more quickly. (cp_parser_mem_initializer): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_init_declarator): Keep track of whether or not the initializer is a constant-expression. (cp_parser_initializer): Add non_constant_p parameter. (cp_parser_initializer_clause): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_attribute_list): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_functional_cast): Likewise. * pt.c (tsubst_decl): Copy DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. (tsubst_expr): Tweak use of DECL_PRETTY_FUNCTION_P. * semantics.c (finish_id_expression): Use DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. PR c++/11547 * g++.dg/parse/constant3.C: New test. * g++.dg/parse/crash7.C: Likewise. From-SVN: r69493
2003-07-17 06:31:42 +02:00
/* Nonzero for a VAR_DECL that was initialized with a
constant-expression. */
#define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \
(TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE)))
/* Nonzero if the DECL was initialized in the class definition itself,
rather than outside the class. This is used for both static member
VAR_DECLS, and FUNCTION_DECLS that are defined in the class. */
#define DECL_INITIALIZED_IN_CLASS_P(DECL) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \
->u.base.initialized_in_class)
/* Nonzero if the DECL is used in the sense of 3.2 [basic.def.odr].
Only available for decls with DECL_LANG_SPECIFIC. */
#define DECL_ODR_USED(DECL) \
(DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \
->u.base.odr_used)
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
/* Nonzero for DECL means that this decl is just a friend declaration,
and should not be added to the list of members for this class. */
#define DECL_FRIEND_P(NODE) \
(DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \
->u.base.friend_or_tls)
/* Nonzero if the thread-local variable was declared with __thread as
opposed to thread_local. */
#define DECL_GNU_TLS_P(NODE) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \
&& DECL_LANG_SPECIFIC (NODE)->u.base.friend_or_tls)
#define SET_DECL_GNU_TLS_P(NODE) \
(retrofit_lang_decl (VAR_DECL_CHECK (NODE)), \
DECL_LANG_SPECIFIC (NODE)->u.base.friend_or_tls = true)
1994-02-24 02:02:37 +01:00
/* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
#define DECL_BEFRIENDING_CLASSES(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->befriending_classes)
1994-02-24 02:02:37 +01:00
/* Nonzero for FUNCTION_DECL means that this decl is a static
member function. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define DECL_STATIC_FUNCTION_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->static_function)
1994-02-24 02:02:37 +01:00
/* Nonzero for FUNCTION_DECL means that this decl is a non-static
member function. */
#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
(TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
/* Nonzero for FUNCTION_DECL means that this decl is a member function
(static or non-static). */
#define DECL_FUNCTION_MEMBER_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
1994-02-24 02:02:37 +01:00
/* Nonzero for FUNCTION_DECL means that this member function
has `this' as const X *const. */
#define DECL_CONST_MEMFUNC_P(NODE) \
(DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
&& CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \
(TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
1994-02-24 02:02:37 +01:00
/* Nonzero for FUNCTION_DECL means that this member function
has `this' as volatile X *const. */
#define DECL_VOLATILE_MEMFUNC_P(NODE) \
(DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
&& CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \
(TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Nonzero for a DECL means that this member is a non-static member. */
#define DECL_NONSTATIC_MEMBER_P(NODE) \
(DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
|| TREE_CODE (NODE) == FIELD_DECL)
1994-02-24 02:02:37 +01:00
/* Nonzero for _DECL means that this member object type
is mutable. */
#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
1994-02-24 02:02:37 +01:00
Implement explicit conversions ops as specified in N2437. * decl.c (grokdeclarator): Handle explicit conversion ops. (check_initializer): Pass flags to store_init_value. * decl2.c (maybe_emit_vtables): Likewise. * init.c (expand_aggr_init_1): Likewise. * call.c (convert_class_to_reference): Take flags parm, check DECL_NONCONVERTING_P. (build_user_type_conversion_1): Check DECL_NONCONVERTING_P. (add_builtin_candidates): Simplify getting type of conversion. (build_object_call): Likewise. Check DECL_NONCONVERTING_P. (implicit_conversion): Pass through LOOKUP_ONLYCONVERTING. (reference_binding): Take flags parm. Direct-initialize copy parm. (add_function_candidate): Direct-initialize the copy parm. (add_conv_candidate): Use LOOKUP_IMPLICIT, not LOOKUP_NORMAL. (build_builtin_candidate): Add LOOKUP_ONLYCONVERTING. (conditional_conversion): Likewise. (convert_like_real): Only complain about DECL_NONCONVERTING_P constructors. (perform_implicit_conversion_flags): Add flags parm to perform_implicit_conversion. Improve diagnostics. * cp-tree.h (LOOKUP_IMPLICIT): New macro. (LOOKUP_COPY_PARM): New bit macro. * cvt.c (build_expr_type_conversion): Check DECL_NONCONVERTING_P. * typeck.c (convert_for_assignment): Take flags parm, pass it to perform_implicit_conversion_flags. (cp_build_modify_expr): Pass flags to convert_for_assignment. (convert_for_initialization): Likewise. * typeck2.c (store_init_value): Take flags parm, pass to digest_init_flags. (digest_init_flags): Add flags parm to digest_init. (digest_init_r): Take flags parm, pass to convert_for_initialization. (process_init_constructor_array): Pass it. (process_init_constructor_record): Likewise. (process_init_constructor_union): Likewise. From-SVN: r147677
2009-05-18 23:48:02 +02:00
/* Nonzero for _DECL means that this constructor or conversion function is
non-converting. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define DECL_NONCONVERTING_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->nonconverting)
/* Nonzero for FUNCTION_DECL means that this member function is a pure
virtual function. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define DECL_PURE_VIRTUAL_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->pure_virtual)
1994-02-24 02:02:37 +01:00
/* True (in a FUNCTION_DECL) if NODE is a virtual function that is an
invalid overrider for a function from a base class. Once we have
complained about an invalid overrider we avoid complaining about it
again. */
#define DECL_INVALID_OVERRIDER_P(NODE) \
(DECL_LANG_FLAG_4 (NODE))
/* True (in a FUNCTION_DECL) if NODE is a function declared with
an override virt-specifier */
#define DECL_OVERRIDE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
/* The thunks associated with NODE, a FUNCTION_DECL. */
#define DECL_THUNKS(NODE) \
(DECL_VIRTUAL_P (NODE) ? LANG_DECL_FN_CHECK (NODE)->context : NULL_TREE)
/* Set DECL_THUNKS. */
#define SET_DECL_THUNKS(NODE,THUNKS) \
(LANG_DECL_FN_CHECK (NODE)->context = (THUNKS))
/* If NODE, a FUNCTION_DECL, is a C++11 inheriting constructor, then this
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
is the constructor it inherits from. */
#define DECL_INHERITED_CTOR(NODE) \
(DECL_DECLARES_FUNCTION_P (NODE) && DECL_CONSTRUCTOR_P (NODE) \
? LANG_DECL_FN_CHECK (NODE)->context : NULL_TREE)
/* And this is the base that constructor comes from. */
#define DECL_INHERITED_CTOR_BASE(NODE) \
(DECL_INHERITED_CTOR (NODE) \
? DECL_CONTEXT (flag_new_inheriting_ctors \
? strip_inheriting_ctors (NODE) \
: DECL_INHERITED_CTOR (NODE)) \
: NULL_TREE)
/* Set the inherited base. */
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
#define SET_DECL_INHERITED_CTOR(NODE,INH) \
(LANG_DECL_FN_CHECK (NODE)->context = (INH))
/* Nonzero if NODE is a thunk, rather than an ordinary function. */
#define DECL_THUNK_P(NODE) \
(TREE_CODE (NODE) == FUNCTION_DECL \
&& DECL_LANG_SPECIFIC (NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
&& LANG_DECL_FN_CHECK (NODE)->thunk_p)
/* Set DECL_THUNK_P for node. */
#define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->thunk_p = 1, \
LANG_DECL_FN_CHECK (NODE)->this_thunk_p = (THIS_ADJUSTING))
/* Nonzero if NODE is a this pointer adjusting thunk. */
#define DECL_THIS_THUNK_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_THUNK_P (NODE) && LANG_DECL_FN_CHECK (NODE)->this_thunk_p)
/* Nonzero if NODE is a result pointer adjusting thunk. */
#define DECL_RESULT_THUNK_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_THUNK_P (NODE) && !LANG_DECL_FN_CHECK (NODE)->this_thunk_p)
/* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */
#define DECL_NON_THUNK_FUNCTION_P(NODE) \
(TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE))
/* Nonzero if NODE is `extern "C"'. */
#define DECL_EXTERN_C_P(NODE) \
(DECL_LANGUAGE (NODE) == lang_c)
/* Nonzero if NODE is an `extern "C"' function. */
#define DECL_EXTERN_C_FUNCTION_P(NODE) \
(DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
/* True iff DECL is an entity with vague linkage whose definition is
available in this translation unit. */
#define DECL_REPO_AVAILABLE_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_LANG_SPECIFIC (NODE)->u.base.repo_available_p)
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
/* True if DECL is declared 'constexpr'. */
#define DECL_DECLARED_CONSTEXPR_P(DECL) \
DECL_LANG_FLAG_8 (VAR_OR_FUNCTION_DECL_CHECK (STRIP_TEMPLATE (DECL)))
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
// True if NODE was declared as 'concept'. The flag implies that the
// declaration is constexpr, that the declaration cannot be specialized or
// refined, and that the result type must be convertible to bool.
#define DECL_DECLARED_CONCEPT_P(NODE) \
(DECL_LANG_SPECIFIC (NODE)->u.base.concept_p)
/* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
template function. */
#define DECL_PRETTY_FUNCTION_P(NODE) \
(DECL_NAME (NODE) \
&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (NODE)), "__PRETTY_FUNCTION__"))
/* Nonzero if the variable was declared to be thread-local.
We need a special C++ version of this test because the middle-end
DECL_THREAD_LOCAL_P uses the symtab, so we can't use it for
templates. */
#define CP_DECL_THREAD_LOCAL_P(NODE) \
(TREE_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)))
/* The _TYPE context in which this _DECL appears. This field holds the
class where a virtual function instance is actually defined. */
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
#define DECL_CLASS_CONTEXT(NODE) \
(DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE)
/* For a non-member friend function, the class (if any) in which this
friend was defined. For example, given:
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
struct S { friend void f (); };
the DECL_FRIEND_CONTEXT for `f' will be `S'. */
#define DECL_FRIEND_CONTEXT(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
((DECL_DECLARES_FUNCTION_P (NODE) \
&& DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \
? LANG_DECL_FN_CHECK (NODE)->context \
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
: NULL_TREE)
/* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */
#define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->context = (CONTEXT))
#define CP_DECL_CONTEXT(NODE) \
(!DECL_FILE_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
#define CP_TYPE_CONTEXT(NODE) \
(!TYPE_FILE_SCOPE_P (NODE) ? TYPE_CONTEXT (NODE) : global_namespace)
#define FROB_CONTEXT(NODE) \
((NODE) == global_namespace ? DECL_CONTEXT (NODE) : (NODE))
1994-02-24 02:02:37 +01:00
/* 1 iff NODE has namespace scope, including the global namespace. */
#define DECL_NAMESPACE_SCOPE_P(NODE) \
(!DECL_TEMPLATE_PARM_P (NODE) \
&& TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
#define TYPE_NAMESPACE_SCOPE_P(NODE) \
(TREE_CODE (CP_TYPE_CONTEXT (NODE)) == NAMESPACE_DECL)
#define NAMESPACE_SCOPE_P(NODE) \
((DECL_P (NODE) && DECL_NAMESPACE_SCOPE_P (NODE)) \
|| (TYPE_P (NODE) && TYPE_NAMESPACE_SCOPE_P (NODE)))
/* 1 iff NODE is a class member. */
#define DECL_CLASS_SCOPE_P(NODE) \
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
(DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE)))
#define TYPE_CLASS_SCOPE_P(NODE) \
(TYPE_CONTEXT (NODE) && TYPE_P (TYPE_CONTEXT (NODE)))
/* 1 iff NODE is function-local. */
#define DECL_FUNCTION_SCOPE_P(NODE) \
(DECL_CONTEXT (NODE) \
&& TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
#define TYPE_FUNCTION_SCOPE_P(NODE) \
(TYPE_CONTEXT (NODE) && TREE_CODE (TYPE_CONTEXT (NODE)) == FUNCTION_DECL)
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
/* 1 iff VAR_DECL node NODE is a type-info decl. This flag is set for
both the primary typeinfo object and the associated NTBS name. */
#define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))
/* 1 iff VAR_DECL node NODE is virtual table or VTT. */
#define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE))
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
/* 1 iff FUNCTION_TYPE or METHOD_TYPE has a ref-qualifier (either & or &&). */
#define FUNCTION_REF_QUALIFIED(NODE) \
TREE_LANG_FLAG_4 (FUNC_OR_METHOD_CHECK (NODE))
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
/* 1 iff FUNCTION_TYPE or METHOD_TYPE has &&-ref-qualifier. */
#define FUNCTION_RVALUE_QUALIFIED(NODE) \
TREE_LANG_FLAG_5 (FUNC_OR_METHOD_CHECK (NODE))
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
/* Returns 1 iff VAR_DECL is a construction virtual table.
DECL_VTABLE_OR_VTT_P will be true in this case and must be checked
before using this macro. */
#define DECL_CONSTRUCTION_VTABLE_P(NODE) \
TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE))
[multiple changes] 2000-08-28 Daniel Berlin <dberlin@redhat.com> * dwarf2out.c (DIE_LABEL_PREFIX): Remove leading "__". (print_die): If we don't know the offset of the target die, try the symbol. Add a trailing newline. (reverse_all_dies): New fn. (dwarf2out_finish): Call it. (break_out_includes): Reorganize for clarity. (add_sibling_attributes): Don't call reverse_die_lists. (output_comp_unit): Rename from output_comdat_comp_unit. Use for primary CU, too. * flags.h: Add flag_eliminate_dwarf2_dups. * toplev.c (f_options): Support -feliminate-dwarf2-dups. 2000-08-28 Jason Merrill <jason@redhat.com> * dwarf2.h (DW_TAG_GNU_BINCL, DW_TAG_GNU_EINCL): New tags. * dwarf2out.c: #include "md5.h". (DIE_LABEL_PREFIX): New macro. (dw_val_struct): Add 'external' flag to val_die_ref. (add_AT_die_ref, AT_ref): Adjust. (AT_ref_external, set_AT_ref_external): New fns. (build_abbrev_table): Call set_AT_ref_external. (value_format): Call AT_ref_external. (die_struct): Add die_symbol field. (new_die): Clear it. (dwarf_tag_name): Handle BINCL/EINCL. (dwarf2out_start_source_file): Add BINCL DIE. (dwarf2out_end_source_file): Add EINCL DIE. (push_new_compile_unit, pop_compile_unit, clear_die_sizes): New fns. (loc_checksum, attr_checksum, die_checksum): New fns. (is_type_die, is_comdat_die, is_symbol_die): New fns. (compute_section_prefix, assign_symbol_names): New fns. (gen_internal_sym, output_die_symbol, output_symbolic_ref): New fns. (output_die): Call output_die_symbol and AT_ref_external. (output_comdat_comp_unit): New fn, split out from... (dwarf2out_finish): ...here. Also call add_sibling_attributes for secondary CUs. (output_pubnames, output_aranges): Abort if we see entries from secondary CUs. * toplev.h: Declare file_name_nondirectory. * toplev.c (file_name_nondirectory): New fn, moved from C++ frontend. (rest_of_type_compilation): Call dwarf2out_decl if at toplevel. (debug_start_source_file): Call dwarf2out_start_source_file regardless of debug verbosity. (debug_end_source_file): Similarly. * tree.h: Declare clean_symbol_name. * tree.c (clean_symbol_name): Split out from... (get_file_function_name_long): ...here. * dwarf2out.c (new_loc_descr): Use calloc. (splice_child_die): Remove the die from the right parent. (gen_struct_or_union_die): Don't add AT_name to a specification DIE. gcc/cp: 2000-08-28 Jason Merrill <jason@redhat.com> * lex.c (file_name_nondirectory): Move to toplev.c. libiberty: 2000-08-28 Jason Merrill <jason@redhat.com> * Makefile.in (REQUIRED_OFILES): Add md5.o. (CFILES): Add md5.c. * md5.c: New file. include: 2000-08-28 Jason Merrill <jason@redhat.com> * md5.h: New file. gcc/cp: 2000-08-28 Jason Merrill <jason@redhat.com> * cp-tree.h (LOCAL_CLASS_P): New macro. * class.c (finish_struct_1): Use it. From-SVN: r36022
2000-08-29 02:29:29 +02:00
/* 1 iff NODE is function-local, but for types. */
#define LOCAL_CLASS_P(NODE) \
(decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
[multiple changes] 2000-08-28 Daniel Berlin <dberlin@redhat.com> * dwarf2out.c (DIE_LABEL_PREFIX): Remove leading "__". (print_die): If we don't know the offset of the target die, try the symbol. Add a trailing newline. (reverse_all_dies): New fn. (dwarf2out_finish): Call it. (break_out_includes): Reorganize for clarity. (add_sibling_attributes): Don't call reverse_die_lists. (output_comp_unit): Rename from output_comdat_comp_unit. Use for primary CU, too. * flags.h: Add flag_eliminate_dwarf2_dups. * toplev.c (f_options): Support -feliminate-dwarf2-dups. 2000-08-28 Jason Merrill <jason@redhat.com> * dwarf2.h (DW_TAG_GNU_BINCL, DW_TAG_GNU_EINCL): New tags. * dwarf2out.c: #include "md5.h". (DIE_LABEL_PREFIX): New macro. (dw_val_struct): Add 'external' flag to val_die_ref. (add_AT_die_ref, AT_ref): Adjust. (AT_ref_external, set_AT_ref_external): New fns. (build_abbrev_table): Call set_AT_ref_external. (value_format): Call AT_ref_external. (die_struct): Add die_symbol field. (new_die): Clear it. (dwarf_tag_name): Handle BINCL/EINCL. (dwarf2out_start_source_file): Add BINCL DIE. (dwarf2out_end_source_file): Add EINCL DIE. (push_new_compile_unit, pop_compile_unit, clear_die_sizes): New fns. (loc_checksum, attr_checksum, die_checksum): New fns. (is_type_die, is_comdat_die, is_symbol_die): New fns. (compute_section_prefix, assign_symbol_names): New fns. (gen_internal_sym, output_die_symbol, output_symbolic_ref): New fns. (output_die): Call output_die_symbol and AT_ref_external. (output_comdat_comp_unit): New fn, split out from... (dwarf2out_finish): ...here. Also call add_sibling_attributes for secondary CUs. (output_pubnames, output_aranges): Abort if we see entries from secondary CUs. * toplev.h: Declare file_name_nondirectory. * toplev.c (file_name_nondirectory): New fn, moved from C++ frontend. (rest_of_type_compilation): Call dwarf2out_decl if at toplevel. (debug_start_source_file): Call dwarf2out_start_source_file regardless of debug verbosity. (debug_end_source_file): Similarly. * tree.h: Declare clean_symbol_name. * tree.c (clean_symbol_name): Split out from... (get_file_function_name_long): ...here. * dwarf2out.c (new_loc_descr): Use calloc. (splice_child_die): Remove the die from the right parent. (gen_struct_or_union_die): Don't add AT_name to a specification DIE. gcc/cp: 2000-08-28 Jason Merrill <jason@redhat.com> * lex.c (file_name_nondirectory): Move to toplev.c. libiberty: 2000-08-28 Jason Merrill <jason@redhat.com> * Makefile.in (REQUIRED_OFILES): Add md5.o. (CFILES): Add md5.c. * md5.c: New file. include: 2000-08-28 Jason Merrill <jason@redhat.com> * md5.h: New file. gcc/cp: 2000-08-28 Jason Merrill <jason@redhat.com> * cp-tree.h (LOCAL_CLASS_P): New macro. * class.c (finish_struct_1): Use it. From-SVN: r36022
2000-08-29 02:29:29 +02:00
/* For a NAMESPACE_DECL: the list of using namespace directives
Partial implementation of namespaces. * decl.c (push_namespace): Handle redeclaration error. * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. (IDENTIFIER_NAMESPACE_BINDINGS): New macro. (NAMESPACE_BINDING): New macro. (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. * *.c: Use them. * pt.c (push_template_decl): Use innermost_args. * decl.c (get_unique_name): Tweak from earlier in the name. * cp-tree.def: Add CPLUS_BINDING node. * cp-tree.h (tree_binding): new struct (BINDING_SCOPE, BINDING_VALUE): new macros (current_namespace, global_namespace): declare extern (struct lang_decl_flags): new field in_namespace (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros (DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros (TREE_INDIRECT_USING): new macro * decl2.c (current_namespace, global_namespace): Declare. The value is a NAMESPACE_DECL now, not a TREE_LIST. (is_namespace_ancestor, namespace_ancestor):new static functions. (add_using_namespace, ambiguous_decl): likewise. (lookup_using_namespace): new support function for lookup_name. (qualified_lookup_using_namespace): new support function for do_scoped_id and lookup_namespace_name (get_namespace_id): mark as obsolete. (current_namespace_id): Likewise. (do_namespace_alias): Implement. (do_using_directive): Implement as call to add_using_namespace. * decl.c (binding_for_name): new function. (push_namespace, pop_namespace): implement. (push_decl): don't install a FUNCTION_DECL in the global branch. (lookup_namespace_name): implement using qualified lookup. (lookup_name_real): For global scoping, lookup in global_namespace. For namespace scoping, lookup in given namespace. For unscoped lookup, iterate over namespace, considering using directives. (init_decl_processing): initialize global_namespace. (grokvardecl): Build assembler name as static name for globals. (grokdeclarator): Remove old namespace mangling. (xref_tag): When installing a global binding for the tag, make sure we have an identifier. * method.c (build_overload_nested_name): mangle namespaces. (build_qualified_name): Likewise. (build_decl_overload_real): Likewise. * lex.c (build_lang_decl): set namespace for new declaration to current_namespace. (do_scoped_id): find global names in global or current namespace, or using qualified namespace lookup, depending on context. * init.c (build_member_call): When scope is namespace, use build_x_function_call instead. (build_offset_ref): When scope is namespace, collapse processing to lookup_namespace_name instead. * error.c (dump_decl): Support NAMESPACE_DECL. * decl.c (pushdecl): Bind globals to current namespace. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (xref_tag): Likewise. (start_function): Likewise. * lex.c (do_identifier): Likewise. (identifier_typedecl_value): Likewise. (real_yylex): Likewise. * method.c (do_inline_function_hair): Likewise. * parse.y (unscoped): Likewise. * pt.c (check_explicit_specialization): Likewise. (lookup_template_class): Likewise. * rtti.c (call_void_fn): Likewise. * sig.c (build_sigtable): Likewise. * ptree.c (lang_print_xnode): New function. From-SVN: r18227
1998-02-25 01:49:51 +01:00
The PURPOSE is the used namespace, the value is the namespace
that is the common ancestor. */
#define DECL_NAMESPACE_USING(NODE) (LANG_DECL_NS_CHECK (NODE)->ns_using)
Partial implementation of namespaces. * decl.c (push_namespace): Handle redeclaration error. * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. (IDENTIFIER_NAMESPACE_BINDINGS): New macro. (NAMESPACE_BINDING): New macro. (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. * *.c: Use them. * pt.c (push_template_decl): Use innermost_args. * decl.c (get_unique_name): Tweak from earlier in the name. * cp-tree.def: Add CPLUS_BINDING node. * cp-tree.h (tree_binding): new struct (BINDING_SCOPE, BINDING_VALUE): new macros (current_namespace, global_namespace): declare extern (struct lang_decl_flags): new field in_namespace (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros (DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros (TREE_INDIRECT_USING): new macro * decl2.c (current_namespace, global_namespace): Declare. The value is a NAMESPACE_DECL now, not a TREE_LIST. (is_namespace_ancestor, namespace_ancestor):new static functions. (add_using_namespace, ambiguous_decl): likewise. (lookup_using_namespace): new support function for lookup_name. (qualified_lookup_using_namespace): new support function for do_scoped_id and lookup_namespace_name (get_namespace_id): mark as obsolete. (current_namespace_id): Likewise. (do_namespace_alias): Implement. (do_using_directive): Implement as call to add_using_namespace. * decl.c (binding_for_name): new function. (push_namespace, pop_namespace): implement. (push_decl): don't install a FUNCTION_DECL in the global branch. (lookup_namespace_name): implement using qualified lookup. (lookup_name_real): For global scoping, lookup in global_namespace. For namespace scoping, lookup in given namespace. For unscoped lookup, iterate over namespace, considering using directives. (init_decl_processing): initialize global_namespace. (grokvardecl): Build assembler name as static name for globals. (grokdeclarator): Remove old namespace mangling. (xref_tag): When installing a global binding for the tag, make sure we have an identifier. * method.c (build_overload_nested_name): mangle namespaces. (build_qualified_name): Likewise. (build_decl_overload_real): Likewise. * lex.c (build_lang_decl): set namespace for new declaration to current_namespace. (do_scoped_id): find global names in global or current namespace, or using qualified namespace lookup, depending on context. * init.c (build_member_call): When scope is namespace, use build_x_function_call instead. (build_offset_ref): When scope is namespace, collapse processing to lookup_namespace_name instead. * error.c (dump_decl): Support NAMESPACE_DECL. * decl.c (pushdecl): Bind globals to current namespace. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (xref_tag): Likewise. (start_function): Likewise. * lex.c (do_identifier): Likewise. (identifier_typedecl_value): Likewise. (real_yylex): Likewise. * method.c (do_inline_function_hair): Likewise. * parse.y (unscoped): Likewise. * pt.c (check_explicit_specialization): Likewise. (lookup_template_class): Likewise. * rtti.c (call_void_fn): Likewise. * sig.c (build_sigtable): Likewise. * ptree.c (lang_print_xnode): New function. From-SVN: r18227
1998-02-25 01:49:51 +01:00
/* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
of a namespace, to record the transitive closure of using namespace. */
#define DECL_NAMESPACE_USERS(NODE) (LANG_DECL_NS_CHECK (NODE)->ns_users)
Partial implementation of namespaces. * decl.c (push_namespace): Handle redeclaration error. * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. (IDENTIFIER_NAMESPACE_BINDINGS): New macro. (NAMESPACE_BINDING): New macro. (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. * *.c: Use them. * pt.c (push_template_decl): Use innermost_args. * decl.c (get_unique_name): Tweak from earlier in the name. * cp-tree.def: Add CPLUS_BINDING node. * cp-tree.h (tree_binding): new struct (BINDING_SCOPE, BINDING_VALUE): new macros (current_namespace, global_namespace): declare extern (struct lang_decl_flags): new field in_namespace (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros (DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros (TREE_INDIRECT_USING): new macro * decl2.c (current_namespace, global_namespace): Declare. The value is a NAMESPACE_DECL now, not a TREE_LIST. (is_namespace_ancestor, namespace_ancestor):new static functions. (add_using_namespace, ambiguous_decl): likewise. (lookup_using_namespace): new support function for lookup_name. (qualified_lookup_using_namespace): new support function for do_scoped_id and lookup_namespace_name (get_namespace_id): mark as obsolete. (current_namespace_id): Likewise. (do_namespace_alias): Implement. (do_using_directive): Implement as call to add_using_namespace. * decl.c (binding_for_name): new function. (push_namespace, pop_namespace): implement. (push_decl): don't install a FUNCTION_DECL in the global branch. (lookup_namespace_name): implement using qualified lookup. (lookup_name_real): For global scoping, lookup in global_namespace. For namespace scoping, lookup in given namespace. For unscoped lookup, iterate over namespace, considering using directives. (init_decl_processing): initialize global_namespace. (grokvardecl): Build assembler name as static name for globals. (grokdeclarator): Remove old namespace mangling. (xref_tag): When installing a global binding for the tag, make sure we have an identifier. * method.c (build_overload_nested_name): mangle namespaces. (build_qualified_name): Likewise. (build_decl_overload_real): Likewise. * lex.c (build_lang_decl): set namespace for new declaration to current_namespace. (do_scoped_id): find global names in global or current namespace, or using qualified namespace lookup, depending on context. * init.c (build_member_call): When scope is namespace, use build_x_function_call instead. (build_offset_ref): When scope is namespace, collapse processing to lookup_namespace_name instead. * error.c (dump_decl): Support NAMESPACE_DECL. * decl.c (pushdecl): Bind globals to current namespace. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (xref_tag): Likewise. (start_function): Likewise. * lex.c (do_identifier): Likewise. (identifier_typedecl_value): Likewise. (real_yylex): Likewise. * method.c (do_inline_function_hair): Likewise. * parse.y (unscoped): Likewise. * pt.c (check_explicit_specialization): Likewise. (lookup_template_class): Likewise. * rtti.c (call_void_fn): Likewise. * sig.c (build_sigtable): Likewise. * ptree.c (lang_print_xnode): New function. From-SVN: r18227
1998-02-25 01:49:51 +01:00
/* In a NAMESPACE_DECL, the list of namespaces which have associated
themselves with this one. */
#define DECL_NAMESPACE_ASSOCIATIONS(NODE) \
DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
/* In a NAMESPACE_DECL, points to the original namespace if this is
a namespace alias. */
#define DECL_NAMESPACE_ALIAS(NODE) \
DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE))
#define ORIGINAL_NAMESPACE(NODE) \
(DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
/* Nonzero if NODE is the std namespace. */
#define DECL_NAMESPACE_STD_P(NODE) \
(TREE_CODE (NODE) == NAMESPACE_DECL \
&& CP_DECL_CONTEXT (NODE) == global_namespace \
&& DECL_NAME (NODE) == std_identifier)
* Eliminate DECL_FIELD_SIZE. * builtins.c (built_in_class_names, built_in_names): New variables. * c-decl.c (finish_struct): Set specified size in DECL_SIZE. * expr.c (expand_expr, case COMPONENT_REF): Get field size from DECL_SIZE, not DECL_FIELD_SIZE. * print-tree.c (print_node): Remove code that prints extra blank lines in some cases. Properly handle inline and builtin function cases. * stor-layout.c (layout_decl): Get specified size from DEC_SIZE. * tree.h (built_in_class_named, built_in_names): New declarations. (union tree_decl): Rename internal unions to u1 and u2 and change some of their components. Add new field built_in_class. (DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE): Reflect above changes. (DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise. (DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted. * objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE. (encode_field_decl): Likewise; also remove obsolete test for bitfield. * ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name. * ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE. * ch/typeck.c (make_chill_struct_type): Likewise. (apply_decl_field_layout): General cleanup. Set DECL_SIZE instead of DECL_FIELD_SIZE. * cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear DECL_FIELD_SIZE. (check_bitfield_decl, check_field_decls): Set DECL_SIZE, not DECL_FIELD_SIZE. * cp/rtti.c (expand_class_desc): Likewise. * cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name. (THUNK_VCALL_OFFSET): Likewise. (THUNK_DELTA): Reflect changes in ../tree.h. * java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h. (DECL_BIT_INDEX): Use underlying representation. * java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise. From-SVN: r32249
2000-02-29 03:34:48 +01:00
/* In a TREE_LIST concatenating using directives, indicate indirect
Partial implementation of namespaces. * decl.c (push_namespace): Handle redeclaration error. * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. (IDENTIFIER_NAMESPACE_BINDINGS): New macro. (NAMESPACE_BINDING): New macro. (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. * *.c: Use them. * pt.c (push_template_decl): Use innermost_args. * decl.c (get_unique_name): Tweak from earlier in the name. * cp-tree.def: Add CPLUS_BINDING node. * cp-tree.h (tree_binding): new struct (BINDING_SCOPE, BINDING_VALUE): new macros (current_namespace, global_namespace): declare extern (struct lang_decl_flags): new field in_namespace (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros (DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros (TREE_INDIRECT_USING): new macro * decl2.c (current_namespace, global_namespace): Declare. The value is a NAMESPACE_DECL now, not a TREE_LIST. (is_namespace_ancestor, namespace_ancestor):new static functions. (add_using_namespace, ambiguous_decl): likewise. (lookup_using_namespace): new support function for lookup_name. (qualified_lookup_using_namespace): new support function for do_scoped_id and lookup_namespace_name (get_namespace_id): mark as obsolete. (current_namespace_id): Likewise. (do_namespace_alias): Implement. (do_using_directive): Implement as call to add_using_namespace. * decl.c (binding_for_name): new function. (push_namespace, pop_namespace): implement. (push_decl): don't install a FUNCTION_DECL in the global branch. (lookup_namespace_name): implement using qualified lookup. (lookup_name_real): For global scoping, lookup in global_namespace. For namespace scoping, lookup in given namespace. For unscoped lookup, iterate over namespace, considering using directives. (init_decl_processing): initialize global_namespace. (grokvardecl): Build assembler name as static name for globals. (grokdeclarator): Remove old namespace mangling. (xref_tag): When installing a global binding for the tag, make sure we have an identifier. * method.c (build_overload_nested_name): mangle namespaces. (build_qualified_name): Likewise. (build_decl_overload_real): Likewise. * lex.c (build_lang_decl): set namespace for new declaration to current_namespace. (do_scoped_id): find global names in global or current namespace, or using qualified namespace lookup, depending on context. * init.c (build_member_call): When scope is namespace, use build_x_function_call instead. (build_offset_ref): When scope is namespace, collapse processing to lookup_namespace_name instead. * error.c (dump_decl): Support NAMESPACE_DECL. * decl.c (pushdecl): Bind globals to current namespace. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (xref_tag): Likewise. (start_function): Likewise. * lex.c (do_identifier): Likewise. (identifier_typedecl_value): Likewise. (real_yylex): Likewise. * method.c (do_inline_function_hair): Likewise. * parse.y (unscoped): Likewise. * pt.c (check_explicit_specialization): Likewise. (lookup_template_class): Likewise. * rtti.c (call_void_fn): Likewise. * sig.c (build_sigtable): Likewise. * ptree.c (lang_print_xnode): New function. From-SVN: r18227
1998-02-25 01:49:51 +01:00
directives */
#define TREE_INDIRECT_USING(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
1994-02-24 02:02:37 +01:00
/* In a TREE_LIST in an attribute list, indicates that the attribute
must be applied at instantiation time. */
#define ATTR_IS_DEPENDENT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
/* In a TREE_LIST in the argument of attribute abi_tag, indicates that the tag
was inherited from a template parameter, not explicitly indicated. */
#define ABI_TAG_IMPLICIT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
Makefile.in (TREE_H): Add treestruct.def. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Makefile.in (TREE_H): Add treestruct.def. (c-decl.o): Add pointer-set.h * c-decl.c (diagnose_mismatched_decls): Don't attempt to look at visibility on regular DECL's. (merge_decls): Fix the copying of decl nodes of various types for the new structures. Don't update RTL, section name, weak status, etc, on DECL's without RTL. (grokdeclarator): DECL_ARG_TYPE_AS_WRITTEN is gone. Don't check volatile on non-variable types. (store_parm_decls_oldstyle): Use pointer_set instead of DECL_WEAK to check whether we have seen arguments. * c-objc-common.c (c_tree_printer): Reverse order of tests so that flag is checked before field (flag is common, field is not). * dwarf2out.c (decl_ultimate_origin): Only DECL's with TS_DECL_COMMON could have an origin. (add_location_or_const_value_attribute): Don't check section name on non-var/function decls. (dwarf2out_var_location): Reverse order of tests. * emit-rtl.c (set_reg_attrs_for_parm): DECL_CHECK is dead, replace with DECL_WRTL_CHECK. * expmed.c (make_tree): rtl is now in decl_with_rtl. * fold-const.c (fold_binary): Don't check weakness on non-var/function decls. (tree_expr_nonzero_p): Ditto. (fold_checksum_tree): Use tree_decl_extra as sizeof buffer. * ggc-page.c (extra_order_size_table): Add sizes for tree_decl_non_common, tree_parm_decl, tree_var_decl, and tree_field_decl. * gimplify.c (gimplify_bind_expr): Only set DECL_SEEN_IN_BIND_EXPR_P on VAR_DECL. * integrate.c (copy_decl_for_inlining): Don't set RTL on decl's without RTL. * langhooks-def.h (LANG_HOOK_INIT_TS): New. * langhooks.h (init_ts). New langhook. * passes.c (rest_of_decl_compilation): Reverse order of tests. * print-tree.c (print_node): Update to only print fields that exist in the structures the passed decl has. * toplev.c (wrapup_global_declarations): Don't reset DECL_DEFER_OUTPUT on DECL's that don't contain it. * tree-browser.c (browse_tree): DECL_ARG_TYPE_AS_WRITTEN removed. * tree-inline.c (remap_decl): Ditto. * tree-outof-ssa.c (create_temp): Reverse order of tests. * tree-pretty-print.c (print_declaration): Don't print DECL_REGISTER on things that don't contain it. * tree-vrp.c (expr_computes_nonzero): Don't check weakness on non-var/function decls. * tree.c (tree_contains_struct): New structure. (init_priority_for_decl): New hashtable. (tree_int_map): New structure. (tree_int_map_eq): New function. (tree_int_map_marked_p): Ditto. (tree_int_map_hash): Ditto. (tree_map): Move to tree.h. (tree_map_eq): Externalize. (tree_map_hash): Ditto. (tree_map_marked_p): Ditto. (init_ttree): Set up tree_contains_struct and call langhook. (decl_assembler_name): Use DECL_NON_COMMON_CHECK.. (tree_code_size): Update for new structures. (tree_node_structure): Update for new structures. (make_node_stat): Don't try to set DECL_IN_SYSTEM_HEADER on decls without the field. (copy_node_stat): Copy init priority. (build_decl_stat): Ditto for visibility. (ts_enum_names): New. (tree_contains_struct_check_failed): New function. (decl_init_priority_lookup): Ditto. (decl_init_priority_insert): Ditto. * treestruct.def: New file. * tree.h (CODE_CONTAINS_STRUCT): New macro. (CONTAINS_STRUCT_CHECK): Ditto. (tree_contains_struct_check_failed): New prototype. (DECL_CHECK): Removed. (DECL_MINIMAL_CHECK): New. (DECL_COMMON_CHECK): Ditto. (DECL_WRTL_CHECK): Ditto. (DECL_NON_COMMON_CHECK): Ditto. (DECL_WITH_VIS_CHECK): Ditto. (VAR_OR_FUNCTION_DECL_P): Ditto (struct tree_decl_minimal): New structure. (struct tree_decl_common): Ditto. (struct tree_decl_with_rtl): Ditto. (struct tree_decl_with_vis): Ditto. (struct tree_decl_non_common): Ditto. (struct tree_field_decl): Ditto. (struct tree_parm_decl): Ditto. (struct tree_var_decl): Ditto. (struct tree_function_decl): Ditto. (struct tree_const_decl): Ditto. (struct tree_result_decl): Ditto. (union tree_node): Add new structures. * var-tracking.c (track_expr_p): Reverse order of tests. * doc/c-tree.texi: Add documentation on DECL node internal structure. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * utils.c (create_param_decl): DECL_ARG_TYPE_AS_WRITTEN is removed. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Make-lang.in: Add gt-cp-lang.h. (cp-lang.o): Ditto. * class.c (create_vtable_ptr): Stop setting DECL_ASSEMBLER_NAME on the field. * config-lang.in: Add cp-lang.c to gtfiles. * cp-lang.c: Include hashtab.h. (cp_init_ts): New function. (LANG_HOOK_INIT_TS): Use macro. (decl_shadowed_for_var_lookup): New function. (decl_shadowed_for_var_insert): Ditto. * cp-tree.h (THUNK_FUNCTION_CHECK): Use decl_common. (NON_THUNK_FUNCTION_CHECK): Ditto. (DECL_NAMESPACE_ASSOCIATIONS): Use decl_non_common. (DECL_INIT_PRIORITY): Ditto. (DECL_HAS_SHADOWED_FOR_VAR_P): Ditto. (DECL_SHADOWED_FOR_VAR): Use hashtable. (SET_DECL_SHADOWED_FOR_VAR): Ditto. * decl.c (duplicate_decls): Update for new/updated structures. (poplevel): Use SET_DECL_SHADOWED_FOR_VAR. * decl2.c (start_static_initialization_or_destruction): Deal with priority. * pt.c (tsubst_decl): Check TS_DECL_WRTL before doing SET_DECL_RTL. * tree.c (handle_init_priority_attribute): Handle priority. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * objc-act.c (objc_push_parm): DECL_ARG_TYPE_AS_WRITTEN is removed. * objc-act.h (KEYWORD_ARG_NAME): Use decl_non_common. (KEYWORD_KEY_NAME): Use decl_minimal. (METHOD_SEL_NAME): Ditto.. (METHOD_SEL_ARGS): Use decl_non_common. (METHOD_ADD_ARGS): Ditto. (METHOD_ADD_ARGS_ELLIPSIS_P): Use decl_common. (METHOD_DEFINITION): Ditto. (METHOD_ENCODING): Ditto. * objc-lang.c: (objc_init_ts): New function. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * trans-decl.c (create_function_arglist): DECL_ARG_TYPE_AS_WRITTEN is removed. From-SVN: r101799
2005-07-09 01:37:11 +02:00
extern tree decl_shadowed_for_var_lookup (tree);
extern void decl_shadowed_for_var_insert (tree, tree);
/* Non zero if this is a using decl for a dependent scope. */
#define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE))
/* The scope named in a using decl. */
#define USING_DECL_SCOPE(NODE) TREE_TYPE (USING_DECL_CHECK (NODE))
/* The decls named by a using decl. */
#define USING_DECL_DECLS(NODE) DECL_INITIAL (USING_DECL_CHECK (NODE))
/* Non zero if the using decl refers to a dependent type. */
#define USING_DECL_TYPENAME_P(NODE) DECL_LANG_FLAG_1 (USING_DECL_CHECK (NODE))
Makefile.in (TREE_H): Add treestruct.def. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Makefile.in (TREE_H): Add treestruct.def. (c-decl.o): Add pointer-set.h * c-decl.c (diagnose_mismatched_decls): Don't attempt to look at visibility on regular DECL's. (merge_decls): Fix the copying of decl nodes of various types for the new structures. Don't update RTL, section name, weak status, etc, on DECL's without RTL. (grokdeclarator): DECL_ARG_TYPE_AS_WRITTEN is gone. Don't check volatile on non-variable types. (store_parm_decls_oldstyle): Use pointer_set instead of DECL_WEAK to check whether we have seen arguments. * c-objc-common.c (c_tree_printer): Reverse order of tests so that flag is checked before field (flag is common, field is not). * dwarf2out.c (decl_ultimate_origin): Only DECL's with TS_DECL_COMMON could have an origin. (add_location_or_const_value_attribute): Don't check section name on non-var/function decls. (dwarf2out_var_location): Reverse order of tests. * emit-rtl.c (set_reg_attrs_for_parm): DECL_CHECK is dead, replace with DECL_WRTL_CHECK. * expmed.c (make_tree): rtl is now in decl_with_rtl. * fold-const.c (fold_binary): Don't check weakness on non-var/function decls. (tree_expr_nonzero_p): Ditto. (fold_checksum_tree): Use tree_decl_extra as sizeof buffer. * ggc-page.c (extra_order_size_table): Add sizes for tree_decl_non_common, tree_parm_decl, tree_var_decl, and tree_field_decl. * gimplify.c (gimplify_bind_expr): Only set DECL_SEEN_IN_BIND_EXPR_P on VAR_DECL. * integrate.c (copy_decl_for_inlining): Don't set RTL on decl's without RTL. * langhooks-def.h (LANG_HOOK_INIT_TS): New. * langhooks.h (init_ts). New langhook. * passes.c (rest_of_decl_compilation): Reverse order of tests. * print-tree.c (print_node): Update to only print fields that exist in the structures the passed decl has. * toplev.c (wrapup_global_declarations): Don't reset DECL_DEFER_OUTPUT on DECL's that don't contain it. * tree-browser.c (browse_tree): DECL_ARG_TYPE_AS_WRITTEN removed. * tree-inline.c (remap_decl): Ditto. * tree-outof-ssa.c (create_temp): Reverse order of tests. * tree-pretty-print.c (print_declaration): Don't print DECL_REGISTER on things that don't contain it. * tree-vrp.c (expr_computes_nonzero): Don't check weakness on non-var/function decls. * tree.c (tree_contains_struct): New structure. (init_priority_for_decl): New hashtable. (tree_int_map): New structure. (tree_int_map_eq): New function. (tree_int_map_marked_p): Ditto. (tree_int_map_hash): Ditto. (tree_map): Move to tree.h. (tree_map_eq): Externalize. (tree_map_hash): Ditto. (tree_map_marked_p): Ditto. (init_ttree): Set up tree_contains_struct and call langhook. (decl_assembler_name): Use DECL_NON_COMMON_CHECK.. (tree_code_size): Update for new structures. (tree_node_structure): Update for new structures. (make_node_stat): Don't try to set DECL_IN_SYSTEM_HEADER on decls without the field. (copy_node_stat): Copy init priority. (build_decl_stat): Ditto for visibility. (ts_enum_names): New. (tree_contains_struct_check_failed): New function. (decl_init_priority_lookup): Ditto. (decl_init_priority_insert): Ditto. * treestruct.def: New file. * tree.h (CODE_CONTAINS_STRUCT): New macro. (CONTAINS_STRUCT_CHECK): Ditto. (tree_contains_struct_check_failed): New prototype. (DECL_CHECK): Removed. (DECL_MINIMAL_CHECK): New. (DECL_COMMON_CHECK): Ditto. (DECL_WRTL_CHECK): Ditto. (DECL_NON_COMMON_CHECK): Ditto. (DECL_WITH_VIS_CHECK): Ditto. (VAR_OR_FUNCTION_DECL_P): Ditto (struct tree_decl_minimal): New structure. (struct tree_decl_common): Ditto. (struct tree_decl_with_rtl): Ditto. (struct tree_decl_with_vis): Ditto. (struct tree_decl_non_common): Ditto. (struct tree_field_decl): Ditto. (struct tree_parm_decl): Ditto. (struct tree_var_decl): Ditto. (struct tree_function_decl): Ditto. (struct tree_const_decl): Ditto. (struct tree_result_decl): Ditto. (union tree_node): Add new structures. * var-tracking.c (track_expr_p): Reverse order of tests. * doc/c-tree.texi: Add documentation on DECL node internal structure. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * utils.c (create_param_decl): DECL_ARG_TYPE_AS_WRITTEN is removed. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Make-lang.in: Add gt-cp-lang.h. (cp-lang.o): Ditto. * class.c (create_vtable_ptr): Stop setting DECL_ASSEMBLER_NAME on the field. * config-lang.in: Add cp-lang.c to gtfiles. * cp-lang.c: Include hashtab.h. (cp_init_ts): New function. (LANG_HOOK_INIT_TS): Use macro. (decl_shadowed_for_var_lookup): New function. (decl_shadowed_for_var_insert): Ditto. * cp-tree.h (THUNK_FUNCTION_CHECK): Use decl_common. (NON_THUNK_FUNCTION_CHECK): Ditto. (DECL_NAMESPACE_ASSOCIATIONS): Use decl_non_common. (DECL_INIT_PRIORITY): Ditto. (DECL_HAS_SHADOWED_FOR_VAR_P): Ditto. (DECL_SHADOWED_FOR_VAR): Use hashtable. (SET_DECL_SHADOWED_FOR_VAR): Ditto. * decl.c (duplicate_decls): Update for new/updated structures. (poplevel): Use SET_DECL_SHADOWED_FOR_VAR. * decl2.c (start_static_initialization_or_destruction): Deal with priority. * pt.c (tsubst_decl): Check TS_DECL_WRTL before doing SET_DECL_RTL. * tree.c (handle_init_priority_attribute): Handle priority. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * objc-act.c (objc_push_parm): DECL_ARG_TYPE_AS_WRITTEN is removed. * objc-act.h (KEYWORD_ARG_NAME): Use decl_non_common. (KEYWORD_KEY_NAME): Use decl_minimal. (METHOD_SEL_NAME): Ditto.. (METHOD_SEL_ARGS): Use decl_non_common. (METHOD_ADD_ARGS): Ditto. (METHOD_ADD_ARGS_ELLIPSIS_P): Use decl_common. (METHOD_DEFINITION): Ditto. (METHOD_ENCODING): Ditto. * objc-lang.c: (objc_init_ts): New function. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * trans-decl.c (create_function_arglist): DECL_ARG_TYPE_AS_WRITTEN is removed. From-SVN: r101799
2005-07-09 01:37:11 +02:00
/* In a VAR_DECL, true if we have a shadowed local variable
in the shadowed var table for this VAR_DECL. */
#define DECL_HAS_SHADOWED_FOR_VAR_P(NODE) \
(VAR_DECL_CHECK (NODE)->decl_with_vis.shadowed_for_var_p)
/* In a VAR_DECL for a variable declared in a for statement,
1996-07-11 03:13:25 +02:00
this is the shadowed (local) variable. */
Makefile.in (TREE_H): Add treestruct.def. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Makefile.in (TREE_H): Add treestruct.def. (c-decl.o): Add pointer-set.h * c-decl.c (diagnose_mismatched_decls): Don't attempt to look at visibility on regular DECL's. (merge_decls): Fix the copying of decl nodes of various types for the new structures. Don't update RTL, section name, weak status, etc, on DECL's without RTL. (grokdeclarator): DECL_ARG_TYPE_AS_WRITTEN is gone. Don't check volatile on non-variable types. (store_parm_decls_oldstyle): Use pointer_set instead of DECL_WEAK to check whether we have seen arguments. * c-objc-common.c (c_tree_printer): Reverse order of tests so that flag is checked before field (flag is common, field is not). * dwarf2out.c (decl_ultimate_origin): Only DECL's with TS_DECL_COMMON could have an origin. (add_location_or_const_value_attribute): Don't check section name on non-var/function decls. (dwarf2out_var_location): Reverse order of tests. * emit-rtl.c (set_reg_attrs_for_parm): DECL_CHECK is dead, replace with DECL_WRTL_CHECK. * expmed.c (make_tree): rtl is now in decl_with_rtl. * fold-const.c (fold_binary): Don't check weakness on non-var/function decls. (tree_expr_nonzero_p): Ditto. (fold_checksum_tree): Use tree_decl_extra as sizeof buffer. * ggc-page.c (extra_order_size_table): Add sizes for tree_decl_non_common, tree_parm_decl, tree_var_decl, and tree_field_decl. * gimplify.c (gimplify_bind_expr): Only set DECL_SEEN_IN_BIND_EXPR_P on VAR_DECL. * integrate.c (copy_decl_for_inlining): Don't set RTL on decl's without RTL. * langhooks-def.h (LANG_HOOK_INIT_TS): New. * langhooks.h (init_ts). New langhook. * passes.c (rest_of_decl_compilation): Reverse order of tests. * print-tree.c (print_node): Update to only print fields that exist in the structures the passed decl has. * toplev.c (wrapup_global_declarations): Don't reset DECL_DEFER_OUTPUT on DECL's that don't contain it. * tree-browser.c (browse_tree): DECL_ARG_TYPE_AS_WRITTEN removed. * tree-inline.c (remap_decl): Ditto. * tree-outof-ssa.c (create_temp): Reverse order of tests. * tree-pretty-print.c (print_declaration): Don't print DECL_REGISTER on things that don't contain it. * tree-vrp.c (expr_computes_nonzero): Don't check weakness on non-var/function decls. * tree.c (tree_contains_struct): New structure. (init_priority_for_decl): New hashtable. (tree_int_map): New structure. (tree_int_map_eq): New function. (tree_int_map_marked_p): Ditto. (tree_int_map_hash): Ditto. (tree_map): Move to tree.h. (tree_map_eq): Externalize. (tree_map_hash): Ditto. (tree_map_marked_p): Ditto. (init_ttree): Set up tree_contains_struct and call langhook. (decl_assembler_name): Use DECL_NON_COMMON_CHECK.. (tree_code_size): Update for new structures. (tree_node_structure): Update for new structures. (make_node_stat): Don't try to set DECL_IN_SYSTEM_HEADER on decls without the field. (copy_node_stat): Copy init priority. (build_decl_stat): Ditto for visibility. (ts_enum_names): New. (tree_contains_struct_check_failed): New function. (decl_init_priority_lookup): Ditto. (decl_init_priority_insert): Ditto. * treestruct.def: New file. * tree.h (CODE_CONTAINS_STRUCT): New macro. (CONTAINS_STRUCT_CHECK): Ditto. (tree_contains_struct_check_failed): New prototype. (DECL_CHECK): Removed. (DECL_MINIMAL_CHECK): New. (DECL_COMMON_CHECK): Ditto. (DECL_WRTL_CHECK): Ditto. (DECL_NON_COMMON_CHECK): Ditto. (DECL_WITH_VIS_CHECK): Ditto. (VAR_OR_FUNCTION_DECL_P): Ditto (struct tree_decl_minimal): New structure. (struct tree_decl_common): Ditto. (struct tree_decl_with_rtl): Ditto. (struct tree_decl_with_vis): Ditto. (struct tree_decl_non_common): Ditto. (struct tree_field_decl): Ditto. (struct tree_parm_decl): Ditto. (struct tree_var_decl): Ditto. (struct tree_function_decl): Ditto. (struct tree_const_decl): Ditto. (struct tree_result_decl): Ditto. (union tree_node): Add new structures. * var-tracking.c (track_expr_p): Reverse order of tests. * doc/c-tree.texi: Add documentation on DECL node internal structure. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * utils.c (create_param_decl): DECL_ARG_TYPE_AS_WRITTEN is removed. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Make-lang.in: Add gt-cp-lang.h. (cp-lang.o): Ditto. * class.c (create_vtable_ptr): Stop setting DECL_ASSEMBLER_NAME on the field. * config-lang.in: Add cp-lang.c to gtfiles. * cp-lang.c: Include hashtab.h. (cp_init_ts): New function. (LANG_HOOK_INIT_TS): Use macro. (decl_shadowed_for_var_lookup): New function. (decl_shadowed_for_var_insert): Ditto. * cp-tree.h (THUNK_FUNCTION_CHECK): Use decl_common. (NON_THUNK_FUNCTION_CHECK): Ditto. (DECL_NAMESPACE_ASSOCIATIONS): Use decl_non_common. (DECL_INIT_PRIORITY): Ditto. (DECL_HAS_SHADOWED_FOR_VAR_P): Ditto. (DECL_SHADOWED_FOR_VAR): Use hashtable. (SET_DECL_SHADOWED_FOR_VAR): Ditto. * decl.c (duplicate_decls): Update for new/updated structures. (poplevel): Use SET_DECL_SHADOWED_FOR_VAR. * decl2.c (start_static_initialization_or_destruction): Deal with priority. * pt.c (tsubst_decl): Check TS_DECL_WRTL before doing SET_DECL_RTL. * tree.c (handle_init_priority_attribute): Handle priority. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * objc-act.c (objc_push_parm): DECL_ARG_TYPE_AS_WRITTEN is removed. * objc-act.h (KEYWORD_ARG_NAME): Use decl_non_common. (KEYWORD_KEY_NAME): Use decl_minimal. (METHOD_SEL_NAME): Ditto.. (METHOD_SEL_ARGS): Use decl_non_common. (METHOD_ADD_ARGS): Ditto. (METHOD_ADD_ARGS_ELLIPSIS_P): Use decl_common. (METHOD_DEFINITION): Ditto. (METHOD_ENCODING): Ditto. * objc-lang.c: (objc_init_ts): New function. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * trans-decl.c (create_function_arglist): DECL_ARG_TYPE_AS_WRITTEN is removed. From-SVN: r101799
2005-07-09 01:37:11 +02:00
#define DECL_SHADOWED_FOR_VAR(NODE) \
(DECL_HAS_SHADOWED_FOR_VAR_P(NODE) ? decl_shadowed_for_var_lookup (NODE) : NULL)
#define SET_DECL_SHADOWED_FOR_VAR(NODE, VAL) \
(decl_shadowed_for_var_insert (NODE, VAL))
/* In a FUNCTION_DECL, this is nonzero if this function was defined in
the class definition. We have saved away the text of the function,
but have not yet processed it. */
#define DECL_PENDING_INLINE_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->pending_inline_p)
/* If DECL_PENDING_INLINE_P holds, this is the saved text of the
function. */
#define DECL_PENDING_INLINE_INFO(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->u.pending_inline_info)
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
/* Nonzero for TYPE_DECL means that it was written 'using name = type'. */
#define TYPE_DECL_ALIAS_P(NODE) \
DECL_LANG_FLAG_6 (TYPE_DECL_CHECK (NODE))
/* Nonzero for TEMPLATE_DECL means that it is a 'complex' alias template. */
#define TEMPLATE_DECL_COMPLEX_ALIAS_P(NODE) \
DECL_LANG_FLAG_2 (TEMPLATE_DECL_CHECK (NODE))
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
/* Nonzero for a type which is an alias for another type; i.e, a type
which declaration was written 'using name-of-type =
another-type'. */
#define TYPE_ALIAS_P(NODE) \
(TYPE_P (NODE) \
&& TYPE_NAME (NODE) \
&& TREE_CODE (TYPE_NAME (NODE)) == TYPE_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
&& TYPE_DECL_ALIAS_P (TYPE_NAME (NODE)))
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
/* For a class type: if this structure has many fields, we'll sort them
and put them into a TREE_VEC. */
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
#define CLASSTYPE_SORTED_FIELDS(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->sorted_fields)
1994-02-24 02:02:37 +01:00
/* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or
TEMPLATE_DECL, the entity is either a template specialization (if
DECL_USE_TEMPLATE is nonzero) or the abstract instance of the
template itself.
In either case, DECL_TEMPLATE_INFO is a TREE_LIST, whose
TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a
specialization or abstract instance. The TREE_VALUE is the
template arguments used to specialize the template.
Consider:
template <typename T> struct S { friend void f(T) {} };
In this case, S<int>::f is, from the point of view of the compiler,
an instantiation of a template -- but, from the point of view of
the language, each instantiation of S results in a wholly unrelated
global function f. In this case, DECL_TEMPLATE_INFO for S<int>::f
will be non-NULL, but DECL_USE_TEMPLATE will be zero. */
#define DECL_TEMPLATE_INFO(NODE) \
(DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK (NODE)) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
->u.min.template_info)
/* For a VAR_DECL, indicates that the variable is actually a
non-static data member of anonymous union that has been promoted to
variable status. */
#define DECL_ANON_UNION_VAR_P(NODE) \
(DECL_LANG_FLAG_4 (VAR_DECL_CHECK (NODE)))
/* Template information for a RECORD_TYPE or UNION_TYPE. */
#define CLASSTYPE_TEMPLATE_INFO(NODE) \
c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * dwarf2out.c (add_data_member_location_attribute): Check for TREE_BINFO. * tree.c (tree_node_kinds): Add "binfos". (binfo_lang_slots): New. (make_node_stat): Add TREE_BINFO. (make_tree_binfo_stat): New. (tree_node_structure): Add TREE_BINFO. * tree.def (TREE_BINFO): New. * tree.h (REC_OR_UNION_CHECK): Rename to ... (RECORD_OR_UNION_CHECK): ... here. (NOT_RECORD_OR_UNION_CHECK): New. (TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO. (TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for RECORD_OR_UNION_CHECK. (TYPE_BINFO): Use RECORD_OR_UNION_CHECK. (TYPE_LANG_SLOT_1): New. (BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS, BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD, BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust. (BINFO_ELTS): Remove. (BINFO_LANG_SLOT): New. (struct tree_binfo): New. (binfo_lang_slots): Declare. (enum tree_node_structure_enum): Add TS_BINFO. (union tree_node): Add binfo. (make_tree_binfo_stat): Declare. (make_tree_binfo): New. (enum tree_node_kind): Add binfo_kind. * cp/call.c (enforce_access): Expect TREE_BINFO. * cp/class.c (binfo_ctor_vtable): Check TREE_BINFO. * cp/cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Adjust. (BINFO_LANG_ELTS): Remove. (BINFO_LANG_SLOTS): New. (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (CLASSTYPE_TEMPLATE_INFO): Adjust. * cp/pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case. * cp/search.c (lookup_member): Check TREE_BINFO. * cp/semantics.c (perform_or_defer_access_check): Likewise. (check_accessibility_of_qualified_id): Check deferred_access_no_check. * cp/tree.c (make_binfo): Use make_tree_binfo. * java/class.c (make_class): Use make_tree_binfo. (set_super_info, add_interface_do): Likewise. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO. * objc/objc-act.c (start_class, objc_declare_protocols, start_protocols): Use TYPE_LANG_SLOT_1. * objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename to ... (CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here. (CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE, CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS, PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1. From-SVN: r84110
2004-07-05 11:35:44 +02:00
(LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_CHECK (NODE))->template_info)
/* Template information for an ENUMERAL_TYPE. Although an enumeration may
not be a primary template, it may be declared within the scope of a
primary template and the enumeration constants may depend on
non-type template parameters. */
c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * dwarf2out.c (add_data_member_location_attribute): Check for TREE_BINFO. * tree.c (tree_node_kinds): Add "binfos". (binfo_lang_slots): New. (make_node_stat): Add TREE_BINFO. (make_tree_binfo_stat): New. (tree_node_structure): Add TREE_BINFO. * tree.def (TREE_BINFO): New. * tree.h (REC_OR_UNION_CHECK): Rename to ... (RECORD_OR_UNION_CHECK): ... here. (NOT_RECORD_OR_UNION_CHECK): New. (TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO. (TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for RECORD_OR_UNION_CHECK. (TYPE_BINFO): Use RECORD_OR_UNION_CHECK. (TYPE_LANG_SLOT_1): New. (BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS, BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD, BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust. (BINFO_ELTS): Remove. (BINFO_LANG_SLOT): New. (struct tree_binfo): New. (binfo_lang_slots): Declare. (enum tree_node_structure_enum): Add TS_BINFO. (union tree_node): Add binfo. (make_tree_binfo_stat): Declare. (make_tree_binfo): New. (enum tree_node_kind): Add binfo_kind. * cp/call.c (enforce_access): Expect TREE_BINFO. * cp/class.c (binfo_ctor_vtable): Check TREE_BINFO. * cp/cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Adjust. (BINFO_LANG_ELTS): Remove. (BINFO_LANG_SLOTS): New. (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (CLASSTYPE_TEMPLATE_INFO): Adjust. * cp/pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case. * cp/search.c (lookup_member): Check TREE_BINFO. * cp/semantics.c (perform_or_defer_access_check): Likewise. (check_accessibility_of_qualified_id): Check deferred_access_no_check. * cp/tree.c (make_binfo): Use make_tree_binfo. * java/class.c (make_class): Use make_tree_binfo. (set_super_info, add_interface_do): Likewise. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO. * objc/objc-act.c (start_class, objc_declare_protocols, start_protocols): Use TYPE_LANG_SLOT_1. * objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename to ... (CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here. (CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE, CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS, PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1. From-SVN: r84110
2004-07-05 11:35:44 +02:00
#define ENUM_TEMPLATE_INFO(NODE) \
(TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE)))
/* Template information for a template template parameter. */
#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
(LANG_TYPE_CLASS_CHECK (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \
->template_info)
cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. (TYPE_BINFO): Likewise. (IS_AGGR_TYPE): Tweak. (SET_IS_AGGR_TYPE): New macro. (CLASS_TYPE_P): Tweak. (lang_type): Group mark bitfields together. Remove linenum. (CLASSTYPE_SOURCE_LINE): Remove macro. (CLASSTYPE_MARKED_N): New macro. (SET_CLASSTYPE_MARKED_N): Likewise. (CLEAR_CLASSTYPE_MARKED_N): Likewise. (CLASS_TYPE_MARKED_*): Use them. (SET_CLASSTYPE_MARKED_*): Likewise. (CLEAR_CLASSTYPE_MARKED_*): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well. (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE. * class.c (class_cache_obstack): New variable. (class_cache_firstobj): Likewise. (finish_struct): Don't set CLASSTYPE_SOURCE_LINE. (pushclass): Free the cache, when appropriate. (popclass): Tidy. (maybe_push_cache_obstack): Use class_cache_obstack. * decl.c (include hash.h). (typename_hash): New function. (typename_compare): Likewise. (build_typename_type): Check the hash table to avoid creating duplicates. (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE. (grokdeclarator): Use CLASS_TYPE_P. (xref_basetypes): Likewise. (start_function): Likewise. Don't put current_class_ref on the permanent obstack. * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO and TYPE_TI_ARGS. * lex.c (note_got_semicolon): Use CLASS_TYPE_P. (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated fields for types other than class types. Do clear TYPE_ALIAS_SET for types other than class types, though. * method.c (build_overload_identifier): Use CLASS_TYPE_P and TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * pt.c (process_template_parm): Don't set CLASSTYPE_GOT_SEMICOLON. (lookup_template_class) Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. Coerce arguments on the momentary obstack. (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (instantiate_class_template): Calculate template arguments on the momentary obstack. Tidy. (tsubst_template_arg_vector): Use make_temp_vec. (tsubst_aggr_type): Put template arguments on the momentary obstack. (tsubst_decl): Likewise. (tsubst): Copy the array bounds index to the permanent obstack before building index types. Use new macros. (unify): Use new macros. (do_type_instantiation): Likewise. * search.c (lookup_fnfields_1): Use new macros. (dfs_pushdecls): Build envelopes on the cache obstack. (dfs_compress_decls): Use new macros. (push_class_decls): Build on the cache obstack. * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON. * sign.c (build_signature_pointer_or_reference_type): Use SET_IS_AGGR_TYPE. * tree.c (make_binfo): Check CLASS_TYPE_P. (copy_template_template_parm): Adjust. (make_temp_vec): Use push_expresion_obstack. * typeck.c (complete_type): Use new macros. (comptypes): Likewise. From-SVN: r23686
1998-11-17 13:51:20 +01:00
/* Template information for an ENUMERAL_, RECORD_, UNION_TYPE, or
BOUND_TEMPLATE_TEMPLATE_PARM type. This ignores any alias
templateness of NODE. */
#define TYPE_TEMPLATE_INFO(NODE) \
(TREE_CODE (NODE) == ENUMERAL_TYPE \
? ENUM_TEMPLATE_INFO (NODE) \
: (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \
? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) \
: (CLASS_TYPE_P (NODE) \
? CLASSTYPE_TEMPLATE_INFO (NODE) \
: NULL_TREE)))
/* Template information (if any) for an alias type. */
#define TYPE_ALIAS_TEMPLATE_INFO(NODE) \
(DECL_LANG_SPECIFIC (TYPE_NAME (NODE)) \
? DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) \
: NULL_TREE)
/* If NODE is a type alias, this accessor returns the template info
for the alias template (if any). Otherwise behave as
TYPE_TEMPLATE_INFO. */
#define TYPE_TEMPLATE_INFO_MAYBE_ALIAS(NODE) \
(TYPE_ALIAS_P (NODE) \
? TYPE_ALIAS_TEMPLATE_INFO (NODE) \
: TYPE_TEMPLATE_INFO (NODE))
/* Set the template information for an ENUMERAL_, RECORD_, or
UNION_TYPE to VAL. */
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
#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
(TREE_CODE (NODE) == ENUMERAL_TYPE \
? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \
: ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE)) \
? (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)) \
: (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL))))
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01:00
#define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE))
#define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE))
#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
/* For a given TREE_VEC containing a template argument list,
this property contains the number of arguments that are not
defaulted. */
#define NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) TREE_CHAIN (TREE_VEC_CHECK (NODE))
/* Below are the setter and getter of the NON_DEFAULT_TEMPLATE_ARGS_COUNT
property. */
#define SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE, INT_VALUE) \
NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) = build_int_cst (NULL_TREE, INT_VALUE)
#if CHECKING_P
#define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \
int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE))
#else
#define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \
NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE) \
? int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE)) \
: TREE_VEC_LENGTH (INNERMOST_TEMPLATE_ARGS (NODE))
#endif
/* The list of typedefs - used in the template - that need
2013-06-06 19:57:44 +02:00
access checking at template instantiation time.
FIXME this should be associated with the TEMPLATE_DECL, not the
TEMPLATE_INFO. */
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01:00
#define TI_TYPEDEFS_NEEDING_ACCESS_CHECKING(NODE) \
((struct tree_template_info*)TEMPLATE_INFO_CHECK \
(NODE))->typedefs_needing_access_checking
/* We use TREE_VECs to hold template arguments. If there is only one
level of template arguments, then the TREE_VEC contains the
arguments directly. If there is more than one level of template
arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
containing the template arguments for a single level. The first
entry in the outer TREE_VEC is the outermost level of template
parameters; the last is the innermost.
It is incorrect to ever form a template argument vector containing
only one level of arguments, but which is a TREE_VEC containing as
its only entry the TREE_VEC for that level.
For each TREE_VEC containing the template arguments for a single
level, it's possible to get or set the number of non defaulted
template arguments by using the accessor macros
GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT or
SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT. */
/* Nonzero if the template arguments is actually a vector of vectors,
rather than just a vector. */
#define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
(NODE && TREE_VEC_LENGTH (NODE) && TREE_VEC_ELT (NODE, 0) \
&& TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
/* The depth of a template argument vector. When called directly by
the parser, we use a TREE_LIST rather than a TREE_VEC to represent
template arguments. In fact, we may even see NULL_TREE if there
are no template arguments. In both of those cases, there is only
one level of template arguments. */
#define TMPL_ARGS_DEPTH(NODE) \
(TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
/* The LEVELth level of the template ARGS. The outermost level of
args is level 1, not level 0. */
#define TMPL_ARGS_LEVEL(ARGS, LEVEL) \
(TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS))
/* Set the LEVELth level of the template ARGS to VAL. This macro does
not work with single-level argument vectors. */
#define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL))
/* Accesses the IDXth parameter in the LEVELth level of the ARGS. */
#define TMPL_ARG(ARGS, LEVEL, IDX) \
(TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
/* Given a single level of template arguments in NODE, return the
number of arguments. */
#define NUM_TMPL_ARGS(NODE) \
(TREE_VEC_LENGTH (NODE))
/* Returns the innermost level of template arguments in ARGS. */
#define INNERMOST_TEMPLATE_ARGS(NODE) \
(get_innermost_template_args ((NODE), 1))
/* The number of levels of template parameters given by NODE. */
#define TMPL_PARMS_DEPTH(NODE) \
((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE)))
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
/* The TEMPLATE_DECL instantiated or specialized by NODE. This
TEMPLATE_DECL will be the immediate parent, not the most general
template. For example, in:
template <class T> struct S { template <class U> void f(U); }
the FUNCTION_DECL for S<int>::f<double> will have, as its
DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
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
As a special case, for a member friend template of a template
class, this value will not be a TEMPLATE_DECL, but rather an
IDENTIFIER_NODE or OVERLOAD indicating the name of the template and
any explicit template arguments provided. For example, in:
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
template <class T> struct S { friend void f<int>(int, double); }
the DECL_TI_TEMPLATE will be an IDENTIFIER_NODE for `f' and the
DECL_TI_ARGS will be {int}.
For a FIELD_DECL with a non-static data member initializer, this value
is the FIELD_DECL it was instantiated from. */
#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
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
/* The template arguments used to obtain this decl from the most
general form of DECL_TI_TEMPLATE. For the example given for
DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These
are always the full set of arguments required to instantiate this
declaration from the most general template specialized here. */
#define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
/* The TEMPLATE_DECL associated with NODE, a class type. Even if NODE
will be generated from a partial specialization, the TEMPLATE_DECL
referred to here will be the original template. For example,
given:
template <typename T> struct S {};
template <typename T> struct S<T*> {};
the CLASSTPYE_TI_TEMPLATE for S<int*> will be S, not the S<T*>. */
#define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
#define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
/* For a template instantiation TYPE, returns the TYPE corresponding
to the primary template. Otherwise returns TYPE itself. */
#define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \
((CLASSTYPE_USE_TEMPLATE ((TYPE)) \
&& !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE))) \
? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \
(CLASSTYPE_TI_TEMPLATE ((TYPE))))) \
: (TYPE))
/* Like CLASS_TI_TEMPLATE, but also works for ENUMERAL_TYPEs. */
#define TYPE_TI_TEMPLATE(NODE) \
(TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
/* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
#define TYPE_TI_ARGS(NODE) \
(TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE (NODE)
/* Nonzero if NODE (a TEMPLATE_DECL) is a member template, in the
sense of [temp.mem]. */
#define DECL_MEMBER_TEMPLATE_P(NODE) \
(DECL_LANG_FLAG_1 (TEMPLATE_DECL_CHECK (NODE)))
/* Nonzero if the NODE corresponds to the template parameters for a
member template, whose inline definition is being processed after
the class definition is complete. */
#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
/* Determine if a declaration (PARM_DECL or FIELD_DECL) is a pack. */
#define DECL_PACK_P(NODE) \
(DECL_P (NODE) && PACK_EXPANSION_P (TREE_TYPE (NODE)))
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
/* Determines if NODE is an expansion of one or more parameter packs,
e.g., a TYPE_PACK_EXPANSION or EXPR_PACK_EXPANSION. */
#define PACK_EXPANSION_P(NODE) \
(TREE_CODE (NODE) == TYPE_PACK_EXPANSION \
|| TREE_CODE (NODE) == EXPR_PACK_EXPANSION)
/* Extracts the type or expression pattern from a TYPE_PACK_EXPANSION or
EXPR_PACK_EXPANSION. */
#define PACK_EXPANSION_PATTERN(NODE) \
(TREE_CODE (NODE) == TYPE_PACK_EXPANSION? TREE_TYPE (NODE) \
: TREE_OPERAND (NODE, 0))
/* Sets the type or expression pattern for a TYPE_PACK_EXPANSION or
EXPR_PACK_EXPANSION. */
#define SET_PACK_EXPANSION_PATTERN(NODE,VALUE) \
if (TREE_CODE (NODE) == TYPE_PACK_EXPANSION) \
TREE_TYPE (NODE) = VALUE; \
else \
TREE_OPERAND (NODE, 0) = VALUE
/* The list of parameter packs used in the PACK_EXPANSION_* node. The
TREE_VALUE of each TREE_LIST contains the parameter packs. */
#define PACK_EXPANSION_PARAMETER_PACKS(NODE) \
*(TREE_CODE (NODE) == EXPR_PACK_EXPANSION \
? &TREE_OPERAND (NODE, 1) \
: &TYPE_MINVAL (TYPE_PACK_EXPANSION_CHECK (NODE)))
/* Any additional template args to be applied when substituting into
the pattern, set by tsubst_pack_expansion for partial instantiations. */
#define PACK_EXPANSION_EXTRA_ARGS(NODE) \
*(TREE_CODE (NODE) == TYPE_PACK_EXPANSION \
? &TYPE_MAXVAL (NODE) \
: &TREE_OPERAND ((NODE), 2))
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
/* True iff this pack expansion is within a function context. */
#define PACK_EXPANSION_LOCAL_P(NODE) TREE_LANG_FLAG_0 (NODE)
/* True iff this pack expansion is for sizeof.... */
#define PACK_EXPANSION_SIZEOF_P(NODE) TREE_LANG_FLAG_1 (NODE)
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
/* True iff the wildcard can match a template parameter pack. */
#define WILDCARD_PACK_P(NODE) TREE_LANG_FLAG_0 (NODE)
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
/* Determine if this is an argument pack. */
#define ARGUMENT_PACK_P(NODE) \
(TREE_CODE (NODE) == TYPE_ARGUMENT_PACK \
|| TREE_CODE (NODE) == NONTYPE_ARGUMENT_PACK)
/* The arguments stored in an argument pack. Arguments are stored in a
TREE_VEC, which may have length zero. */
#define ARGUMENT_PACK_ARGS(NODE) \
(TREE_CODE (NODE) == TYPE_ARGUMENT_PACK? TREE_TYPE (NODE) \
: TREE_OPERAND (NODE, 0))
/* Set the arguments stored in an argument pack. VALUE must be a
TREE_VEC. */
#define SET_ARGUMENT_PACK_ARGS(NODE,VALUE) \
if (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK) \
TREE_TYPE (NODE) = VALUE; \
else \
TREE_OPERAND (NODE, 0) = VALUE
/* Whether the argument pack is "incomplete", meaning that more
arguments can still be deduced. Incomplete argument packs are only
used when the user has provided an explicit template argument list
for a variadic function template. Some of the explicit template
arguments will be placed into the beginning of the argument pack,
but additional arguments might still be deduced. */
#define ARGUMENT_PACK_INCOMPLETE_P(NODE) \
TREE_ADDRESSABLE (ARGUMENT_PACK_ARGS (NODE))
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
/* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template
arguments used to fill this pack. */
#define ARGUMENT_PACK_EXPLICIT_ARGS(NODE) \
TREE_TYPE (ARGUMENT_PACK_ARGS (NODE))
/* In an ARGUMENT_PACK_SELECT, the argument pack from which an
argument will be selected. */
#define ARGUMENT_PACK_SELECT_FROM_PACK(NODE) \
(((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->argument_pack)
/* In an ARGUMENT_PACK_SELECT, the index of the argument we want to
select. */
#define ARGUMENT_PACK_SELECT_INDEX(NODE) \
(((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->index)
/* In an ARGUMENT_PACK_SELECT, the actual underlying argument that the
ARGUMENT_PACK_SELECT represents. */
#define ARGUMENT_PACK_SELECT_ARG(NODE) \
TREE_VEC_ELT (ARGUMENT_PACK_ARGS (ARGUMENT_PACK_SELECT_FROM_PACK (NODE)), \
ARGUMENT_PACK_SELECT_INDEX (NODE))
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
#define FOLD_EXPR_CHECK(NODE) \
TREE_CHECK4 (NODE, UNARY_LEFT_FOLD_EXPR, UNARY_RIGHT_FOLD_EXPR, \
BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR)
#define BINARY_FOLD_EXPR_CHECK(NODE) \
TREE_CHECK2 (NODE, BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR)
/* True if NODE is UNARY_FOLD_EXPR or a BINARY_FOLD_EXPR */
#define FOLD_EXPR_P(NODE) \
(TREE_CODE (NODE) == UNARY_LEFT_FOLD_EXPR \
|| TREE_CODE (NODE) == UNARY_RIGHT_FOLD_EXPR \
|| TREE_CODE (NODE) == BINARY_LEFT_FOLD_EXPR \
|| TREE_CODE (NODE) == BINARY_RIGHT_FOLD_EXPR)
/* True when NODE is a fold over a compound assignment operator. */
#define FOLD_EXPR_MODIFY_P(NODE) \
TREE_LANG_FLAG_0 (FOLD_EXPR_CHECK (NODE))
/* An INTEGER_CST containing the tree code of the folded operator. */
#define FOLD_EXPR_OP(NODE) \
TREE_OPERAND (FOLD_EXPR_CHECK (NODE), 0)
/* The expression containing an unexpanded parameter pack. */
#define FOLD_EXPR_PACK(NODE) \
TREE_OPERAND (FOLD_EXPR_CHECK (NODE), 1)
/* In a binary fold expression, the argument with no unexpanded
parameter packs. */
#define FOLD_EXPR_INIT(NODE) \
TREE_OPERAND (BINARY_FOLD_EXPR_CHECK (NODE), 2)
/* In a FUNCTION_DECL, the saved language-specific per-function data. */
#define DECL_SAVED_FUNCTION_DATA(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (FUNCTION_DECL_CHECK (NODE)) \
->u.saved_language_function)
/* True if NODE is an implicit INDIRECT_EXPR from convert_from_reference. */
#define REFERENCE_REF_P(NODE) \
(INDIRECT_REF_P (NODE) \
&& TREE_TYPE (TREE_OPERAND (NODE, 0)) \
&& (TREE_CODE (TREE_TYPE (TREE_OPERAND ((NODE), 0))) \
== REFERENCE_TYPE))
re PR c++/18803 (rejects access to operator() in template) cp: PR c++/18803 * cp-tree.h (REFERENCE_REF_P): New. (CPTI_TYPE_INFO_TYPE): Rename to ... (CPTI_CONST_TYPE_INFO_TYPE): ... here. (CPTI_TYPE_INFO_REF_TYPE): Remove. (type_info_type_node): Rename to ... (const_type_info_type_node): ... here. (type_info_ref_type): Remove. * call.c (build_user_type_conversion): Reformat. (resolve_args): Do not convert_from_reference. (build_object_call): Call convert_from_reference. (prep_operand): Do not convert_from_reference. (build_new_method_call): Likewise. * class.c (build_vfield_ref): Likewise. * cvt.c (convert_to_reference): Likewise. (convert_from_reference): Build INDIRECT_REF here, not with build_indirect_ref. (convert_force): Do not convert_from_reference. (build_expr_type_conversion): Likewise. * decl.c (grok_reference_init): Likewise. * decl2.c (delete_sanity): Likewise. * except.c (initialize_handler_parm): Use POINTER_TYPE_P. * init.c (build_dtor_call): Do not convert_from_reference. * parser.c (cp_parser_template_argument): Unwrap indirected reference. Allow TEMPLATE_PARM_INDEX as an object parm. * pt.c (tsubst_copy_and_build) <case INDIRECT_REF>: Use convert_from_reference, if indicated. <case CALL_EXPR>: Do not convert_from_reference. <case PARM_DECL, VAR_DECL>: Convert_from_reference if needed. (tsubst_initializer_list): Do not convert_from_reference. * rtti.c (init_rtti_processing): Adjust node creation. (throw_bad_typeid): Use const_type_info_type_node. Do not convert_from_reference. (typeid_ok_p): Use const_type_info_type_node. (build_typeid, get_typeid): Always return type_info typed node. (build_dynamic_cast_1): Dont convert_from_reference. Refactor. * semantics.c (finish_stmt_expr_expr): Do not convert_from_reference. (finish_id_expression): Convert_from_reference as appropriate. * typeck.c (decay_conversion): Do not convert_from_reference. (finish_class_member_access_expr): Likewise. (build_indirect_ref): Use POINTER_TYPE_P. (convert_arguments): Do not convert_from_reference. (build_modify_expr): Likewise. (convert_for_initialization): Likewise. * typeck2.c (build_x_arrow): Likewise. testsuite: PR c++/18803 * g++.dg/template/operator5.C: New. From-SVN: r91863
2004-12-08 09:36:09 +01:00
/* True if NODE is a REFERENCE_TYPE which is OK to instantiate to be a
reference to VLA type, because it's used for VLA capture. */
#define REFERENCE_VLA_OK(NODE) \
(TYPE_LANG_FLAG_5 (REFERENCE_TYPE_CHECK (NODE)))
#define NEW_EXPR_USE_GLOBAL(NODE) \
TREE_LANG_FLAG_0 (NEW_EXPR_CHECK (NODE))
#define DELETE_EXPR_USE_GLOBAL(NODE) \
TREE_LANG_FLAG_0 (DELETE_EXPR_CHECK (NODE))
#define DELETE_EXPR_USE_VEC(NODE) \
TREE_LANG_FLAG_1 (DELETE_EXPR_CHECK (NODE))
1994-02-24 02:02:37 +01:00
#define CALL_OR_AGGR_INIT_CHECK(NODE) \
TREE_CHECK2 ((NODE), CALL_EXPR, AGGR_INIT_EXPR)
/* Indicates that this is a non-dependent COMPOUND_EXPR which will
resolve to a function call. */
#define COMPOUND_EXPR_OVERLOADED(NODE) \
TREE_LANG_FLAG_0 (COMPOUND_EXPR_CHECK (NODE))
/* In a CALL_EXPR appearing in a template, true if Koenig lookup
should be performed at instantiation time. */
#define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE))
/* True if the arguments to NODE should be evaluated in left-to-right
order regardless of PUSH_ARGS_REVERSED. */
#define CALL_EXPR_ORDERED_ARGS(NODE) \
TREE_LANG_FLAG_3 (CALL_OR_AGGR_INIT_CHECK (NODE))
/* True if the arguments to NODE should be evaluated in right-to-left
order regardless of PUSH_ARGS_REVERSED. */
#define CALL_EXPR_REVERSE_ARGS(NODE) \
TREE_LANG_FLAG_5 (CALL_OR_AGGR_INIT_CHECK (NODE))
/* True if CALL_EXPR was written as an operator expression, not a function
call. */
#define CALL_EXPR_OPERATOR_SYNTAX(NODE) \
TREE_LANG_FLAG_6 (CALL_OR_AGGR_INIT_CHECK (NODE))
/* Indicates whether a string literal has been parenthesized. Such
usages are disallowed in certain circumstances. */
#define PAREN_STRING_LITERAL_P(NODE) \
TREE_LANG_FLAG_0 (STRING_CST_CHECK (NODE))
/* Indicates whether a COMPONENT_REF or a SCOPE_REF has been parenthesized, or
an INDIRECT_REF comes from parenthesizing a _DECL. Currently only set some
of the time in C++14 mode. */
#define REF_PARENTHESIZED_P(NODE) \
TREE_LANG_FLAG_2 (TREE_CHECK3 ((NODE), COMPONENT_REF, INDIRECT_REF, SCOPE_REF))
/* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
constructor call, rather than an ordinary function call. */
#define AGGR_INIT_VIA_CTOR_P(NODE) \
TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
/* Nonzero if expanding this AGGR_INIT_EXPR should first zero-initialize
the object. */
#define AGGR_INIT_ZERO_FIRST(NODE) \
TREE_LANG_FLAG_2 (AGGR_INIT_EXPR_CHECK (NODE))
/* Nonzero means that the call is the jump from a thunk to the
thunked-to function. */
#define AGGR_INIT_FROM_THUNK_P(NODE) \
(AGGR_INIT_EXPR_CHECK (NODE)->base.protected_flag)
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
/* AGGR_INIT_EXPR accessors. These are equivalent to the CALL_EXPR
accessors, except for AGGR_INIT_EXPR_SLOT (which takes the place of
CALL_EXPR_STATIC_CHAIN). */
#define AGGR_INIT_EXPR_FN(NODE) TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 1)
#define AGGR_INIT_EXPR_SLOT(NODE) \
TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 2)
#define AGGR_INIT_EXPR_ARG(NODE, I) \
TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), (I) + 3)
#define aggr_init_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH(NODE) - 3)
/* AGGR_INIT_EXPR_ARGP returns a pointer to the argument vector for NODE.
We can't use &AGGR_INIT_EXPR_ARG (NODE, 0) because that will complain if
the argument count is zero when checking is enabled. Instead, do
the pointer arithmetic to advance past the 3 fixed operands in a
AGGR_INIT_EXPR. That produces a valid pointer to just past the end of
the operand array, even if it's not valid to dereference it. */
#define AGGR_INIT_EXPR_ARGP(NODE) \
(&(TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 0)) + 3)
/* Abstract iterators for AGGR_INIT_EXPRs. */
/* Structure containing iterator state. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
struct aggr_init_expr_arg_iterator {
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 t; /* the aggr_init_expr */
int n; /* argument count */
int i; /* next argument index */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02: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
/* Initialize the abstract argument list iterator object ITER with the
arguments from AGGR_INIT_EXPR node EXP. */
inline void
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
init_aggr_init_expr_arg_iterator (tree exp,
aggr_init_expr_arg_iterator *iter)
{
iter->t = exp;
iter->n = aggr_init_expr_nargs (exp);
iter->i = 0;
}
/* Return the next argument from abstract argument list iterator object ITER,
and advance its state. Return NULL_TREE if there are no more arguments. */
inline 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
next_aggr_init_expr_arg (aggr_init_expr_arg_iterator *iter)
{
tree result;
if (iter->i >= iter->n)
return NULL_TREE;
result = AGGR_INIT_EXPR_ARG (iter->t, iter->i);
iter->i++;
return result;
}
/* Initialize the abstract argument list iterator object ITER, then advance
past and return the first argument. Useful in for expressions, e.g.
for (arg = first_aggr_init_expr_arg (exp, &iter); arg;
arg = next_aggr_init_expr_arg (&iter)) */
inline 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
first_aggr_init_expr_arg (tree exp, aggr_init_expr_arg_iterator *iter)
{
init_aggr_init_expr_arg_iterator (exp, iter);
return next_aggr_init_expr_arg (iter);
}
/* Test whether there are more arguments in abstract argument list iterator
ITER, without changing its state. */
inline bool
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
more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
{
return (iter->i < iter->n);
}
/* Iterate through each argument ARG of AGGR_INIT_EXPR CALL, using variable
ITER (of type aggr_init_expr_arg_iterator) to hold the iteration state. */
#define FOR_EACH_AGGR_INIT_EXPR_ARG(arg, iter, call) \
for ((arg) = first_aggr_init_expr_arg ((call), &(iter)); (arg); \
(arg) = next_aggr_init_expr_arg (&(iter)))
/* VEC_INIT_EXPR accessors. */
#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 0)
#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 1)
/* Indicates that a VEC_INIT_EXPR is a potential constant expression.
Only set when the current function is constexpr. */
#define VEC_INIT_EXPR_IS_CONSTEXPR(NODE) \
TREE_LANG_FLAG_0 (VEC_INIT_EXPR_CHECK (NODE))
/* Indicates that a VEC_INIT_EXPR is expressing value-initialization. */
#define VEC_INIT_EXPR_VALUE_INIT(NODE) \
TREE_LANG_FLAG_1 (VEC_INIT_EXPR_CHECK (NODE))
/* The condition under which this MUST_NOT_THROW_EXPR actually blocks
exceptions. NULL_TREE means 'true'. */
#define MUST_NOT_THROW_COND(NODE) \
TREE_OPERAND (MUST_NOT_THROW_EXPR_CHECK (NODE), 1)
/* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
TEMPLATE_DECL. This macro determines whether or not a given class
type is really a template type, as opposed to an instantiation or
specialization of one. */
#define CLASSTYPE_IS_TEMPLATE(NODE) \
(CLASSTYPE_TEMPLATE_INFO (NODE) \
&& !CLASSTYPE_USE_TEMPLATE (NODE) \
&& PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
/* The name used by the user to name the typename type. Typically,
this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
corresponding TYPE_DECL. However, this may also be a
TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
split tree_type split tree_type gcc/ada/ * gcc-interface/ada-tree.h (TYPE_OBJECT_RECORD_TYPE): Use TYPE_MINVAL. (TYPE_GCC_MIN_VALUE): Use TYPE_MINVAL. (TYPE_GCC_MAX_VALUE): Use TYPE_MAXVAL. gcc/cp/ * cp-tree.h (TYPENAME_TYPE_FULLNAME, TYPEOF_TYPE_EXPR): Use TYPE_VALUES_RAW. (UNDERLYING_TYPE_TYPE, DECLTYPE_TYPE_EXPR): Likewise. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. gcc/ * ggc-page.c (extra_order_size_table): Use struct tree_type_non_common. * lto-streamer-in.c (unpack_ts_type_value_fields): Rename to... (unpack_ts_type_common_value_fields): ...this. Update comment. (unpack_value_fields): Adjust for renaming. (lto_input_ts_type_tree_pointers): Split into... (lto_input_ts_type_common_tree_pointer): ...this and... (lto_input_ts_type_non_common_tree_pointers): ...this. (lto_input_tree_pointers): Adjust for above split. * lto-streamer-out.c (pack_ts_type_value_fields): Rename to... (pack_ts_type_common_value_fields): ...this. Update comment. (lto_output_ts_type_tree_pointers): Split into... (lto_output_ts_type_common_tree_pointers): ...this and... (lto_output_ts_type_non_common_tree_pointers): ...this. (lto_output_tree_pointers): Adjust for above split. * lto-streamer.c (check_handled_ts_structures): Mark TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, and TS_TYPE_NON_COMMON as handled. * stor-layout.c (vector_type_mode): Adjust location of mode field. * tree.h (MARK_TS_TYPE_COMMON, MARK_TS_TYPE_WITH_LANG_SPECIFIC): Define. (struct tree_type): Split into... (struct tree_type_common: ...this and... (struct tree_type_with_lang_specific): ...this and... (struct tree_type_non_common): ...this. Adjust accessor macros accordingly. (TYPE_VALUES_RAW): Define. (union tree_node): Update for above changes. * tree.c (tree_node_structure_for_code) [tcc_type]: Return TS_TYPE_NON_COMMON. (initialize_tree_contains_struct) [TS_TYPE]: Use TS_TYPE_COMMON. Add TS_TYPE_WITH_LANG_SPECIFIC and TS_TYPE_NON_COMMON. (tree_code_size) [tcc_type]: Use struct tree_type_non_common. * treestructu.def (TS_TYPE): Remove. (TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, TS_TYPE_NON_COMMON): Define. gcc/java/ * java-tree.h (TYPE_ARGUMENT_SIGNATURE): Use TYPE_MINVAL. gcc/lto/ * lto.c (lto_ft_type): Use TYPE_MINVAL and TYPE_MAXVAL. Adjust location of binfo field. (lto_fixup_prevailing_decls): Likewise. gcc/objc/ * objc-act.h (CLASS_NAME, CLASS_SUPER_NAME): Use proper accessors. (CLASS_NST_METHODS, CLASS_CLS_METHODS): Likewise. (PROTOCOL_NAME, PROTOCOL_NST_METHODS, PROTOCOL_CLS_METHODS): Likewise. From-SVN: r173658
2011-05-11 15:48:55 +02:00
#define TYPENAME_TYPE_FULLNAME(NODE) \
(TYPE_VALUES_RAW (TYPENAME_TYPE_CHECK (NODE)))
1998-03-01 02:57:25 +01:00
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
/* True if a TYPENAME_TYPE was declared as an "enum". */
#define TYPENAME_IS_ENUM_P(NODE) \
(TREE_LANG_FLAG_0 (TYPENAME_TYPE_CHECK (NODE)))
/* True if a TYPENAME_TYPE was declared as a "class", "struct", or
"union". */
#define TYPENAME_IS_CLASS_P(NODE) \
(TREE_LANG_FLAG_1 (TYPENAME_TYPE_CHECK (NODE)))
/* True if a TYPENAME_TYPE is in the process of being resolved. */
#define TYPENAME_IS_RESOLVING_P(NODE) \
(TREE_LANG_FLAG_2 (TYPENAME_TYPE_CHECK (NODE)))
/* [class.virtual]
1994-02-24 02:02:37 +01:00
A class that declares or inherits a virtual function is called a
polymorphic class. */
#define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE))
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_new_abi): Move. * cp-tree.h (flag_new_abi): Move. (flag_use_cxa_atexit): Likewise. (flag_honor_std): Likewise. (flag_rtti): Likewise. (vbase_offsets_in_vtable_p): Define. (vptrs_present_everywhere_p): Likewise. (TYPE_CONTAINS_VPTR_P): Likewise. (dfs_walk_real): Declare. * class.c (build_vbase_pointer_fields): Check vbase_offsets_in_vtable_p. (dfs_build_vbase_offset_vtbl_entries): Record the vbase indices in BINFO_VPTR_FIELD. (build_vbase_offset_vtbl_entries): Simplify. (build_vbase_offset_vtbl_entries): Adjust. (build_vbase_pointer): Add ability to look up vbase offsets in vtable. (start_vtable): New function. (add_virtual_function): Use it. (determine_primary_base): Use TYPE_CONTAINS_VPTR_P. (num_extra_vtbl_entries): Use vbase_offsets_in_vtable_p. (build_vtbl_initializer): Take the type of the complete object as input. Use it to correctly calculate vbase offsets. (dfs_finish_vtbls): Pass the complete type to build_vtbl_initializer. (check_bases_and_members): Use TYPE_CONTAINS_VPTR_P. (create_vtable_ptr): Create a vtable even if there are no new virtual functions, under the new ABI. (finish_struct_1): Likewise. (get_vfield_name): Use TYPE_CONTAINS_VPTR_P. * decl.c (exapnd_static_init): Remove call to preserve_initializer. * decl2.c (mark_vtable_entries): Tweak to handle vbase offsets in vtables. * init.c (initialize_vtbl_ptrs): Initialize them in pre-order. (expand_virtual_init): Use vbase_offsets_in_vtable_p. (construct_virtual_bases): Don't initialize virtual base pointers under the new ABI. (build_aggr_init): Clean up comment. (expand_aggr_init_1): Likewise. * rtti.c (expand_class_desc): Store the virtual function table index where the vbase offset lives in the offset field. * search.c (dfs_walk_real): Make it global. (dfs_debug_mark): Use TYPE_CONTAINS_VPTR_P. * tree.c (make_binfo): Don't clear BINFO_VPTR_FIELD. * tinfo.h (USItype): Make it signed under the new ABI. * tinfo.cc (convert_to_base): New function. Encapsulate base conversion logic here. (__class_type_info::do_upcast): Use it. (__class_type_info::do_dyncast): Likewise. (__class_type_info::do_find_public_subobj): Likewise. From-SVN: r31452
2000-01-17 05:08:01 +01:00
/* Nonzero if this class has a virtual function table pointer. */
#define TYPE_CONTAINS_VPTR_P(NODE) \
(TYPE_POLYMORPHIC_P (NODE) || CLASSTYPE_VBASECLASSES (NODE))
cp-tree.h (flag_new_abi): Move. * cp-tree.h (flag_new_abi): Move. (flag_use_cxa_atexit): Likewise. (flag_honor_std): Likewise. (flag_rtti): Likewise. (vbase_offsets_in_vtable_p): Define. (vptrs_present_everywhere_p): Likewise. (TYPE_CONTAINS_VPTR_P): Likewise. (dfs_walk_real): Declare. * class.c (build_vbase_pointer_fields): Check vbase_offsets_in_vtable_p. (dfs_build_vbase_offset_vtbl_entries): Record the vbase indices in BINFO_VPTR_FIELD. (build_vbase_offset_vtbl_entries): Simplify. (build_vbase_offset_vtbl_entries): Adjust. (build_vbase_pointer): Add ability to look up vbase offsets in vtable. (start_vtable): New function. (add_virtual_function): Use it. (determine_primary_base): Use TYPE_CONTAINS_VPTR_P. (num_extra_vtbl_entries): Use vbase_offsets_in_vtable_p. (build_vtbl_initializer): Take the type of the complete object as input. Use it to correctly calculate vbase offsets. (dfs_finish_vtbls): Pass the complete type to build_vtbl_initializer. (check_bases_and_members): Use TYPE_CONTAINS_VPTR_P. (create_vtable_ptr): Create a vtable even if there are no new virtual functions, under the new ABI. (finish_struct_1): Likewise. (get_vfield_name): Use TYPE_CONTAINS_VPTR_P. * decl.c (exapnd_static_init): Remove call to preserve_initializer. * decl2.c (mark_vtable_entries): Tweak to handle vbase offsets in vtables. * init.c (initialize_vtbl_ptrs): Initialize them in pre-order. (expand_virtual_init): Use vbase_offsets_in_vtable_p. (construct_virtual_bases): Don't initialize virtual base pointers under the new ABI. (build_aggr_init): Clean up comment. (expand_aggr_init_1): Likewise. * rtti.c (expand_class_desc): Store the virtual function table index where the vbase offset lives in the offset field. * search.c (dfs_walk_real): Make it global. (dfs_debug_mark): Use TYPE_CONTAINS_VPTR_P. * tree.c (make_binfo): Don't clear BINFO_VPTR_FIELD. * tinfo.h (USItype): Make it signed under the new ABI. * tinfo.cc (convert_to_base): New function. Encapsulate base conversion logic here. (__class_type_info::do_upcast): Use it. (__class_type_info::do_dyncast): Likewise. (__class_type_info::do_find_public_subobj): Likewise. From-SVN: r31452
2000-01-17 05:08:01 +01:00
/* This flag is true of a local VAR_DECL if it was declared in a for
1996-07-11 03:13:25 +02:00
statement, but we are no longer in the scope of the for. */
#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE))
/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
if we already emitted a warning about using it. */
#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * call.c (equal_functions): Use DECL_LOCAL_FUCNTION_P, not TREE_PERMANENT. * decl.c (pushdecl): Set DECL_LOCAL_FUNCTION_P. * decl2.c (lookup_arg_dependent): Use it. * cp-tree.h (cp_finish_decl): Change prototype. (finish_static_data_member_decl): Likewise. (push_permanent_obstack): Remove declaration. (push_expression_obstack): Likewise. (push_scratch_obstack): Likewise. (DECL_TEMPLATE_PARM_P): Robustify. (SET_DECL_TEMPLATE_PARM_P): New macro. * class.c (add_method): Don't manipulate obstacks. (finish_vtbls): Likewise. * cvt.c (build_up_reference): Adjust calls to cp_finish_decl. * decl.c (binding_for_name): Don't manipulate obstacks. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (implicitly_declare): Likewise. (build_typename_type): Likewise. (start_decl): Likewise. (cp_finish_decl): Likewise. (finish_decl): Likewise. (destroy_local_static): Likewise. (expand_static_init): Likewise. (complete_array_type): Likewise. (grokvardecl): Likewise. (build_ptrmemfnc_type): Likewise. (grokdeclarator): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. (start_enum): Likewise. (finish_enum): Likewise. (start_function): Likewise. (finish_function): Likewise. (start_method): Adjust call to cp_finish_decl. * decl2.c (finish_static_data_member_decl): Don't manipulate obstacks. (grokfield): Likewise. (grokbitfield): Likewise. (get_temp_name): Likewise. (get_sentry): Likewise. (fnish_file): Likewise. (lookup_arg_dependent): Likewise. * except.c (call_eh_info): Likewise. (push_eh_info): Likewise. (do_pop_exception): Likewise. (initialize_handler_parm): Likewise. (expand_end_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * expr.c (extract_scalar_init): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (snarf_defarg): Likewise. (add_defarg_fn): Likewise. (is_global): Simplify. (do_identifier): Don't check TREE_PERMANENT. * method.c (emit_thunk): Don't manipulate obstacks. * parse.y (condition): Adjust call to cp_finish_decl. (primary): Likewise. (initdcl): Likewise. (initdcl0_innards): Likewise. (nomods_initdcl0): Likewise. * pt.c (push_inline_template_parms_recursive): Use SET_DECL_TEMPLATE_PARM_P. (process_template_parm): Likewise. (lookup_template_class): Don't manipulate obstacks. (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_decl): Don't manipulate obstacks. (tsubst_expr): Likewise. (instantiate_template): Likewise. (instantiate_decl): Adjust calls to cp_finish_decl. * rtti.c (call_void_fn): Don't manipulate obstacks. (get_tinfo_var): Likewise. (get_tinfo_fn_unused): Likewise. (build_dynamic_cast_1): Likewise. (expand_si_desc): Likewise. (expand_class_desc): Likewise. (expand_ptr_desc): Likewise. (expand_attr_desc): Likewise. (expand_generic_desc): Likewise. (synthesize_tinfo_fn): Likewise. * search.c (expand_upcast_fixups): Likewise. * semantics.c (finish_asm_stmt): Likewise. (finish_named_return_value): Likewise. (begin_class_definition): Likewise. (finish_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (build_cplus_method_type): Likewise. (reverse_path): Likewise. (copy_template_template_parm): Likewise. (build_expr_ptr_wrapper): Likewise. (push_expression_obstack): Remove. (push_permanent_obstack): Likewise. * typeck.c (mark_addressable): Likewise. From-SVN: r30527
1999-11-14 21:29:06 +01:00
/* Nonzero if NODE is a FUNCTION_DECL (for a function with global
scope) declared in a local scope. */
#define DECL_LOCAL_FUNCTION_P(NODE) \
DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
/* Nonzero if NODE is the target for genericization of 'break' stmts. */
#define LABEL_DECL_BREAK(NODE) \
DECL_LANG_FLAG_0 (LABEL_DECL_CHECK (NODE))
/* Nonzero if NODE is the target for genericization of 'continue' stmts. */
#define LABEL_DECL_CONTINUE(NODE) \
DECL_LANG_FLAG_1 (LABEL_DECL_CHECK (NODE))
Implement return type deduction for normal functions with -std=c++1y. * cp-tree.h (FNDECL_USED_AUTO): New macro. (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P): Remove. (dependent_lambda_return_type_node): Remove. (CPTI_DEPENDENT_LAMBDA_RETURN_TYPE): Remove. (struct language_function): Add x_auto_return_pattern field. (current_function_auto_return_pattern): New. (enum tsubst_flags): Add tf_partial. * decl.c (decls_match): Handle auto return comparison. (duplicate_decls): Adjust error message for auto return. (cxx_init_decl_processing): Remove dependent_lambda_return_type_node. (cp_finish_decl): Don't do auto deduction for functions. (grokdeclarator): Allow auto return without trailing return type in C++1y mode. (check_function_type): Defer checking of deduced return type. (start_preparsed_function): Set current_function_auto_return_pattern. (finish_function): Set deduced return type to void if not previously deduced. * decl2.c (change_return_type): Handle error_mark_node. (mark_used): Always instantiate functions with deduced return type. Complain about use if deduction isn't done. * parser.c (cp_parser_lambda_declarator_opt): Use 'auto' for initial return type. (cp_parser_lambda_body): Don't deduce return type in a template. (cp_parser_conversion_type_id): Allow auto in C++1y. * pt.c (instantiate_class_template_1): Don't mess with LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P. (tsubst_copy_and_build): Likewise. (fn_type_unification, tsubst): Don't reduce the template parm level of 'auto' during deduction. (unify): Compare 'auto' specially. (get_bindings): Change test. (always_instantiate_p): Always instantiate functions with deduced return type. (do_auto_deduction): Handle error_mark_node and lambda context. Don't check for use in initializer. (contains_auto_r): Remove. * search.c (lookup_conversions_r): Handle auto conversion function. * semantics.c (lambda_return_type): Handle null return. Don't mess with dependent_lambda_return_type_node. (apply_deduced_return_type): Rename from apply_lambda_return_type. * typeck.c (merge_types): Handle auto. (check_return_expr): Do auto deduction. * typeck2.c (add_exception_specifier): Fix complain check. From-SVN: r185768
2012-03-24 21:56:08 +01:00
/* True if NODE was declared with auto in its return type, but it has
started compilation and so the return type might have been changed by
return type deduction; its declared return type should be found in
DECL_STRUCT_FUNCTION(NODE)->language->x_auto_return_pattern. */
#define FNDECL_USED_AUTO(NODE) \
TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (NODE))
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
/* Nonzero if NODE is a DECL which we know about but which has not
been explicitly declared, such as a built-in function or a friend
declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P
will be set. */
#define DECL_ANTICIPATED(NODE) \
(DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \
->u.base.anticipated_p)
cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * call.c (equal_functions): Use DECL_LOCAL_FUCNTION_P, not TREE_PERMANENT. * decl.c (pushdecl): Set DECL_LOCAL_FUNCTION_P. * decl2.c (lookup_arg_dependent): Use it. * cp-tree.h (cp_finish_decl): Change prototype. (finish_static_data_member_decl): Likewise. (push_permanent_obstack): Remove declaration. (push_expression_obstack): Likewise. (push_scratch_obstack): Likewise. (DECL_TEMPLATE_PARM_P): Robustify. (SET_DECL_TEMPLATE_PARM_P): New macro. * class.c (add_method): Don't manipulate obstacks. (finish_vtbls): Likewise. * cvt.c (build_up_reference): Adjust calls to cp_finish_decl. * decl.c (binding_for_name): Don't manipulate obstacks. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (implicitly_declare): Likewise. (build_typename_type): Likewise. (start_decl): Likewise. (cp_finish_decl): Likewise. (finish_decl): Likewise. (destroy_local_static): Likewise. (expand_static_init): Likewise. (complete_array_type): Likewise. (grokvardecl): Likewise. (build_ptrmemfnc_type): Likewise. (grokdeclarator): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. (start_enum): Likewise. (finish_enum): Likewise. (start_function): Likewise. (finish_function): Likewise. (start_method): Adjust call to cp_finish_decl. * decl2.c (finish_static_data_member_decl): Don't manipulate obstacks. (grokfield): Likewise. (grokbitfield): Likewise. (get_temp_name): Likewise. (get_sentry): Likewise. (fnish_file): Likewise. (lookup_arg_dependent): Likewise. * except.c (call_eh_info): Likewise. (push_eh_info): Likewise. (do_pop_exception): Likewise. (initialize_handler_parm): Likewise. (expand_end_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * expr.c (extract_scalar_init): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (snarf_defarg): Likewise. (add_defarg_fn): Likewise. (is_global): Simplify. (do_identifier): Don't check TREE_PERMANENT. * method.c (emit_thunk): Don't manipulate obstacks. * parse.y (condition): Adjust call to cp_finish_decl. (primary): Likewise. (initdcl): Likewise. (initdcl0_innards): Likewise. (nomods_initdcl0): Likewise. * pt.c (push_inline_template_parms_recursive): Use SET_DECL_TEMPLATE_PARM_P. (process_template_parm): Likewise. (lookup_template_class): Don't manipulate obstacks. (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_decl): Don't manipulate obstacks. (tsubst_expr): Likewise. (instantiate_template): Likewise. (instantiate_decl): Adjust calls to cp_finish_decl. * rtti.c (call_void_fn): Don't manipulate obstacks. (get_tinfo_var): Likewise. (get_tinfo_fn_unused): Likewise. (build_dynamic_cast_1): Likewise. (expand_si_desc): Likewise. (expand_class_desc): Likewise. (expand_ptr_desc): Likewise. (expand_attr_desc): Likewise. (expand_generic_desc): Likewise. (synthesize_tinfo_fn): Likewise. * search.c (expand_upcast_fixups): Likewise. * semantics.c (finish_asm_stmt): Likewise. (finish_named_return_value): Likewise. (begin_class_definition): Likewise. (finish_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (build_cplus_method_type): Likewise. (reverse_path): Likewise. (copy_template_template_parm): Likewise. (build_expr_ptr_wrapper): Likewise. (push_expression_obstack): Remove. (push_permanent_obstack): Likewise. * typeck.c (mark_addressable): Likewise. From-SVN: r30527
1999-11-14 21:29:06 +01:00
builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, [...]): New. gcc/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. * cgraph.h (enum cgraph_simd_clone_arg_type): Add SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP, SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP. (struct cgraph_simd_clone_arg): Adjust comment. * coretypes.h (struct gomp_ordered): New forward decl. * gimple.c (gimple_build_omp_critical): Add CLAUSES argument, set critical clauses to it. (gimple_build_omp_ordered): Return gomp_ordered * instead of gimple *. Add CLAUSES argument, set ordered clauses to it. (gimple_copy): Unshare clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimple.def (GIMPLE_OMP_ORDERED): Change from GSS_OMP to GSS_OMP_SINGLE_LAYOUT, move it after GIMPLE_OMP_TEAMS. * gimple.h (enum gf_mask): Add GF_OMP_TASK_TASKLOOP. Add another bit to GF_OMP_FOR_KIND_MASK mask. Add GF_OMP_FOR_KIND_TASKLOOP, renumber GF_OMP_FOR_KIND_CILKFOR and GF_OMP_FOR_KIND_OACC_LOOP. Adjust GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED and GF_OMP_FOR_COMBINED_INTO. Add another bit to GF_OMP_TARGET_KIND_MASK mask. Add GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, renumber GF_OMP_TARGET_KIND_OACC_{PARALLEL,KERNELS,DATA,UPDATE,ENTER_EXIT_DATA}. (gomp_critical): Add clauses field. (gomp_ordered): New struct. (is_a_helper <gomp_ordered *>::test): New inline. (gimple_build_omp_critical): Add CLAUSES argument. (gimple_build_omp_ordered): Likewise. Return gomp_ordered * instead of gimple *. (gimple_omp_critical_clauses, gimple_omp_critical_clauses_ptr, gimple_omp_critical_set_clauses, gimple_omp_ordered_clauses, gimple_omp_ordered_clauses_ptr, gimple_omp_ordered_set_clauses, gimple_omp_task_taskloop_p, gimple_omp_task_set_taskloop_p): New inline functions. * gimple-pretty-print.c (dump_gimple_omp_for): Handle taskloop. (dump_gimple_omp_target): Handle enter data and exit data. (dump_gimple_omp_block): Don't handle GIMPLE_OMP_ORDERED here. (dump_gimple_omp_critical): Print clauses. (dump_gimple_omp_ordered): New function. (dump_gimple_omp_task): Handle taskloop. (pp_gimple_stmt_1): Use dump_gimple_omp_ordered for GIMPLE_OMP_ORDERED. * gimple-walk.c (walk_gimple_op): Walk clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_0LEN_ARRAY. (enum omp_region_type): Add ORT_COMBINED_TARGET and ORT_NONE. (struct gimplify_omp_ctx): Add loop_iter_var, target_map_scalars_firstprivate, target_map_pointers_as_0len_arrays and target_firstprivatize_array_bases fields. (delete_omp_context): Release loop_iter_var. (gimplify_bind_expr): Handle ORT_NONE. (maybe_fold_stmt): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (is_gimple_stmt): Return true for OMP_TASKLOOP, OMP_TEAMS and OMP_TARGET{,_DATA,_UPDATE,_ENTER_DATA,_EXIT_DATA}. (omp_firstprivatize_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle ctx->target_map_scalars_firstprivate. (omp_add_variable): Handle ORT_NONE. Allow map clause together with data sharing clauses. For data sharing clause with VLA decl on omp target/target data don't add firstprivate for the pointer. Call omp_notice_variable on TYPE_SIZE_UNIT only if it is a DECL_P. (omp_notice_threadprivate_variable): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (omp_notice_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle implicit mapping of pointers as zero length array sections and ctx->target_map_scalars_firstprivate mapping of scalars as firstprivate data sharing. (omp_check_private): Handle omp_member_access_dummy_var vars. (find_decl_expr): New function. (gimplify_scan_omp_clauses): Add CODE argument. For OMP_CLAUSE_IF complain if OMP_CLAUSE_IF_MODIFIER is present and does not match code. Handle OMP_CLAUSE_GANG separately. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. Diagnose linear clause on combined distribute {, parallel for} simd construct, unless it is the loop iterator. Handle struct element GOMP_MAP_FIRSTPRIVATE_POINTER. Handle map clauses with COMPONENT_REF. Initialize ctx->target_map_scalars_firstprivate, ctx->target_firstprivatize_array_bases and ctx->target_map_pointers_as_0len_arrays. Add firstprivate for linear clause even to target region if combined. Remove map clauses with GOMP_MAP_FIRSTPRIVATE_POINTER kind from OMP_TARGET_{,ENTER_,EXIT_}DATA. For GOMP_MAP_FIRSTPRIVATE_POINTER map kind with non-INTEGER_CST OMP_CLAUSE_SIZE firstprivatize the bias. Handle OMP_CLAUSE_DEPEND_{SINK,SOURCE}. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. For linear clause on worksharing loop combined with parallel add shared clause on the parallel. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set DECL_NAME on omp_member_access_dummy_var vars. Add lastprivate clause to outer taskloop if needed. (gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_0LEN_ARRAY. If gimplify_omp_ctxp->target_firstprivatize_array_bases, use GOMP_MAP_FIRSTPRIVATE_POINTER map kind instead of GOMP_MAP_POINTER. (gimplify_adjust_omp_clauses): Add CODE argument. Handle removal of GOMP_MAP_FIRSTPRIVATE_POINTER struct elements for struct not seen in target body. Handle removal of struct mapping if struct is not seen in target body. Remove GOMP_MAP_STRUCT map clause on OMP_TARGET_EXIT_DATA. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Use GOMP_MAP_FIRSTPRIVATE_POINTER instead of GOMP_MAP_POINTER if ctx->target_firstprivatize_array_bases for VLAs. Set OMP_CLAUSE_MAP_PRIVATE if both data sharing and map clause appear together. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. Don't remove map clause if it has map-type-modifier always. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. (gimplify_oacc_cache, gimplify_omp_parallel, gimplify_omp_task): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. (gimplify_omp_for): Likewise. Handle OMP_TASKLOOP. Initialize loop_iter_var. Use OMP_FOR_ORIG_DECLS. Fix handling of lastprivate iterators in doacross loops. (gimplify_omp_workshare): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Use ORT_COMBINED_TARGET for OMP_TARGET_COMBINED. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (gimplify_omp_target_update): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Handle OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. (gimplify_omp_ordered): New function. (gimplify_expr): Handle OMP_TASKLOOP, OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. Use gimplify_omp_ordered for OMP_ORDERED. Gimplify clauses on OMP_CRITICAL. * internal-fn.c (expand_GOMP_SIMD_ORDERED_START, expand_GOMP_SIMD_ORDERED_END): New functions. * internal-fn.def (GOMP_SIMD_ORDERED_START, GOMP_SIMD_ORDERED_END): New internal functions. * omp-builtins.def (BUILT_IN_GOMP_LOOP_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_DOACROSS_POST, BUILT_IN_GOMP_DOACROSS_WAIT, BUILT_IN_GOMP_DOACROSS_ULL_POST, BUILT_IN_GOMP_DOACROSS_ULL_WAIT, BUILT_IN_GOMP_TARGET_ENTER_EXIT_DATA, BUILT_IN_GOMP_TASKLOOP, BUILT_IN_GOMP_TASKLOOP_ULL): New built-ins. (BUILT_IN_GOMP_TASK): Add INT argument to the end. (BUILT_IN_GOMP_TARGET): Rename from GOMP_target to GOMP_target_41, adjust type. (BUILT_IN_GOMP_TARGET_DATA): Rename from GOMP_target_data to GOMP_target_data_41, adjust type. (BUILT_IN_GOMP_TARGET_UPDATE): Rename from GOMP_target_update to GOMP_target_update_41, adjust type. * omp-low.c (struct omp_region): Adjust comments, add ord_stmt field. (struct omp_for_data): Add ordered and simd_schedule fields. (omp_member_access_dummy_var, unshare_and_remap_1, unshare_and_remap, is_taskloop_ctx): New functions. (is_taskreg_ctx): Use is_parallel_ctx and is_task_ctx. (extract_omp_for_data): Handle taskloops and doacross loops and simd schedule modifier. (omp_adjust_chunk_size): New function. (get_ws_args_for): Use it. (lookup_sfield): Change first argument to splay_tree_key, add overload with first argument tree. (maybe_lookup_field): Likewise. (use_pointer_for_field): Handle omp_member_access_dummy_var. (omp_copy_decl_2): If var is TREE_ADDRESSABLE listed in task_shared_vars, clear TREE_ADDRESSABLE on the copy. (build_outer_var_ref): Add LASTPRIVATE argument, handle taskloops and omp_member_access_dummy_var vars. (build_sender_ref): Change first argument to splay_tree_key, add overload with first argument tree. (install_var_field): For mask & 8 use &DECL_UID as key instead of the tree itself. (fixup_child_record_type): Const qualify *.omp_data_i. (scan_sharing_clauses): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE, C/C++ array reductions, OMP_CLAUSE_{IS,USE}_DEVICE_PTR clauses, OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,SIMDLEN,THREADS,SIMD} and OMP_CLAUSE_{NOGROUP,DEFAULTMAP} clauses, OMP_CLAUSE__LOOPTEMP_ clause on taskloop, GOMP_MAP_FIRSTPRIVATE_POINTER, OMP_CLAUSE_MAP_PRIVATE. (create_omp_child_function): Set TREE_READONLY on .omp_data_i. (find_combined_for): Allow searching for different GIMPLE_OMP_FOR kinds. (add_taskreg_looptemp_clauses): New function. (scan_omp_parallel): Use it. (scan_omp_task): Likewise. (finish_taskreg_scan): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. For taskloop, move fields for the first two _LOOPTEMP_ clauses first. (check_omp_nesting_restrictions): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Formatting fixes. Allow the sandwiched taskloop constructs. Type check OMP_CLAUSE_DEPEND_{KIND,SOURCE}. Allow ordered simd inside of simd region. Diagnose depend(source) or depend(sink:...) on target constructs or task/taskloop. (handle_simd_reference): Use get_name. (lower_rec_input_clauses): Likewise. Ignore all OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses on taskloop construct. Allow _LOOPTEMP_ clause on GOMP_TASK. Unshare new_var before passing it to omp_clause_{default,copy}_ctor. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set lastprivate_firstprivate flag for linear that needs copyin and copyout. Use BUILT_IN_ALLOCA_WITH_ALIGN instead of BUILT_IN_ALLOCA. (lower_lastprivate_clauses): For OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE on taskloop lookup decl in outer context. Pass true to build_outer_var_ref lastprivate argument. Handle OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV lastprivate if the decl is global outside of outer taskloop for. (lower_reduction_clauses): Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. (lower_send_clauses): Ignore first two _LOOPTEMP_ clauses in taskloop GOMP_TASK. Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. Handle omp_member_access_dummy_var vars. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Use new lookup_sfield overload. (lower_send_shared_vars): Ignore fields with NULL or FIELD_DECL abstract origin. Handle omp_member_access_dummy_var vars. (expand_parallel_call): Use expand_omp_build_assign. (expand_task_call): Handle taskloop construct expansion. Add REGION argument. Use GOMP_TASK_* defines instead of hardcoded integers. Add priority argument to GOMP_task* calls. Or in GOMP_TASK_FLAG_PRIORITY into flags if priority is present for GOMP_task call. (expand_omp_build_assign): Add prototype. Add AFTER argument, if true emit statements after *GSI_P and continue linking. (expand_omp_taskreg): Adjust expand_task_call caller. (expand_omp_for_init_counts): Rename zero_iter_bb argument to zero_iter1_bb and first_zero_iter to first_zero_iter1, add zero_iter2_bb and first_zero_iter2 arguments, handle computation of counts even for ordered loops. (expand_omp_for_init_vars): Handle GOMP_TASK inner_stmt. (expand_omp_ordered_source, expand_omp_ordered_sink, expand_omp_ordered_source_sink, expand_omp_for_ordered_loops): New functions. (expand_omp_for_generic): Use omp_adjust_chunk_size. Handle linear clauses on worksharing loop. Handle DOACROSS loop expansion. (expand_omp_for_static_nochunk): Handle linear clauses on worksharing loop. Adjust expand_omp_for_init_counts callers. (expand_omp_for_static_chunk): Likewise. Use omp_adjust_chunk_size. (expand_omp_simd): Handle addressable fd->loop.v. Adjust expand_omp_for_init_counts callers. (expand_omp_taskloop_for_outer, expand_omp_taskloop_for_inner): New functions. (expand_omp_for): Call expand_omp_taskloop_for_* for taskloop. Handle doacross loops. (expand_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Pass flags and depend arguments to GOMP_target_{41,update_41,enter_exit_data} libcalls. (expand_omp): Don't expand ordered depend constructs here, record ord_stmt instead for later expand_omp_for_generic. (build_omp_regions_1): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (lower_omp_ordered_clauses): New function. (lower_omp_ordered): Handle OMP_CLAUSE_SIMD, for OMP_CLAUSE_DEPEND don't lower anything. (lower_omp_for_lastprivate): Use last _looptemp_ clause on taskloop for comparison. (lower_omp_for): Handle taskloop constructs. Adjust OMP_CLAUSE_DECL and OMP_CLAUSE_LINEAR_STEP so that expand_omp_for_* can use it during expansion for linear adjustments. (create_task_copyfn): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. (lower_depend_clauses): Assert not seeing sink/source depend kinds. Set TREE_ADDRESSABLE on array. Change first argument from gimple * to tree * pointing to the stmt's clauses. (lower_omp_taskreg): Adjust lower_depend_clauses caller. (lower_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, depend clauses, GOMP_MAP_{RELEASE,ALWAYS_{TO,FROM,TOFROM},FIRSTPRIVATE_POINTER,STRUCT} map kinds, OMP_CLAUSE_{FIRSTPRIVATE,PRIVATE,{IS,USE}_DEVICE_PTR clauses. Always use short kind and 8-bit align shift. (lower_omp_regimplify_p): Use IS_TYPE_OR_DECL_P macro. (struct lower_omp_regimplify_operands_data): New type. (lower_omp_regimplify_operands_p, lower_omp_regimplify_operands): New functions. (lower_omp_1): Use lower_omp_regimplify_operands instead of gimple_regimplify_operands. (make_gimple_omp_edges): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (simd_clone_clauses_extract): Honor OMP_CLAUSE_LINEAR_KIND. (simd_clone_mangle): Mangle the various linear kinds per the new ABI. (simd_clone_adjust_argument_types): Handle SIMD_CLONE_ARG_TYPE_LINEAR_*_CONSTANT_STEP. (simd_clone_init_simd_arrays): Don't do anything for uval. (simd_clone_adjust): Handle SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP. Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP. * omp-low.h (omp_member_access_dummy_var): New prototype. * passes.def (pass_simduid_cleanup): Schedule another copy of the pass after all optimizations. * tree.c (omp_clause_code_name): Add entries for OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (omp_clause_num_ops): Likewise. Bump number of OMP_CLAUSE_REDUCTION arguments to 5 and for OMP_CLAUSE_ORDERED to 1. (walk_tree_1): Adjust for OMP_CLAUSE_ORDERED having 1 argument and OMP_CLAUSE_REDUCTION 5 arguments. Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD} clauses. * tree-core.h (enum omp_clause_linear_kind): New. (struct tree_omp_clause): Change type of map_kind from unsigned char to unsigned int. Add subcode.if_modifier and subcode.linear_kind fields. (enum omp_clause_code): Add OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (OMP_CLAUSE_REDUCTION): Document OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_{SOURCE,SINK}. * tree.def (OMP_FOR): Add OMP_FOR_ORIG_DECLS operand. (OMP_CRITICAL): Move before OMP_SINGLE. Add OMP_CRITICAL_CLAUSES operand. (OMP_ORDERED): Move before OMP_SINGLE. Add OMP_ORDERED_CLAUSES operand. (OMP_TASKLOOP, OMP_TARGET_ENTER_DATA, OMP_TARGET_EXIT_DATA): New tree codes. * tree.h (OMP_BODY): Replace OMP_CRITICAL with OMP_TASKGROUP. (OMP_CLAUSE_SET_MAP_KIND): Cast to unsigned int rather than unsigned char. (OMP_CRITICAL_NAME): Adjust to be 3rd operand instead of 2nd. (OMP_CLAUSE_NUM_TASKS_EXPR): Formatting fix. (OMP_STANDALONE_CLAUSES): Adjust to cover OMP_TARGET_{ENTER,EXIT}_DATA. (OMP_CLAUSE_DEPEND_SINK_NEGATIVE, OMP_TARGET_COMBINED, OMP_CLAUSE_MAP_PRIVATE, OMP_FOR_ORIG_DECLS, OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION, OMP_CRITICAL_CLAUSES, OMP_CLAUSE_PRIVATE_TASKLOOP_IV, OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, OMP_CLAUSE_HINT_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER, OMP_CLAUSE_SHARED_FIRSTPRIVATE, OMP_ORDERED_CLAUSES, OMP_TARGET_ENTER_DATA_CLAUSES, OMP_TARGET_EXIT_DATA_CLAUSES, OMP_CLAUSE_NUM_TASKS_EXPR, OMP_CLAUSE_GRAINSIZE_EXPR, OMP_CLAUSE_PRIORITY_EXPR, OMP_CLAUSE_ORDERED_EXPR): Define. * tree-inline.c (remap_gimple_stmt): Handle clauses on GIMPLE_OMP_ORDERED and GIMPLE_OMP_CRITICAL. For IFN_GOMP_SIMD_ORDERED_{START,END} set has_simduid_loops. * tree-nested.c (convert_nonlocal_omp_clauses): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (convert_local_omp_clauses): Likewise. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_ORDERED_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_DEPEND_{SOURCE,SINK}. Use "delete" for GOMP_MAP_FORCE_DEALLOC. Handle GOMP_MAP_{ALWAYS_{TO,FROM,TOFROM},RELEASE,FIRSTPRIVATE_POINTER,STRUCT}. (dump_generic_node): Handle OMP_TASKLOOP, OMP_TARGET_{ENTER,EXIT}_DATA and clauses on OMP_ORDERED and OMP_CRITICAL. * tree-vectorizer.c (adjust_simduid_builtins): Adjust comment. Remove IFN_GOMP_SIMD_ORDERED_{START,END}. (vectorize_loops): Adjust comments. (pass_simduid_cleanup::execute): Likewise. * tree-vect-stmts.c (vectorizable_simd_clone_call): Handle SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_CONSTANT_STEP. * wide-int.h (wi::gcd): New. gcc/c-family/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-common.c (enum c_builtin_type): Define DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10 and DEF_FUNCTION_TYPE_11. (c_define_builtins): Likewise. * c-common.h (enum c_omp_clause_split): Add C_OMP_CLAUSE_SPLIT_TASKLOOP. (c_finish_omp_critical, c_finish_omp_ordered): Add CLAUSES argument. (c_finish_omp_for): Add ORIG_DECLV argument. * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP as 201511 instead of 201307. * c-omp.c (c_finish_omp_critical): Add CLAUSES argument, set OMP_CRITICAL_CLAUSES to it. (c_finish_omp_ordered): Add CLAUSES argument, set OMP_ORDERED_CLAUSES to it. (c_finish_omp_for): Add ORIG_DECLV argument, set OMP_FOR_ORIG_DECLS to it if OMP_FOR. Clear DECL_INITIAL on the IVs. (c_omp_split_clauses): Handle OpenMP 4.5 combined/composite constructs and new OpenMP 4.5 clauses. Clear OMP_CLAUSE_SCHEDULE_SIMD if not combined with OMP_SIMD. Add verification code. * c-pragma.c (omp_pragmas_simd): Add taskloop. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKLOOP. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_{DEFAULTMAP,GRAINSIZE,HINT,{IS,USE}_DEVICE_PTR} and PRAGMA_OMP_CLAUSE_{LINK,NOGROUP,NUM_TASKS,PRIORITY,SIMD,THREADS}. gcc/c/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-parser.c (c_parser_pragma): Handle PRAGMA_OMP_ORDERED here. (c_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (c_parser_omp_variable_list): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Formatting fixes. (c_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize, c_parser_omp_clause_priority, c_parser_omp_clause_hint, c_parser_omp_clause_defaultmap, c_parser_omp_clause_use_device_ptr, c_parser_omp_clause_is_device_ptr): New functions. (c_parser_omp_clause_ordered): Parse optional parameter. (c_parser_omp_clause_reduction): Handle array reductions. (c_parser_omp_clause_schedule): Parse optional simd modifier. (c_parser_omp_clause_nogroup, c_parser_omp_clause_orderedkind): New functions. (c_parser_omp_clause_linear): Parse linear clause modifiers. (c_parser_omp_clause_depend_sink): New function. (c_parser_omp_clause_depend): Parse source/sink depend kinds. (c_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (c_parser_oacc_all_clauses): Adjust c_parser_omp_clause_if and c_finish_omp_clauses callers. (c_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (c_parser_oacc_cache): Adjust c_finish_omp_clauses caller. (OMP_CRITICAL_CLAUSE_MASK): Define. (c_parser_omp_critical): Parse critical clauses. (c_parser_omp_for_loop): Handle doacross loops, adjust c_finish_omp_for and c_finish_omp_clauses callers. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (c_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (c_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (c_parser_omp_ordered): Add CONTEXT argument, remove LOC argument, parse clauses and if depend clause is found, don't parse a body. (c_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (c_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (c_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (c_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (c_parser_omp_declare_reduction): Use STRIP_NOPS when checking for &omp_priv. (OMP_TASKLOOP_CLAUSE_MASK): Define. (c_parser_omp_taskloop): New function. (c_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (c_parser_cilk_for): Adjust c_finish_omp_clauses callers. * c-tree.h (c_finish_omp_clauses): Add two new arguments. * c-typeck.c (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (c_finish_omp_clauses): Add IS_OMP and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones. gcc/cp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * class.c (finish_struct_1): Call finish_omp_declare_simd_methods. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_TASKLOOP. (cp_genericize_r): Likewise. (cxx_omp_finish_clause): Don't diagnose references. (cxx_omp_disregard_value_expr): New function. * cp-objcp-common.h (LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR): Redefine. * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Document for OMP_TASKLOOP. (DECL_OMP_PRIVATIZED_MEMBER): Define. (finish_omp_declare_simd_methods, push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses, omp_privatize_field, cxx_omp_disregard_value_expr): New prototypes. (finish_omp_clauses): Add two new arguments. (finish_omp_for): Add ORIG_DECLV argument. * parser.c (cp_parser_lambda_body): Call save_omp_privatization_clauses and restore_omp_privatization_clauses. (cp_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (cp_parser_omp_var_list_no_open): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Parse this keyword. Formatting fixes. (cp_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority, cp_parser_omp_clause_hint, cp_parser_omp_clause_defaultmap): New functions. (cp_parser_omp_clause_ordered): Parse optional parameter. (cp_parser_omp_clause_reduction): Handle array reductions. (cp_parser_omp_clause_schedule): Parse optional simd modifier. (cp_parser_omp_clause_nogroup, cp_parser_omp_clause_orderedkind): New functions. (cp_parser_omp_clause_linear): Parse linear clause modifiers. (cp_parser_omp_clause_depend_sink): New function. (cp_parser_omp_clause_depend): Parse source/sink depend kinds. (cp_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_if and finish_omp_clauses callers. (cp_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (OMP_CRITICAL_CLAUSE_MASK): Define. (cp_parser_omp_critical): Parse critical clauses. (cp_parser_omp_for_incr): Use cp_tree_equal if processing_template_decl. (cp_parser_omp_for_loop_init): Return tree instead of bool. Handle non-static data member iterators. (cp_parser_omp_for_loop): Handle doacross loops, adjust finish_omp_for and finish_omp_clauses callers. (cp_omp_split_clauses): Adjust finish_omp_clauses caller. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (cp_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (cp_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (cp_parser_omp_ordered): Add CONTEXT argument, return bool instead of tree, parse clauses and if depend clause is found, don't parse a body. (cp_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (cp_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (cp_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (cp_parser_oacc_cache): Adjust finish_omp_clauses caller. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (cp_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (OMP_TASKLOOP_CLAUSE_MASK): Define. (cp_parser_omp_taskloop): New function. (cp_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (cp_parser_pragma): Handle PRAGMA_OMP_ORDERED here directly, handle PRAGMA_OMP_TASKLOOP, call push_omp_privatization_clauses and pop_omp_privatization_clauses around parsing calls. (cp_parser_cilk_for): Adjust finish_omp_clauses caller. * pt.c (apply_late_template_attributes): Adjust tsubst_omp_clauses and finish_omp_clauses callers. (tsubst_omp_clause_decl): Return NULL if decl is NULL. For TREE_LIST, copy over OMP_CLAUSE_DEPEND_SINK_NEGATIVE bit. Use tsubst_expr instead of tsubst_copy, undo convert_from_reference effects. (tsubst_omp_clauses): Add ALLOW_FIELDS argument. Handle new OpenMP 4.5 clauses. Use tsubst_omp_clause_decl for more clauses. If ALLOW_FIELDS, handle non-static data members in the clauses. Clear OMP_CLAUSE_LINEAR_STEP if it has been cleared before. (omp_parallel_combined_clauses): New variable. (tsubst_omp_for_iterator): Add ORIG_DECLV argument, recur on OMP_FOR_ORIG_DECLS, handle non-static data member iterators. Improve handling of clauses on combined constructs. (tsubst_expr): Call push_omp_privatization_clauses and pop_omp_privatization_clauses around instantiation of certain OpenMP constructs, improve handling of clauses on combined constructs, handle OMP_TASKLOOP, adjust tsubst_omp_for_iterator, tsubst_omp_clauses and finish_omp_for callers, handle clauses on critical and ordered, handle OMP_TARGET_{ENTER,EXIT}_DATA. (instantiate_decl): Call save_omp_privatization_clauses and restore_omp_privatization_clauses around instantiation. (dependent_omp_for_p): Fix up comment typo. Handle SCOPE_REF. * semantics.c (omp_private_member_map, omp_private_member_vec, omp_private_member_ignore_next): New variables. (finish_non_static_data_member): Return dummy decl for privatized non-static data members. (omp_clause_decl_field, omp_clause_printable_decl, omp_note_field_privatization, omp_privatize_field): New functions. (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (finish_omp_reduction_clause): Handle array sections and arrays. Use omp_clause_printable_decl. (finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink): New functions. (finish_omp_clauses): Add ALLOW_FIELDS and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones, handle non-static data members, reject this keyword when not allowed. (push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses): New functions. (handle_omp_for_class_iterator): Handle OMP_TASKLOOP class iterators. Add collapse and ordered arguments. Fix handling of lastprivate iterators in doacross loops. (finish_omp_for): Add ORIG_DECLV argument, handle doacross loops, adjust c_finish_omp_for, handle_omp_for_class_iterator and finish_omp_clauses callers. Fill in OMP_CLAUSE_LINEAR_STEP on simd loops with non-static data member iterators. gcc/fortran/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * f95-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11, DEF_FUNCTION_TYPE_VAR_1): Define. * trans-openmp.c (gfc_trans_omp_clauses): Set OMP_CLAUSE_IF_MODIFIER to ERROR_MARK, OMP_CLAUSE_ORDERED_EXPR to NULL. (gfc_trans_omp_critical): Adjust for addition of clauses. (gfc_trans_omp_ordered): Likewise. * types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. gcc/lto/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * lto-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/jit/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/ada/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * gcc-interface/utils.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/testsuite/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-c++-common/gomp/cancel-1.c (f2): Add map clause to target data. * c-c++-common/gomp/clauses-1.c: New test. * c-c++-common/gomp/clauses-2.c: New test. * c-c++-common/gomp/clauses-3.c: New test. * c-c++-common/gomp/clauses-4.c: New test. * c-c++-common/gomp/declare-target-1.c: New test. * c-c++-common/gomp/declare-target-2.c: New test. * c-c++-common/gomp/depend-3.c: New test. * c-c++-common/gomp/depend-4.c: New test. * c-c++-common/gomp/doacross-1.c: New test. * c-c++-common/gomp/if-1.c: New test. * c-c++-common/gomp/if-2.c: New test. * c-c++-common/gomp/linear-1.c: New test. * c-c++-common/gomp/map-2.c: New test. * c-c++-common/gomp/map-3.c: New test. * c-c++-common/gomp/nesting-1.c (f_omp_parallel, f_omp_target_data): Add map clause to target data. * c-c++-common/gomp/nesting-warn-1.c (f_omp_target): Likewise. * c-c++-common/gomp/ordered-1.c: New test. * c-c++-common/gomp/ordered-2.c: New test. * c-c++-common/gomp/ordered-3.c: New test. * c-c++-common/gomp/pr61486-1.c (foo): Remove linear clause on non-iterator. * c-c++-common/gomp/pr61486-2.c (test, test2): Remove ordered clause and ordered construct where no longer allowed. * c-c++-common/gomp/priority-1.c: New test. * c-c++-common/gomp/reduction-1.c: New test. * c-c++-common/gomp/schedule-simd-1.c: New test. * c-c++-common/gomp/sink-1.c: New test. * c-c++-common/gomp/sink-2.c: New test. * c-c++-common/gomp/sink-3.c: New test. * c-c++-common/gomp/sink-4.c: New test. * c-c++-common/gomp/udr-1.c: New test. * c-c++-common/taskloop-1.c: New test. * c-c++-common/cpp/openmp-define-3.c: Adjust for the new value of _OPENMP macro. * c-c++-common/cilk-plus/PS/body.c (foo): Adjust expected diagnostics. * c-c++-common/goacc-gomp/nesting-fail-1.c (f_acc_parallel, f_acc_kernels, f_acc_data, f_acc_loop): Add map clause to target data. * gcc.dg/gomp/clause-1.c: * gcc.dg/gomp/reduction-1.c: New test. * gcc.dg/gomp/sink-fold-1.c: New test. * gcc.dg/gomp/sink-fold-2.c: New test. * gcc.dg/gomp/sink-fold-3.c: New test. * gcc.dg/vect/vect-simd-clone-15.c: New test. * g++.dg/gomp/clause-1.C (T::test): Remove dg-error on privatization of non-static data members. * g++.dg/gomp/clause-3.C (foo): Remove one dg-error directive. Add some linear clause tests. * g++.dg/gomp/declare-simd-3.C: New test. * g++.dg/gomp/linear-1.C: New test. * g++.dg/gomp/member-1.C: New test. * g++.dg/gomp/member-2.C: New test. * g++.dg/gomp/pr66571-2.C: New test. * g++.dg/gomp/pr67504.C (foo): Add test for ordered clause with dependent argument. * g++.dg/gomp/pr67522.C (foo): Add test for invalid array section in reduction clause. * g++.dg/gomp/reference-1.C: New test. * g++.dg/gomp/sink-1.C: New test. * g++.dg/gomp/sink-2.C: New test. * g++.dg/gomp/sink-3.C: New test. * g++.dg/gomp/task-1.C: Remove both dg-error directives. * g++.dg/gomp/this-1.C: New test. * g++.dg/gomp/this-2.C: New test. * g++.dg/vect/simd-clone-2.cc: New test. * g++.dg/vect/simd-clone-2.h: New test. * g++.dg/vect/simd-clone-3.cc: New test. * g++.dg/vect/simd-clone-4.cc: New test. * g++.dg/vect/simd-clone-4.h: New test. * g++.dg/vect/simd-clone-5.cc: New test. include/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define. (enum gomp_map_kind): Add GOMP_MAP_FIRSTPRIVATE, GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_DELETE, GOMP_MAP_RELEASE, GOMP_MAP_FIRSTPRIVATE_POINTER. (GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Define. (GOMP_TASK_FLAG_UNTIED, GOMP_TASK_FLAG_FINAL, GOMP_TASK_FLAG_MERGEABLE, GOMP_TASK_FLAG_DEPEND, GOMP_TASK_FLAG_PRIORITY, GOMP_TASK_FLAG_UP, GOMP_TASK_FLAG_GRAINSIZE, GOMP_TASK_FLAG_IF, GOMP_TASK_FLAG_NOGROUP, GOMP_TARGET_FLAG_NOWAIT, GOMP_TARGET_FLAG_EXIT_DATA, GOMP_TARGET_FLAG_UPDATE): Define. libgomp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * config/linux/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/linux/doacross.h: New file. * config/posix/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/posix/doacross.h: New file. * env.c: Include gomp-constants.h. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (gomp_max_task_priority_var): New variable. (parse_schedule): Rename run_sched_modifier to run_sched_chunk_size. (handle_omp_display_env): Change _OPENMP value from 201307 to 201511. Print OMP_MAX_TASK_PRIORITY. (initialize_env): Parse OMP_MAX_TASK_PRIORITY. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size and run_sched_modifier to run_sched_chunk_size. (omp_get_max_task_priority, omp_get_initial_device, omp_get_num_places, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums): New functions. * fortran.c (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_): Rename modifier argument to chunk_size. (omp_get_num_places_, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num_, omp_get_partition_num_places_, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device_, omp_get_max_task_priority_): New functions. * libgomp_g.h (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_doacross_ull_post, GOMP_doacross_wait, GOMP_taskloop, GOMP_taskloop_ull, GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data): New prototypes. (GOMP_task): Add prototype argument. * libgomp.h (_LIBGOMP_CHECKING_): Define to 0 if not yet defined. (struct gomp_doacross_work_share): New type. (struct gomp_work_share): Add doacross field. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (enum gomp_task_kind): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. Add comments. (struct gomp_task_depend_entry): Add comments. (struct gomp_task): Likewise. (struct gomp_taskgroup): Likewise. (struct gomp_target_task): New type. (struct gomp_team): Add comment. (gomp_get_place_proc_ids_8, gomp_doacross_init, gomp_doacross_ull_init, gomp_task_maybe_wait_for_dependencies, gomp_create_target_task, gomp_target_task_fn): New prototypes. (struct target_var_desc): New type. (struct target_mem_desc): Adjust comment. Use struct target_var_desc instead of splay_tree_key for list. (REFCOUNT_INFINITY): Define. (struct splay_tree_key_s): Remove copy_from field. (struct gomp_device_descr): Add dev2dev_func field. (enum gomp_map_vars_kind): New enum. (gomp_map_vars): Add one argument. * libgomp.map (OMP_4.5): Export omp_get_max_task_priority, omp_get_max_task_priority_, omp_get_num_places, omp_get_num_places_, omp_get_place_num_procs, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num, omp_get_place_num_, omp_get_partition_num_places, omp_get_partition_num_places_, omp_get_partition_place_nums, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device, omp_get_initial_device_, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr and omp_target_disassociate_ptr. (GOMP_4.0.2): Renamed to ... (GOMP_4.5): ... this. Export GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data, GOMP_taskloop, GOMP_taskloop_ull, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_doacross_static_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_doacross_ull_post and GOMP_doacross_ull_wait. * libgomp.texi: Document omp_get_max_task_priority. Rename modifier argument to chunk_size for omp_set_schedule and omp_get_schedule. Document OMP_MAX_TASK_PRIORITY env var. * loop.c (GOMP_loop_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ordered_runtime_start): Likewise. (gomp_loop_doacross_static_start, gomp_loop_doacross_dynamic_start, gomp_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_parallel_loop_runtime_start): New functions. (GOMP_parallel_loop_runtime): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start): New functions or aliases. * loop_ull.c (GOMP_loop_ull_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ull_ordered_runtime_start): Likewise. (gomp_loop_ull_doacross_static_start, gomp_loop_ull_doacross_dynamic_start, gomp_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start): New functions. (GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start): New functions or aliases. * oacc-mem.c (acc_map_data, present_create_copy, gomp_acc_insert_pointer): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (gomp_acc_remove_pointer): Use copy_from from target_var_desc. * oacc-parallel.c (GOACC_data_start): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (GOACC_parallel_keyed): Likewise. Use copy_from from target_var_desc. * omp.h.in (omp_lock_hint_t): New type. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr): New prototypes. * omp_lib.f90.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New interfaces. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size. * omp_lib.h.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New functions and subroutines. * ordered.c: Include stdarg.h and string.h. (MAX_COLLAPSED_BITS): Define. (gomp_doacross_init, GOMP_doacross_post, GOMP_doacross_wait, gomp_doacross_ull_init, GOMP_doacross_ull_post, GOMP_doacross_ull_wait): New functions. * target.c: Include errno.h. (resolve_device): If device is not initialized, call gomp_init_device on it. (gomp_map_lookup): New function. (gomp_map_vars_existing): Add tgt_var argument, fill it in. Don't bump refcount if REFCOUNT_INFINITY. Handle GOMP_MAP_ALWAYS_TO_P. (get_kind): Rename is_openacc argument to short_mapkind. (gomp_map_pointer): Use gomp_map_lookup. (gomp_map_fields_existing): New function. (gomp_map_vars): Rename is_openacc argument to short_mapkind and is_target to pragma_kind. Handle GOMP_MAP_VARS_ENTER_DATA, handle GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_STRUCT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION. Adjust for tgt->list changed type and copy_from living in there. (gomp_copy_from_async): Adjust for tgt->list changed type and copy_from living in there. (gomp_unmap_vars): Likewise. (gomp_update): Likewise. Rename is_openacc argument to short_mapkind. Don't fail if object is not mapped. (gomp_load_image_to_device): Initialize refcount to REFCOUNT_INFINITY. (gomp_target_fallback): New function. (gomp_get_target_fn_addr): Likewise. (GOMP_target): Adjust gomp_map_vars caller, use gomp_get_target_fn_addr and gomp_target_fallback. (GOMP_target_41): New function. (gomp_target_data_fallback): New function. (GOMP_target_data): Use it, adjust gomp_map_vars caller. (GOMP_target_data_41): New function. (GOMP_target_update): Adjust gomp_update caller. (GOMP_target_update_41): New function. (gomp_exit_data, GOMP_target_enter_exit_data, gomp_target_task_fn, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect_worker, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr, gomp_load_plugin_for_device): New functions. * task.c: Include gomp-constants.h. Include taskloop.c twice to get GOMP_taskloop and GOMP_taskloop_ull definitions. (gomp_task_handle_depend): New function. (GOMP_task): Use it. Add priority argument. Use gomp-constant.h constants instead of hardcoded numbers. Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (gomp_create_target_task): New function. (verify_children_queue, verify_taskgroup_queue, verify_task_queue): New functions. (gomp_task_run_pre): Call verify_*_queue functions. If an upcoming tied task is about to leave the sibling or taskgroup queues in an invalid state, adjust appropriately. Remove taskgroup argument. Add comments. (gomp_task_run_post_handle_dependers): Add comments. (gomp_task_run_post_remove_parent): Likewise. (gomp_barrier_handle_tasks): Adjust gomp_task_run_pre caller. (GOMP_taskwait): Likewise. Add comments. (gomp_task_maybe_wait_for_dependencies): Fix scheduling problem such that the first non parent_depends_on task does not end up at the end of the children queue. (GOMP_taskgroup_start): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (GOMP_taskgroup_end): Adjust gomp_task_run_pre caller. * taskloop.c: New file. * testsuite/lib/libgomp.exp (check_effective_target_offload_device_nonshared_as): New proc. * testsuite/libgomp.c/affinity-2.c: New test. * testsuite/libgomp.c/doacross-1.c: New test. * testsuite/libgomp.c/doacross-2.c: New test. * testsuite/libgomp.c/examples-4/declare_target-1.c (fib_wrapper): Add map clause to target. * testsuite/libgomp.c/examples-4/declare_target-4.c (accum): Likewise. * testsuite/libgomp.c/examples-4/declare_target-5.c (accum): Likewise. * testsuite/libgomp.c/examples-4/device-1.c (main): Likewise. * testsuite/libgomp.c/examples-4/device-3.c (main): Likewise. * testsuite/libgomp.c/examples-4/target_data-3.c (gramSchmidt): Likewise. * testsuite/libgomp.c/examples-4/teams-2.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-3.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-4.c (dotprod): Likewise. * testsuite/libgomp.c/for-2.h (OMPTGT, OMPTO, OMPFROM): Define if not defined. Use those where needed. * testsuite/libgomp.c/for-4.c: New test. * testsuite/libgomp.c/for-5.c: New test. * testsuite/libgomp.c/for-6.c: New test. * testsuite/libgomp.c/linear-1.c: New test. * testsuite/libgomp.c/ordered-4.c: New test. * testsuite/libgomp.c/pr66199-2.c (f2): Adjust for linear clause only allowed on the loop iterator. * testsuite/libgomp.c/pr66199-3.c: New test. * testsuite/libgomp.c/pr66199-4.c: New test. * testsuite/libgomp.c/reduction-7.c: New test. * testsuite/libgomp.c/reduction-8.c: New test. * testsuite/libgomp.c/reduction-9.c: New test. * testsuite/libgomp.c/reduction-10.c: New test. * testsuite/libgomp.c/target-1.c (fn2, fn3, fn4): Add map(tofrom:s). * testsuite/libgomp.c/target-2.c (fn2, fn3, fn4): Likewise. * testsuite/libgomp.c/target-7.c (foo): Add map(h) where needed. * testsuite/libgomp.c/target-11.c: New test. * testsuite/libgomp.c/target-12.c: New test. * testsuite/libgomp.c/target-13.c: New test. * testsuite/libgomp.c/target-14.c: New test. * testsuite/libgomp.c/target-15.c: New test. * testsuite/libgomp.c/target-16.c: New test. * testsuite/libgomp.c/target-17.c: New test. * testsuite/libgomp.c/target-18.c: New test. * testsuite/libgomp.c/target-19.c: New test. * testsuite/libgomp.c/target-20.c: New test. * testsuite/libgomp.c/target-21.c: New test. * testsuite/libgomp.c/target-22.c: New test. * testsuite/libgomp.c/target-23.c: New test. * testsuite/libgomp.c/target-24.c: New test. * testsuite/libgomp.c/target-25.c: New test. * testsuite/libgomp.c/target-26.c: New test. * testsuite/libgomp.c/target-27.c: New test. * testsuite/libgomp.c/taskloop-1.c: New test. * testsuite/libgomp.c/taskloop-2.c: New test. * testsuite/libgomp.c/taskloop-3.c: New test. * testsuite/libgomp.c/taskloop-4.c: New test. * testsuite/libgomp.c++/ctor-13.C: New test. * testsuite/libgomp.c++/doacross-1.C: New test. * testsuite/libgomp.c++/examples-4/declare_target-2.C: Replace offload_device with offload_device_nonshared_as. * testsuite/libgomp.c++/for-12.C: New test. * testsuite/libgomp.c++/for-13.C: New test. * testsuite/libgomp.c++/for-14.C: New test. * testsuite/libgomp.c++/linear-1.C: New test. * testsuite/libgomp.c++/member-1.C: New test. * testsuite/libgomp.c++/member-2.C: New test. * testsuite/libgomp.c++/member-3.C: New test. * testsuite/libgomp.c++/member-4.C: New test. * testsuite/libgomp.c++/member-5.C: New test. * testsuite/libgomp.c++/ordered-1.C: New test. * testsuite/libgomp.c++/reduction-5.C: New test. * testsuite/libgomp.c++/reduction-6.C: New test. * testsuite/libgomp.c++/reduction-7.C: New test. * testsuite/libgomp.c++/reduction-8.C: New test. * testsuite/libgomp.c++/reduction-9.C: New test. * testsuite/libgomp.c++/reduction-10.C: New test. * testsuite/libgomp.c++/reference-1.C: New test. * testsuite/libgomp.c++/simd14.C: New test. * testsuite/libgomp.c++/target-2.C (fn2): Add map(tofrom: s) clause. * testsuite/libgomp.c++/target-5.C: New test. * testsuite/libgomp.c++/target-6.C: New test. * testsuite/libgomp.c++/target-7.C: New test. * testsuite/libgomp.c++/target-8.C: New test. * testsuite/libgomp.c++/target-9.C: New test. * testsuite/libgomp.c++/target-10.C: New test. * testsuite/libgomp.c++/target-11.C: New test. * testsuite/libgomp.c++/target-12.C: New test. * testsuite/libgomp.c++/taskloop-1.C: New test. * testsuite/libgomp.c++/taskloop-2.C: New test. * testsuite/libgomp.c++/taskloop-3.C: New test. * testsuite/libgomp.c++/taskloop-4.C: New test. * testsuite/libgomp.c++/taskloop-5.C: New test. * testsuite/libgomp.c++/taskloop-6.C: New test. * testsuite/libgomp.c++/taskloop-7.C: New test. * testsuite/libgomp.c++/taskloop-8.C: New test. * testsuite/libgomp.c++/taskloop-9.C: New test. * testsuite/libgomp.fortran/affinity1.f90: New test. * testsuite/libgomp.fortran/affinity2.f90: New test. liboffloadmic/ 2015-10-13 Ilya Verbin <ilya.verbin@intel.com> * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New function. * plugin/offload_target_main.cpp (__offload_target_tgt2tgt): New static function, register it in liboffloadmic. From-SVN: r228777
2015-10-13 21:06:23 +02:00
/* True for artificial decls added for OpenMP privatized non-static
data members. */
#define DECL_OMP_PRIVATIZED_MEMBER(NODE) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.anticipated_p)
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
/* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend
within a class but has not been declared in the surrounding scope.
The function is invisible except via argument dependent lookup. */
#define DECL_HIDDEN_FRIEND_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->hidden_friend_p)
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
/* Nonzero if NODE is an artificial FUNCTION_DECL for
#pragma omp declare reduction. */
#define DECL_OMP_DECLARE_REDUCTION_P(NODE) \
(LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->omp_declare_reduction_p)
/* Nonzero if DECL has been declared threadprivate by
#pragma omp threadprivate. */
#define CP_DECL_THREADPRIVATE_P(DECL) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->u.base.threadprivate_or_deleted_p)
Implement P0386R2 - C++17 inline variables 2016-10-11 Jakub Jelinek <jakub@redhat.com> * dwarf2out.c (gen_member_die): Handle inline static data member definitions. c-family/ * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_inline_variables. cp/ * cp-tree.h (struct lang_type): Shrink language field to 1 bit from 4. Add var_declared_inline_p field. Mention 2 spare bits. (DECL_VAR_DECLARED_INLINE_P): Define. (SET_DECL_VAR_DECLARED_INLINE_P): Define. (DECL_INLINE_VAR_P): Define. (diagnose_inline_vars_for_namespace): Declare. * decl.c (diagnose_inline_vars_for_namespace): New function. (duplicate_decls): For static data members copy DECL_DECLARED_CONSTEXPR_P. (redeclaration_error_message): Handle C++17 redundant redeclaration of constexpr static data member outside of class. (maybe_commonize_var): Handle inline variables. (check_initializer): Ignore inline variables for diagnostics. Adjust diagnostic wording for C++17. (make_rtl_for_nonlocal_decl): Allow in-class definition of inline static data members. (bad_specifiers): Don't diagnose inline on variables here. (grokvardecl): Add inlinep argument, non-static const inline variables are TREE_PUBLIC. (check_static_variable_definition): Return early also for inline variables. (grokdeclarator): Handle inline variables and inline static data members. * typeck2.c (store_init_value): Don't diagnose non-constant initializers for non-constexpr inline static data members. * decl2.c (vague_linkage_p): Return true for inline variables. (c_parse_final_cleanups): In-class declaration of inline static data members is a definition. Call diagnose_inline_vars_for_namespace through walk_namespaces. * pt.c (instantiate_decl): Set pattern_defined for in-class definitions of inline static data members. From-SVN: r241137
2016-10-13 21:26:54 +02:00
/* Nonzero if NODE is a VAR_DECL which has been declared inline. */
#define DECL_VAR_DECLARED_INLINE_P(NODE) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \
? DECL_LANG_SPECIFIC (NODE)->u.base.var_declared_inline_p \
: false)
#define SET_DECL_VAR_DECLARED_INLINE_P(NODE) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.var_declared_inline_p \
= true)
/* Nonzero if NODE is an artificial VAR_DECL for a C++17 decomposition
Implement P0217R3 - C++17 structured bindings gcc/ * match.pd: Don't try to compare addresses of variables with DECL_VALUE_EXPR. gcc/cp/ * cp-tree.h (struct lang_decl_base): Add decomposition_p. (DECL_DECOMPOSITION_P): New (enum auto_deduction_context): Add adc_decomp_type. (enum cp_declarator_kind): Add cdk_decomp. * constexpr.c (cxx_eval_constant_expression): Look through DECL_VALUE_EXPR. (potential_constant_expression_1): Likewise. * decl.c (reshape_init): Preserve CONSTRUCTOR_IS_DIRECT_INIT. (check_initializer): Use build_aggr_init for DECL_DECOMPOSITION_P. (cp_finish_decl): Pass adc_decomp_type for decomposition. (find_decomp_class_base, get_tuple_size, get_tuple_element_type) (get_tuple_decomp_init, cp_finish_decomp): New. (grokdeclarator): Handle decomposition. * init.c (build_aggr_init): Handle decomposition array. (build_vec_init): Handle initialization from { array }. * name-lookup.c (add_function): Always wrap TEMPLATE_DECL in OVERLOAD. * parser.c (declarator_can_be_parameter_pack): Handle cdk_decomp. (function_declarator_p, strip_declarator_types) (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_range_for, cp_convert_range_for): Handle decomposition. (cp_parser_simple_declaration): Parse decomposition. (cp_parser_decomposition_declaration): New. * pt.c (tsubst_decomp_names): New. (subst_expr) [DECL_EXPR, RANGE_FOR_STMT]: Handle decomposition. (do_auto_deduction): Handle adc_decomp_type. * semantics.c (finish_decltype_type): Look through DECL_VALUE_EXPR. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. * tree.c (lvalue_kind): Likewise. (cp_build_reference_type): Handle reference collapsing. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r242377
2016-11-14 06:02:58 +01:00
declaration. */
#define DECL_DECOMPOSITION_P(NODE) \
(VAR_P (NODE) && DECL_LANG_SPECIFIC (NODE) \
Implement P0217R3 - C++17 structured bindings gcc/ * match.pd: Don't try to compare addresses of variables with DECL_VALUE_EXPR. gcc/cp/ * cp-tree.h (struct lang_decl_base): Add decomposition_p. (DECL_DECOMPOSITION_P): New (enum auto_deduction_context): Add adc_decomp_type. (enum cp_declarator_kind): Add cdk_decomp. * constexpr.c (cxx_eval_constant_expression): Look through DECL_VALUE_EXPR. (potential_constant_expression_1): Likewise. * decl.c (reshape_init): Preserve CONSTRUCTOR_IS_DIRECT_INIT. (check_initializer): Use build_aggr_init for DECL_DECOMPOSITION_P. (cp_finish_decl): Pass adc_decomp_type for decomposition. (find_decomp_class_base, get_tuple_size, get_tuple_element_type) (get_tuple_decomp_init, cp_finish_decomp): New. (grokdeclarator): Handle decomposition. * init.c (build_aggr_init): Handle decomposition array. (build_vec_init): Handle initialization from { array }. * name-lookup.c (add_function): Always wrap TEMPLATE_DECL in OVERLOAD. * parser.c (declarator_can_be_parameter_pack): Handle cdk_decomp. (function_declarator_p, strip_declarator_types) (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_range_for, cp_convert_range_for): Handle decomposition. (cp_parser_simple_declaration): Parse decomposition. (cp_parser_decomposition_declaration): New. * pt.c (tsubst_decomp_names): New. (subst_expr) [DECL_EXPR, RANGE_FOR_STMT]: Handle decomposition. (do_auto_deduction): Handle adc_decomp_type. * semantics.c (finish_decltype_type): Look through DECL_VALUE_EXPR. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. * tree.c (lvalue_kind): Likewise. (cp_build_reference_type): Handle reference collapsing. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r242377
2016-11-14 06:02:58 +01:00
? DECL_LANG_SPECIFIC (NODE)->u.base.decomposition_p \
: false)
#define SET_DECL_DECOMPOSITION_P(NODE) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.decomposition_p \
= true)
Implement P0386R2 - C++17 inline variables 2016-10-11 Jakub Jelinek <jakub@redhat.com> * dwarf2out.c (gen_member_die): Handle inline static data member definitions. c-family/ * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_inline_variables. cp/ * cp-tree.h (struct lang_type): Shrink language field to 1 bit from 4. Add var_declared_inline_p field. Mention 2 spare bits. (DECL_VAR_DECLARED_INLINE_P): Define. (SET_DECL_VAR_DECLARED_INLINE_P): Define. (DECL_INLINE_VAR_P): Define. (diagnose_inline_vars_for_namespace): Declare. * decl.c (diagnose_inline_vars_for_namespace): New function. (duplicate_decls): For static data members copy DECL_DECLARED_CONSTEXPR_P. (redeclaration_error_message): Handle C++17 redundant redeclaration of constexpr static data member outside of class. (maybe_commonize_var): Handle inline variables. (check_initializer): Ignore inline variables for diagnostics. Adjust diagnostic wording for C++17. (make_rtl_for_nonlocal_decl): Allow in-class definition of inline static data members. (bad_specifiers): Don't diagnose inline on variables here. (grokvardecl): Add inlinep argument, non-static const inline variables are TREE_PUBLIC. (check_static_variable_definition): Return early also for inline variables. (grokdeclarator): Handle inline variables and inline static data members. * typeck2.c (store_init_value): Don't diagnose non-constant initializers for non-constexpr inline static data members. * decl2.c (vague_linkage_p): Return true for inline variables. (c_parse_final_cleanups): In-class declaration of inline static data members is a definition. Call diagnose_inline_vars_for_namespace through walk_namespaces. * pt.c (instantiate_decl): Set pattern_defined for in-class definitions of inline static data members. From-SVN: r241137
2016-10-13 21:26:54 +02:00
/* Nonzero if NODE is an inline VAR_DECL. In C++17, static data members
declared with constexpr specifier are implicitly inline variables. */
#define DECL_INLINE_VAR_P(NODE) \
(DECL_VAR_DECLARED_INLINE_P (NODE) \
|| (cxx_dialect >= cxx1z \
&& DECL_DECLARED_CONSTEXPR_P (NODE) \
&& DECL_CLASS_SCOPE_P (NODE)))
/* Nonzero if DECL was declared with '= delete'. */
#define DECL_DELETED_FN(DECL) \
(LANG_DECL_FN_CHECK (DECL)->min.base.threadprivate_or_deleted_p)
/* Nonzero if DECL was declared with '= default' (maybe implicitly). */
#define DECL_DEFAULTED_FN(DECL) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (DECL)->defaulted_p)
/* Nonzero if DECL is explicitly defaulted in the class body. */
#define DECL_DEFAULTED_IN_CLASS_P(DECL) \
(DECL_DEFAULTED_FN (DECL) && DECL_INITIALIZED_IN_CLASS_P (DECL))
/* Nonzero if DECL was defaulted outside the class body. */
#define DECL_DEFAULTED_OUTSIDE_CLASS_P(DECL) \
(DECL_DEFAULTED_FN (DECL) \
&& !(DECL_ARTIFICIAL (DECL) || DECL_INITIALIZED_IN_CLASS_P (DECL)))
1994-02-24 02:02:37 +01:00
/* Record whether a typedef for type `int' was actually `signed int'. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
1994-02-24 02:02:37 +01:00
/* Returns nonzero if DECL has external linkage, as specified by the
language standard. (This predicate may hold even when the
corresponding entity is not actually given external linkage in the
object file; see decl_linkage for details.) */
#define DECL_EXTERNAL_LINKAGE_P(DECL) \
(decl_linkage (DECL) == lk_external)
/* Keep these codes in ascending code order. */
#define INTEGRAL_CODE_P(CODE) \
((CODE) == ENUMERAL_TYPE \
|| (CODE) == BOOLEAN_TYPE \
|| (CODE) == INTEGER_TYPE)
cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. * cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. (ARITHMETIC_TYPE_P): Adjust definition for standard conformance. (strip_top_quals): Declare. (ncp_convert): Likewise. (type_after_usual_arithmetic_converions): Likewise. (composite_pointer_type): Likewise. * call.c (strip_top_quals): Don't make it static. (promoted_arithmetic_type_p): New function. (conditional_conversion): Likewise. (null_ptr_cst_p): Allow `false' as a NULL pointer constant. (standard_conversion): Use same_type_p. Don't build BASE_CONVs for converting a type to itself. (reference_binding): Honor LOOKUP_NO_TEMP_BIND. (implicit_conversion): Make sure the from and to types are complete. (add_builtin_candidate): Correct handling of ?: operator. (add_builtin_candidates): Improve documentation. (build_conditional_expr): New function. (can_convert): Implement in terms of can_convert_arg. (ncp_convert): New function. * typeck.c (type_after_usual_arithmetic_conversions): New function, split out from common_type. (composite_pointer_type): New function, split out from build_conditional_expr. (common_type): Use type_after_usual_arithmetic_conversions. Remove redundant attribute merging. (comptypes): Tidy. Handle COMPLEX_TYPE. (build_binary_op_nodefault): Use null_ptr_cst_p. (build_conditional_expr): Remove. (convert_for_assignment): Use new conversion functions. * cp-tree.h (abstract_virtuals_error): Change declaration. * typeck2.c (abstract_virtuals_error): Check to see if an error ocurred, and return a boolean value accordingly. (build_functional_cast): Adjust accordingly. * class.c (finish_struct_1): Likewise. * cvt.c (ocp_convert): Likewise. * decl.c (cp_finish_decl): Likewise. (grokparams): Likewise. (grok_op_properties): Likewise. (start_function): Likewise. * init.c (build_new_1): Likewise. * pt.c (unify): Don't get confused by pointers-to-member functions. * search.c (build_cplus_new): Robustify. From-SVN: r28262
1999-07-26 10:18:19 +02:00
/* [basic.fundamental]
Types bool, char, wchar_t, and the signed and unsigned integer types
are collectively called integral types.
cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. * cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. (ARITHMETIC_TYPE_P): Adjust definition for standard conformance. (strip_top_quals): Declare. (ncp_convert): Likewise. (type_after_usual_arithmetic_converions): Likewise. (composite_pointer_type): Likewise. * call.c (strip_top_quals): Don't make it static. (promoted_arithmetic_type_p): New function. (conditional_conversion): Likewise. (null_ptr_cst_p): Allow `false' as a NULL pointer constant. (standard_conversion): Use same_type_p. Don't build BASE_CONVs for converting a type to itself. (reference_binding): Honor LOOKUP_NO_TEMP_BIND. (implicit_conversion): Make sure the from and to types are complete. (add_builtin_candidate): Correct handling of ?: operator. (add_builtin_candidates): Improve documentation. (build_conditional_expr): New function. (can_convert): Implement in terms of can_convert_arg. (ncp_convert): New function. * typeck.c (type_after_usual_arithmetic_conversions): New function, split out from common_type. (composite_pointer_type): New function, split out from build_conditional_expr. (common_type): Use type_after_usual_arithmetic_conversions. Remove redundant attribute merging. (comptypes): Tidy. Handle COMPLEX_TYPE. (build_binary_op_nodefault): Use null_ptr_cst_p. (build_conditional_expr): Remove. (convert_for_assignment): Use new conversion functions. * cp-tree.h (abstract_virtuals_error): Change declaration. * typeck2.c (abstract_virtuals_error): Check to see if an error ocurred, and return a boolean value accordingly. (build_functional_cast): Adjust accordingly. * class.c (finish_struct_1): Likewise. * cvt.c (ocp_convert): Likewise. * decl.c (cp_finish_decl): Likewise. (grokparams): Likewise. (grok_op_properties): Likewise. (start_function): Likewise. * init.c (build_new_1): Likewise. * pt.c (unify): Don't get confused by pointers-to-member functions. * search.c (build_cplus_new): Robustify. From-SVN: r28262
1999-07-26 10:18:19 +02:00
Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
types as well, which is incorrect in C++. Keep these checks in
ascending code order. */
#define CP_INTEGRAL_TYPE_P(TYPE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(TREE_CODE (TYPE) == BOOLEAN_TYPE \
|| TREE_CODE (TYPE) == INTEGER_TYPE)
cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. * cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. (ARITHMETIC_TYPE_P): Adjust definition for standard conformance. (strip_top_quals): Declare. (ncp_convert): Likewise. (type_after_usual_arithmetic_converions): Likewise. (composite_pointer_type): Likewise. * call.c (strip_top_quals): Don't make it static. (promoted_arithmetic_type_p): New function. (conditional_conversion): Likewise. (null_ptr_cst_p): Allow `false' as a NULL pointer constant. (standard_conversion): Use same_type_p. Don't build BASE_CONVs for converting a type to itself. (reference_binding): Honor LOOKUP_NO_TEMP_BIND. (implicit_conversion): Make sure the from and to types are complete. (add_builtin_candidate): Correct handling of ?: operator. (add_builtin_candidates): Improve documentation. (build_conditional_expr): New function. (can_convert): Implement in terms of can_convert_arg. (ncp_convert): New function. * typeck.c (type_after_usual_arithmetic_conversions): New function, split out from common_type. (composite_pointer_type): New function, split out from build_conditional_expr. (common_type): Use type_after_usual_arithmetic_conversions. Remove redundant attribute merging. (comptypes): Tidy. Handle COMPLEX_TYPE. (build_binary_op_nodefault): Use null_ptr_cst_p. (build_conditional_expr): Remove. (convert_for_assignment): Use new conversion functions. * cp-tree.h (abstract_virtuals_error): Change declaration. * typeck2.c (abstract_virtuals_error): Check to see if an error ocurred, and return a boolean value accordingly. (build_functional_cast): Adjust accordingly. * class.c (finish_struct_1): Likewise. * cvt.c (ocp_convert): Likewise. * decl.c (cp_finish_decl): Likewise. (grokparams): Likewise. (grok_op_properties): Likewise. (start_function): Likewise. * init.c (build_new_1): Likewise. * pt.c (unify): Don't get confused by pointers-to-member functions. * search.c (build_cplus_new): Robustify. From-SVN: r28262
1999-07-26 10:18:19 +02:00
/* Returns true if TYPE is an integral or enumeration name. Keep
these checks in ascending code order. */
c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__. * c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__. * call.c (build_field_call): Use build_new_op, not build_opfncall. (prep_operand): New function. (build_new_op): Use it. Remove dead code. * class.c (pushclass): Change "modify" parameter type from int to bool. (currently_open_class): Use same_type_p, not pointer equality. (push_nested_class): Adjust calls to pushclass, remove modify parameter. * cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro. (pushclass): Change prototype. (push_nested_class): Likewise. (grokoptypename): Remove. (build_opfncall): Remove. (value_dependent_expression_p): Declare. (resolve_typename_type): Likewise. (resolve_typename_type_in_current_instantiation): Likewise. (enter_scope_of): Remove. (tsubst): Remove. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. * decl.c (warn_about_implicit_typename_lookup): Remove. (finish_case_label): Return error_mark_node for erroneous labels. (start_decl): Adjust calls to push_nested_class. (grokfndecl): Call push_scope/pop_scope around call to duplicate_decls. (grokdeclarator): Do not call tsubst. (start_function): Adjust calls to push_nested_class. * decl2.c (grok_array_decl): Use build_new_op, not build_opfncall. (check_classfn): Use push_scope/pop_scope around type comparisions. (grokoptypename): Remove. (push_sscope): Adjust call to push_nested_class. * error.c (dump_type): Show cv-qualification of typename types. * init.c (build_member_call): Use build_new_op, not build_opfncall. * method.c (build_opfncall): Remove. * parser.c (cp_parser): Add allow_non_constant_expression_p and non_constant_expression_p. (cp_parser_constant_expression): Adjust prototype. (cp_parser_resolve_typename_type): Remove. (cp_parser_non_constant_expression): New function. (cp_parser_non_constant_id_expression): Likewise. (cp_parser_new): Set allow_non_constant_expression_p and non_constant_expression_p. (cp_parser_primary_expression): Reject `this' and `va_arg' in constant-expressions. Note that dependent names aren't really constant. (cp_parser_postfix_expression): Reject conversions to non-integral types in constant-expressions. Neither are increments or decrements. (cp_parser_unary_expression): Reject increments and decrements in constant-expressions. (cp_parser_direct_new_declarator): Adjust call to cp_parser_constant_expression. (cp_parser_cast_expression): Reject conversions to non-integral types in constant-expressions. (cp_parser_assignment_expression): Rejects assignments in constant-expressions. (cp_parser_expression): Reject commas in constant-expressions. (cp_parser_labeled_statement): Adjust call to cp_parser_constant_expression. (cp_parser_direct_declarator): Simplify array bounds, even in templates, when they are non-dependent. Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_class_head): Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_member_declaration): Adjust call to cp_parser_constant_expression. (cp_parser_constant_initializer): Likewise. (cp_parser_constructor_declarator): Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_late_parsing_default_args): Adjust call to push_nested_class. * pt.c (tsubst): Give it internal linkage. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. (push_access_scope_real): Likewise. (tsubst_friend_class): Likewise. (instantiate_class_template): Adjust call to pushclass. (value_dependent_expression_p): Give it external linkage. Robustify. (resolve_typename_type): New function. * semantics.c (finish_call_expr): Use build_new_op, not build_opfncall. (begin_constructor_declarator): Remove. (begin_class_definition): Adjust call to pushclass. (enter_scope_of): Remove. * typeck.c (comptypes): Resolve typename types as appropriate. (build_x_indirect_ref): Use build_new_op, not build_opfncall. (build_x_compound_expr): Likewise. (build_modify_expr): Likewise. (build_x_modify_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. * g++.dg/parser/constant1.C: New test. * include/std/std_limits.h (numeric_limits<float>::has_infinity): Use __FLT_HAS_INIFINITY__ to initialize. (numeric_limits<float>::has_quiet_NaN): Likewise. (numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__ to initialize. (numeric_limits<double>::has_quiet_NaN): Likewise. (numeric_limits<long double>::has_infinity): Use __LDBL_HAS_INIFINITY__ to initialize. (numeric_limits<long_double>::has_quiet_NaN): Likewise. From-SVN: r62130
2003-01-30 08:24:02 +01:00
#define INTEGRAL_OR_ENUMERATION_TYPE_P(TYPE) \
(TREE_CODE (TYPE) == ENUMERAL_TYPE || CP_INTEGRAL_TYPE_P (TYPE))
c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__. * c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__. * call.c (build_field_call): Use build_new_op, not build_opfncall. (prep_operand): New function. (build_new_op): Use it. Remove dead code. * class.c (pushclass): Change "modify" parameter type from int to bool. (currently_open_class): Use same_type_p, not pointer equality. (push_nested_class): Adjust calls to pushclass, remove modify parameter. * cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro. (pushclass): Change prototype. (push_nested_class): Likewise. (grokoptypename): Remove. (build_opfncall): Remove. (value_dependent_expression_p): Declare. (resolve_typename_type): Likewise. (resolve_typename_type_in_current_instantiation): Likewise. (enter_scope_of): Remove. (tsubst): Remove. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. * decl.c (warn_about_implicit_typename_lookup): Remove. (finish_case_label): Return error_mark_node for erroneous labels. (start_decl): Adjust calls to push_nested_class. (grokfndecl): Call push_scope/pop_scope around call to duplicate_decls. (grokdeclarator): Do not call tsubst. (start_function): Adjust calls to push_nested_class. * decl2.c (grok_array_decl): Use build_new_op, not build_opfncall. (check_classfn): Use push_scope/pop_scope around type comparisions. (grokoptypename): Remove. (push_sscope): Adjust call to push_nested_class. * error.c (dump_type): Show cv-qualification of typename types. * init.c (build_member_call): Use build_new_op, not build_opfncall. * method.c (build_opfncall): Remove. * parser.c (cp_parser): Add allow_non_constant_expression_p and non_constant_expression_p. (cp_parser_constant_expression): Adjust prototype. (cp_parser_resolve_typename_type): Remove. (cp_parser_non_constant_expression): New function. (cp_parser_non_constant_id_expression): Likewise. (cp_parser_new): Set allow_non_constant_expression_p and non_constant_expression_p. (cp_parser_primary_expression): Reject `this' and `va_arg' in constant-expressions. Note that dependent names aren't really constant. (cp_parser_postfix_expression): Reject conversions to non-integral types in constant-expressions. Neither are increments or decrements. (cp_parser_unary_expression): Reject increments and decrements in constant-expressions. (cp_parser_direct_new_declarator): Adjust call to cp_parser_constant_expression. (cp_parser_cast_expression): Reject conversions to non-integral types in constant-expressions. (cp_parser_assignment_expression): Rejects assignments in constant-expressions. (cp_parser_expression): Reject commas in constant-expressions. (cp_parser_labeled_statement): Adjust call to cp_parser_constant_expression. (cp_parser_direct_declarator): Simplify array bounds, even in templates, when they are non-dependent. Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_class_head): Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_member_declaration): Adjust call to cp_parser_constant_expression. (cp_parser_constant_initializer): Likewise. (cp_parser_constructor_declarator): Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_late_parsing_default_args): Adjust call to push_nested_class. * pt.c (tsubst): Give it internal linkage. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. (push_access_scope_real): Likewise. (tsubst_friend_class): Likewise. (instantiate_class_template): Adjust call to pushclass. (value_dependent_expression_p): Give it external linkage. Robustify. (resolve_typename_type): New function. * semantics.c (finish_call_expr): Use build_new_op, not build_opfncall. (begin_constructor_declarator): Remove. (begin_class_definition): Adjust call to pushclass. (enter_scope_of): Remove. * typeck.c (comptypes): Resolve typename types as appropriate. (build_x_indirect_ref): Use build_new_op, not build_opfncall. (build_x_compound_expr): Likewise. (build_modify_expr): Likewise. (build_x_modify_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. * g++.dg/parser/constant1.C: New test. * include/std/std_limits.h (numeric_limits<float>::has_infinity): Use __FLT_HAS_INIFINITY__ to initialize. (numeric_limits<float>::has_quiet_NaN): Likewise. (numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__ to initialize. (numeric_limits<double>::has_quiet_NaN): Likewise. (numeric_limits<long double>::has_infinity): Use __LDBL_HAS_INIFINITY__ to initialize. (numeric_limits<long_double>::has_quiet_NaN): Likewise. From-SVN: r62130
2003-01-30 08:24:02 +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
/* Returns true if TYPE is an integral or unscoped enumeration type. */
#define INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P(TYPE) \
(UNSCOPED_ENUM_P (TYPE) || CP_INTEGRAL_TYPE_P (TYPE))
/* True if the class type TYPE is a literal type. */
#define CLASSTYPE_LITERAL_P(TYPE) \
(LANG_TYPE_CLASS_CHECK (TYPE)->is_literal)
cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. * cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. (ARITHMETIC_TYPE_P): Adjust definition for standard conformance. (strip_top_quals): Declare. (ncp_convert): Likewise. (type_after_usual_arithmetic_converions): Likewise. (composite_pointer_type): Likewise. * call.c (strip_top_quals): Don't make it static. (promoted_arithmetic_type_p): New function. (conditional_conversion): Likewise. (null_ptr_cst_p): Allow `false' as a NULL pointer constant. (standard_conversion): Use same_type_p. Don't build BASE_CONVs for converting a type to itself. (reference_binding): Honor LOOKUP_NO_TEMP_BIND. (implicit_conversion): Make sure the from and to types are complete. (add_builtin_candidate): Correct handling of ?: operator. (add_builtin_candidates): Improve documentation. (build_conditional_expr): New function. (can_convert): Implement in terms of can_convert_arg. (ncp_convert): New function. * typeck.c (type_after_usual_arithmetic_conversions): New function, split out from common_type. (composite_pointer_type): New function, split out from build_conditional_expr. (common_type): Use type_after_usual_arithmetic_conversions. Remove redundant attribute merging. (comptypes): Tidy. Handle COMPLEX_TYPE. (build_binary_op_nodefault): Use null_ptr_cst_p. (build_conditional_expr): Remove. (convert_for_assignment): Use new conversion functions. * cp-tree.h (abstract_virtuals_error): Change declaration. * typeck2.c (abstract_virtuals_error): Check to see if an error ocurred, and return a boolean value accordingly. (build_functional_cast): Adjust accordingly. * class.c (finish_struct_1): Likewise. * cvt.c (ocp_convert): Likewise. * decl.c (cp_finish_decl): Likewise. (grokparams): Likewise. (grok_op_properties): Likewise. (start_function): Likewise. * init.c (build_new_1): Likewise. * pt.c (unify): Don't get confused by pointers-to-member functions. * search.c (build_cplus_new): Robustify. From-SVN: r28262
1999-07-26 10:18:19 +02:00
/* [basic.fundamental]
Integral and floating types are collectively called arithmetic
types.
As a GNU extension, we also accept complex types.
Keep these checks in ascending code order. */
cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. * cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. (ARITHMETIC_TYPE_P): Adjust definition for standard conformance. (strip_top_quals): Declare. (ncp_convert): Likewise. (type_after_usual_arithmetic_converions): Likewise. (composite_pointer_type): Likewise. * call.c (strip_top_quals): Don't make it static. (promoted_arithmetic_type_p): New function. (conditional_conversion): Likewise. (null_ptr_cst_p): Allow `false' as a NULL pointer constant. (standard_conversion): Use same_type_p. Don't build BASE_CONVs for converting a type to itself. (reference_binding): Honor LOOKUP_NO_TEMP_BIND. (implicit_conversion): Make sure the from and to types are complete. (add_builtin_candidate): Correct handling of ?: operator. (add_builtin_candidates): Improve documentation. (build_conditional_expr): New function. (can_convert): Implement in terms of can_convert_arg. (ncp_convert): New function. * typeck.c (type_after_usual_arithmetic_conversions): New function, split out from common_type. (composite_pointer_type): New function, split out from build_conditional_expr. (common_type): Use type_after_usual_arithmetic_conversions. Remove redundant attribute merging. (comptypes): Tidy. Handle COMPLEX_TYPE. (build_binary_op_nodefault): Use null_ptr_cst_p. (build_conditional_expr): Remove. (convert_for_assignment): Use new conversion functions. * cp-tree.h (abstract_virtuals_error): Change declaration. * typeck2.c (abstract_virtuals_error): Check to see if an error ocurred, and return a boolean value accordingly. (build_functional_cast): Adjust accordingly. * class.c (finish_struct_1): Likewise. * cvt.c (ocp_convert): Likewise. * decl.c (cp_finish_decl): Likewise. (grokparams): Likewise. (grok_op_properties): Likewise. (start_function): Likewise. * init.c (build_new_1): Likewise. * pt.c (unify): Don't get confused by pointers-to-member functions. * search.c (build_cplus_new): Robustify. From-SVN: r28262
1999-07-26 10:18:19 +02:00
#define ARITHMETIC_TYPE_P(TYPE) \
(CP_INTEGRAL_TYPE_P (TYPE) \
|| TREE_CODE (TYPE) == REAL_TYPE \
|| TREE_CODE (TYPE) == COMPLEX_TYPE)
/* True iff TYPE is cv decltype(nullptr). */
#define NULLPTR_TYPE_P(TYPE) (TREE_CODE (TYPE) == NULLPTR_TYPE)
/* [basic.types]
Arithmetic types, enumeration types, pointer types,
pointer-to-member types, and std::nullptr_t are collectively called
scalar types.
Keep these checks in ascending code order. */
#define SCALAR_TYPE_P(TYPE) \
(TYPE_PTRDATAMEM_P (TYPE) \
|| TREE_CODE (TYPE) == ENUMERAL_TYPE \
|| ARITHMETIC_TYPE_P (TYPE) \
|| TYPE_PTR_P (TYPE) \
|| TYPE_PTRMEMFUNC_P (TYPE) \
|| NULLPTR_TYPE_P (TYPE))
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
/* Determines whether this type is a C++0x scoped enumeration
type. Scoped enumerations types are introduced via "enum class" or
"enum struct", e.g.,
enum class Color {
Red, Green, Blue
};
Scoped enumeration types are different from normal (unscoped)
enumeration types in several ways:
- The enumerators of a scoped enumeration type are only available
within the scope of the enumeration type and not in the
enclosing scope. For example, the Red color can be referred to
with "Color::Red" but not "Red".
- Scoped enumerators and enumerations do not implicitly convert
to integers or 'bool'.
- The underlying type of the enum is well-defined. */
#define SCOPED_ENUM_P(TYPE) \
(TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_SCOPED (TYPE))
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
/* Determine whether this is an unscoped enumeration type. */
#define UNSCOPED_ENUM_P(TYPE) \
(TREE_CODE (TYPE) == ENUMERAL_TYPE && !ENUM_IS_SCOPED (TYPE))
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
/* Set the flag indicating whether an ENUMERAL_TYPE is a C++0x scoped
enumeration type (1) or a normal (unscoped) enumeration type
(0). */
#define SET_SCOPED_ENUM_P(TYPE, VAL) \
(ENUM_IS_SCOPED (TYPE) = (VAL))
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
#define SET_OPAQUE_ENUM_P(TYPE, VAL) \
(ENUM_IS_OPAQUE (TYPE) = (VAL))
#define OPAQUE_ENUM_P(TYPE) \
(TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_OPAQUE (TYPE))
/* Determines whether an ENUMERAL_TYPE has an explicit
underlying type. */
#define ENUM_FIXED_UNDERLYING_TYPE_P(NODE) (TYPE_LANG_FLAG_5 (NODE))
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
/* Returns the underlying type of the given enumeration type. The
underlying type is determined in different ways, depending on the
properties of the enum:
- In C++0x, the underlying type can be explicitly specified, e.g.,
enum E1 : char { ... } // underlying type is char
- In a C++0x scoped enumeration, the underlying type is int
unless otherwises specified:
enum class E2 { ... } // underlying type is int
- Otherwise, the underlying type is determined based on the
values of the enumerators. In this case, the
ENUM_UNDERLYING_TYPE will not be set until after the definition
of the enumeration is completed by finish_enum. */
#define ENUM_UNDERLYING_TYPE(TYPE) \
TREE_TYPE (ENUMERAL_TYPE_CHECK (TYPE))
NEWS: Document removal of "new X = ..." extension. * NEWS: Document removal of "new X = ..." extension. * class.c (initialize_array): Set TREE_HAS_CONSTRUCTOR on brace-enclosed initializers. * cp-tree.h (CP_AGGREGATE_TYPE_P): New macro. (initialize_local_var): Remove declaration. (expand_static_init): Likewise. * decl.c (next_initializable_field): New function. (reshape_init): Likewise. (check_initializer): Use them. Build dynamic initializer for aggregates here too. (initialize_local_var): Simplify, and incorporate cleanup insertion code as well. (destroy_local_var): Remove. (cp_finish_decl): Tidy. (expand_static_init): Fold checks for whether or not a variable needs initialization into this function. Simplify. * decl2.c (do_static_initialization): Simplify. * init.c (build_init): Do not set TREE_SIDE_EFFECTS when it will be done for us automatically. (expand_default_init): Handle brace-enclosed initializers correctly. (expand_aggr_init_1): Remove RTL-generation code. (build_vec_init): Remove "new X = ..." support. * parse.y (new_initializer): Likewise. * rtti.c (get_pseudo_ti_init): Set TREE_HAS_CONSTRUCTOR on brace-enclosed initializer. (create_pseudo_type_info): Likewise. * typeck2.c (store_init_value): Don't try to handle digest_init being called more than once. (digest_init): Tidy handling of brace-enclosed initializers. * g++.dg/init/array1.C: Remove invalid braces. * g++.dg/init/brace1.C: New test. * g++.dg/init/copy2.C: Likewise. * g++.dg/init/copy3.C: Likewise. * g++.old-deja/g++.ext/arrnew.C: Change WARNING to ERROR. * g++.old-deja/g++.mike/p9129.C: Add ERROR on invalid use of braces. From-SVN: r58053
2002-10-11 18:50:44 +02:00
/* [dcl.init.aggr]
An aggregate is an array or a class with no user-provided
constructors, no brace-or-equal-initializers for non-static data
members, no private or protected non-static data members, no
base classes, and no virtual functions.
As an extension, we also treat vectors as aggregates. Keep these
checks in ascending code order. */
#define CP_AGGREGATE_TYPE_P(TYPE) \
(TREE_CODE (TYPE) == VECTOR_TYPE \
||TREE_CODE (TYPE) == ARRAY_TYPE \
|| (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
NEWS: Document removal of "new X = ..." extension. * NEWS: Document removal of "new X = ..." extension. * class.c (initialize_array): Set TREE_HAS_CONSTRUCTOR on brace-enclosed initializers. * cp-tree.h (CP_AGGREGATE_TYPE_P): New macro. (initialize_local_var): Remove declaration. (expand_static_init): Likewise. * decl.c (next_initializable_field): New function. (reshape_init): Likewise. (check_initializer): Use them. Build dynamic initializer for aggregates here too. (initialize_local_var): Simplify, and incorporate cleanup insertion code as well. (destroy_local_var): Remove. (cp_finish_decl): Tidy. (expand_static_init): Fold checks for whether or not a variable needs initialization into this function. Simplify. * decl2.c (do_static_initialization): Simplify. * init.c (build_init): Do not set TREE_SIDE_EFFECTS when it will be done for us automatically. (expand_default_init): Handle brace-enclosed initializers correctly. (expand_aggr_init_1): Remove RTL-generation code. (build_vec_init): Remove "new X = ..." support. * parse.y (new_initializer): Likewise. * rtti.c (get_pseudo_ti_init): Set TREE_HAS_CONSTRUCTOR on brace-enclosed initializer. (create_pseudo_type_info): Likewise. * typeck2.c (store_init_value): Don't try to handle digest_init being called more than once. (digest_init): Tidy handling of brace-enclosed initializers. * g++.dg/init/array1.C: Remove invalid braces. * g++.dg/init/brace1.C: New test. * g++.dg/init/copy2.C: Likewise. * g++.dg/init/copy3.C: Likewise. * g++.old-deja/g++.ext/arrnew.C: Change WARNING to ERROR. * g++.old-deja/g++.mike/p9129.C: Add ERROR on invalid use of braces. From-SVN: r58053
2002-10-11 18:50:44 +02:00
/* Nonzero for a class type means that the class type has a
user-declared constructor. */
#define TYPE_HAS_USER_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE))
1994-02-24 02:02:37 +01:00
/* Nonzero means that the FUNCTION_TYPE or METHOD_TYPE has a
late-specified return type. */
#define TYPE_HAS_LATE_RETURN_TYPE(NODE) \
(TYPE_LANG_FLAG_2 (FUNC_OR_METHOD_CHECK (NODE)))
1994-02-24 02:02:37 +01:00
/* When appearing in an INDIRECT_REF, it means that the tree structure
underneath is actually a call to a constructor. This is needed
when the constructor must initialize local storage (which can
be automatically destroyed), rather than allowing it to allocate
space from the heap.
When appearing in a SAVE_EXPR, it means that underneath
is a call to a constructor.
When appearing in a CONSTRUCTOR, the expression is a
compound literal.
1994-02-24 02:02:37 +01:00
When appearing in a FIELD_DECL, it means that this field
has been duly initialized in its constructor. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE))
1994-02-24 02:02:37 +01:00
/* True if NODE is a brace-enclosed initializer. */
#define BRACE_ENCLOSED_INITIALIZER_P(NODE) \
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
(TREE_CODE (NODE) == CONSTRUCTOR && TREE_TYPE (NODE) == init_list_type_node)
/* True if NODE is a compound-literal, i.e., a brace-enclosed
initializer cast to a particular type. */
#define COMPOUND_LITERAL_P(NODE) \
(TREE_CODE (NODE) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (NODE))
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
#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
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_is_empty(CONSTRUCTOR_ELTS(NODE))\
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
&& !TREE_HAS_CONSTRUCTOR (NODE))
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
/* True if NODE is a init-list used as a direct-initializer, i.e.
B b{1,2}, not B b({1,2}) or B b = {1,2}. */
#define CONSTRUCTOR_IS_DIRECT_INIT(NODE) (TREE_LANG_FLAG_0 (CONSTRUCTOR_CHECK (NODE)))
/* True if an uninitialized element in NODE should not be treated as
implicitly value-initialized. Only used in constexpr evaluation. */
#define CONSTRUCTOR_NO_IMPLICIT_ZERO(NODE) \
(TREE_LANG_FLAG_1 (CONSTRUCTOR_CHECK (NODE)))
/* True if this CONSTRUCTOR should not be used as a variable initializer
because it was loaded from a constexpr variable with mutable fields. */
#define CONSTRUCTOR_MUTABLE_POISON(NODE) \
(TREE_LANG_FLAG_2 (CONSTRUCTOR_CHECK (NODE)))
#define DIRECT_LIST_INIT_P(NODE) \
(BRACE_ENCLOSED_INITIALIZER_P (NODE) && CONSTRUCTOR_IS_DIRECT_INIT (NODE))
/* True if NODE represents a conversion for direct-initialization in a
template. Set by perform_implicit_conversion_flags. */
#define IMPLICIT_CONV_EXPR_DIRECT_INIT(NODE) \
(TREE_LANG_FLAG_0 (IMPLICIT_CONV_EXPR_CHECK (NODE)))
/* Nonzero means that an object of this type can not be initialized using
an initializer list. */
#define CLASSTYPE_NON_AGGREGATE(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
#define TYPE_NON_AGGREGATE_CLASS(NODE) \
(CLASS_TYPE_P (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
/* Nonzero if there is a non-trivial X::op=(cv X&) for this class. */
#define TYPE_HAS_COMPLEX_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_assign)
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
/* Nonzero if there is a non-trivial X::X(cv X&) for this class. */
#define TYPE_HAS_COMPLEX_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_ctor)
1994-02-24 02:02:37 +01:00
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* Nonzero if there is a non-trivial X::op=(X&&) for this class. */
#define TYPE_HAS_COMPLEX_MOVE_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_assign)
/* Nonzero if there is a non-trivial X::X(X&&) for this class. */
#define TYPE_HAS_COMPLEX_MOVE_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_ctor)
/* Nonzero if there is no trivial default constructor for this class. */
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
#define TYPE_HAS_COMPLEX_DFLT(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_dflt)
/* Nonzero if TYPE has a trivial destructor. From [class.dtor]:
A destructor is trivial if it is an implicitly declared
destructor and if:
- all of the direct base classes of its class have trivial
destructors,
- for all of the non-static data members of its class that are
of class type (or array thereof), each such class has a
trivial destructor. */
#define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \
(!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE))
/* Nonzero for _TYPE node means that this type does not have a trivial
destructor. Therefore, destroying an object of this type will
involve a call to a destructor. This can apply to objects of
ARRAY_TYPE is the type of the elements needs a destructor. */
#define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(TYPE_LANG_FLAG_4 (NODE))
1994-02-24 02:02:37 +01:00
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
/* Nonzero for class type means that the default constructor is trivial. */
#define TYPE_HAS_TRIVIAL_DFLT(NODE) \
(TYPE_HAS_DEFAULT_CONSTRUCTOR (NODE) && ! TYPE_HAS_COMPLEX_DFLT (NODE))
/* Nonzero for class type means that copy initialization of this type can use
a bitwise copy. */
#define TYPE_HAS_TRIVIAL_COPY_CTOR(NODE) \
(TYPE_HAS_COPY_CTOR (NODE) && ! TYPE_HAS_COMPLEX_COPY_CTOR (NODE))
/* Nonzero for class type means that assignment of this type can use
a bitwise copy. */
#define TYPE_HAS_TRIVIAL_COPY_ASSIGN(NODE) \
(TYPE_HAS_COPY_ASSIGN (NODE) && ! TYPE_HAS_COMPLEX_COPY_ASSIGN (NODE))
fold-const.c (force_fit_type): Handle OFFSET_TYPE. * fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-23 01:30:22 +02:00
/* Returns true if NODE is a pointer-to-data-member. */
#define TYPE_PTRDATAMEM_P(NODE) \
fold-const.c (force_fit_type): Handle OFFSET_TYPE. * fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-23 01:30:22 +02:00
(TREE_CODE (NODE) == OFFSET_TYPE)
/* Returns true if NODE is a pointer. */
fold-const.c (force_fit_type): Handle OFFSET_TYPE. * fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-23 01:30:22 +02:00
#define TYPE_PTR_P(NODE) \
(TREE_CODE (NODE) == POINTER_TYPE)
/* Returns true if NODE is an object type:
[basic.types]
An object type is a (possibly cv-qualified) type that is not a
2006-06-06 13:44:09 +02:00
function type, not a reference type, and not a void type.
Keep these checks in ascending order, for speed. */
#define TYPE_OBJ_P(NODE) \
(TREE_CODE (NODE) != REFERENCE_TYPE \
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
&& !VOID_TYPE_P (NODE) \
&& TREE_CODE (NODE) != FUNCTION_TYPE \
&& TREE_CODE (NODE) != METHOD_TYPE)
/* Returns true if NODE is a pointer to an object. Keep these checks
in ascending tree code order. */
#define TYPE_PTROB_P(NODE) \
(TYPE_PTR_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE)))
/* Returns true if NODE is a reference to an object. Keep these checks
in ascending tree code order. */
#define TYPE_REF_OBJ_P(NODE) \
(TREE_CODE (NODE) == REFERENCE_TYPE && TYPE_OBJ_P (TREE_TYPE (NODE)))
/* Returns true if NODE is a pointer to an object, or a pointer to
void. Keep these checks in ascending tree code order. */
#define TYPE_PTROBV_P(NODE) \
(TYPE_PTR_P (NODE) \
&& !(TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \
|| TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE))
/* Returns true if NODE is a pointer to function type. */
1996-09-12 21:19:15 +02:00
#define TYPE_PTRFN_P(NODE) \
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
(TYPE_PTR_P (NODE) \
1996-09-12 21:19:15 +02:00
&& TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
/* Returns true if NODE is a reference to function type. */
#define TYPE_REFFN_P(NODE) \
(TREE_CODE (NODE) == REFERENCE_TYPE \
&& TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
1996-09-12 21:19:15 +02:00
/* Returns true if NODE is a pointer to member function type. */
#define TYPE_PTRMEMFUNC_P(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(TREE_CODE (NODE) == RECORD_TYPE \
&& TYPE_PTRMEMFUNC_FLAG (NODE))
#define TYPE_PTRMEMFUNC_FLAG(NODE) \
(TYPE_LANG_FLAG_2 (RECORD_TYPE_CHECK (NODE)))
fold-const.c (force_fit_type): Handle OFFSET_TYPE. * fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-23 01:30:22 +02:00
/* Returns true if NODE is a pointer-to-member. */
#define TYPE_PTRMEM_P(NODE) \
(TYPE_PTRDATAMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE))
/* Returns true if NODE is a pointer or a pointer-to-member. */
#define TYPE_PTR_OR_PTRMEM_P(NODE) \
(TYPE_PTR_P (NODE) || TYPE_PTRMEM_P (NODE))
fold-const.c (force_fit_type): Handle OFFSET_TYPE. * fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-23 01:30:22 +02:00
/* Indicates when overload resolution may resolve to a pointer to
member function. [expr.unary.op]/3 */
#define PTRMEM_OK_P(NODE) \
TREE_LANG_FLAG_0 (TREE_CHECK3 ((NODE), ADDR_EXPR, OFFSET_REF, SCOPE_REF))
1994-02-24 02:02:37 +01:00
/* Get the POINTER_TYPE to the METHOD_TYPE associated with this
pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
1996-07-11 03:13:25 +02:00
before using this macro. */
#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
(cp_build_qualified_type (TREE_TYPE (TYPE_FIELDS (NODE)),\
cp_type_quals (NODE)))
/* As above, but can be used in places that want an lvalue at the expense
of not necessarily having the correct cv-qualifiers. */
#define TYPE_PTRMEMFUNC_FN_TYPE_RAW(NODE) \
(TREE_TYPE (TYPE_FIELDS (NODE)))
/* Returns `A' for a type like `int (A::*)(double)' */
#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
1998-05-06 23:09:07 +02:00
/* These are use to manipulate the canonical RECORD_TYPE from the
1996-07-11 03:13:25 +02:00
hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \
(TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL)
#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \
do { \
if (TYPE_LANG_SPECIFIC (NODE) == NULL) \
{ \
use templates instead of gengtype for typed allocation functions gcc/ChangeLog: * alias.c (record_alias_subset): Adjust. * bitmap.c (bitmap_element_allocate): Likewise. (bitmap_gc_alloc_stat): Likewise. * cfg.c (init_flow): Likewise. (alloc_block): Likewise. (unchecked_make_edge): Likewise. * cfgloop.c (alloc_loop): Likewise. (flow_loops_find): Likewise. (rescan_loop_exit): Likewise. * cfgrtl.c (init_rtl_bb_info): Likewise. * cgraph.c (insert_new_cgraph_node_version): Likewise. (cgraph_allocate_node): Likewise. (cgraph_create_edge_1): Likewise. (cgraph_allocate_init_indirect_info): Likewise. * cgraphclones.c (cgraph_clone_edge): Likewise. * cgraphunit.c (add_asm_node): Likewise. (init_lowered_empty_function): Likewise. * config/aarch64/aarch64.c (aarch64_init_machine_status): Likewise. * config/alpha/alpha.c (alpha_init_machine_status): Likewise. (alpha_use_linkage): Likewise. * config/arc/arc.c (arc_init_machine_status): Likewise. * config/arm/arm.c (arm_init_machine_status): Likewise. * config/avr/avr.c (avr_init_machine_status): Likewise. * config/bfin/bfin.c (bfin_init_machine_status): Likewise. * config/c6x/c6x.c (c6x_init_machine_status): Likewise. * config/cris/cris.c (cris_init_machine_status): Likewise. * config/darwin.c (machopic_indirection_name): Likewise. (darwin_build_constant_cfstring): Likewise. (darwin_enter_string_into_cfstring_table): Likewise. * config/epiphany/epiphany.c (epiphany_init_machine_status): * Likewise. * config/frv/frv.c (frv_init_machine_status): Likewise. * config/i386/i386.c (get_dllimport_decl): Likewise. (ix86_init_machine_status): Likewise. (assign_386_stack_local): Likewise. * config/i386/winnt.c (i386_pe_record_external_function): Likewise. (i386_pe_maybe_record_exported_symbol): Likewise. (i386_pe_record_stub): Likewise. * config/ia64/ia64.c (ia64_init_machine_status): Likewise. * config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise. * config/m32c/m32c.c (m32c_init_machine_status): Likewise. (m32c_note_pragma_address): Likewise. * config/mep/mep.c (mep_init_machine_status): Likewise. (mep_note_pragma_flag): Likewise. * config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise. (mips16_local_alias): Likewise. (mips_init_machine_status): Likewise. * config/mmix/mmix.c (mmix_init_machine_status): Likewise. * config/moxie/moxie.c (moxie_init_machine_status): Likewise. * config/msp430/msp430.c (msp430_init_machine_status): Likewise. * config/nds32/nds32.c (nds32_init_machine_status): Likewise. * config/nios2/nios2.c (nios2_init_machine_status): Likewise. * config/pa/pa.c (pa_init_machine_status): Likewise. (pa_get_deferred_plabel): Likewise. * config/rl78/rl78.c (rl78_init_machine_status): Likewise. * config/rs6000/rs6000.c (builtin_function_type): Likewise. (rs6000_init_machine_status): Likewise. (output_toc): Likewise. * config/s390/s390.c (s390_init_machine_status): Likewise. * config/score/score.c (score_output_external): Likewise. * config/sparc/sparc.c (sparc_init_machine_status): Likewise. * config/spu/spu.c (spu_init_machine_status): Likewise. * config/tilegx/tilegx.c (tilegx_init_machine_status): Likewise. * config/tilepro/tilepro.c (tilepro_init_machine_status): * Likewise. * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise. * coverage.c (coverage_end_function): Likewise. * dbxout.c (dbxout_init): Likewise. * doc/gty.texi: Don't mention variable_size attribute. * dwarf2cfi.c (new_cfi): Adjust. (new_cfi_row): Likewise. (copy_cfi_row): Likewise. (create_cie_data): Likewise. * dwarf2out.c (dwarf2out_alloc_current_fde): Likewise. (new_loc_descr): Likewise. (find_AT_string_in_table): Likewise. (add_addr_table_entry): Likewise. (new_die): Likewise. (add_var_loc_to_decl): Likewise. (clone_die): Likewise. (clone_as_declaration): Likewise. (break_out_comdat_types): Likewise. (new_loc_list): Likewise. (add_loc_descr_to_each): Likewise. (add_location_or_const_value_attribute): Likewise. (add_linkage_name): Likewise. (lookup_filename): Likewise. (dwarf2out_var_location): Likewise. (new_line_info_table): Likewise. (dwarf2out_init): Likewise. (mem_loc_descriptor): Likewise. (loc_descriptor): Likewise. (add_const_value_attribute): Likewise. (tree_add_const_value_attribute): Likewise. (comp_dir_string): Likewise. (dwarf2out_vms_debug_main_pointer): Likewise. (string_cst_pool_decl): Likewise. * emit-rtl.c (set_mem_attrs): Likewise. (get_reg_attrs): Likewise. (start_sequence): Likewise. (init_emit): Likewise. (init_emit_regs): Likewise. * except.c (init_eh_for_function): Likewise. (gen_eh_region): Likewise. (gen_eh_region_catch): Likewise. (gen_eh_landing_pad): Likewise. (add_call_site): Likewise. * function.c (add_frame_space): Likewise. (insert_temp_slot_address): Likewise. (assign_stack_temp_for_type): Likewise. (get_hard_reg_initial_val): Likewise. (allocate_struct_function): Likewise. (prepare_function_start): Likewise. (types_used_by_var_decl_insert): Likewise. * gengtype.c (variable_size_p): Remove function. (enum alloc_quantity): Remove enum. (write_typed_alloc_def): Remove function. (write_typed_struct_alloc_def): Likewise. (write_typed_typedef_alloc_def): Likewise. (write_typed_alloc_defns): Likewise. (main): Adjust. * ggc-common.c (ggc_cleared_alloc_htab_ignore_args): Adjust. (ggc_cleared_alloc_ptr_array_two_args): Likewise. * ggc.h (ggc_alloc): new function. (ggc_cleared_alloc): Likewise. (ggc_vec_alloc): Template on type of vector element, and remove element size argument. (ggc_cleared_vec_alloc): Likewise. * gimple.c (gimple_build_omp_for): Adjust. (gimple_copy): Likewise. * ipa-cp.c (get_replacement_map): Likewise. (find_aggregate_values_for_callers_subset): Likewise. (known_aggs_to_agg_replacement_list): Likewise. * ipa-devirt.c (get_odr_type): Likewise. * ipa-prop.c (ipa_node_duplication_hook): Likewise. (read_agg_replacement_chain): Likewise. * loop-iv.c (get_simple_loop_desc): Likewise. * lto-cgraph.c (input_node_opt_summary): Likewise. * lto-section-in.c (lto_new_in_decl_state): Likewise. * lto-streamer-in.c (lto_input_eh_catch_list): Likewise. (input_eh_region): Likewise. (input_eh_lp): Likewise. (input_cfg): Likewise. * optabs.c (set_optab_libfunc): Likewise. (init_tree_optimization_optabs): Likewise. (set_conv_libfunc): Likewise. * passes.c (do_per_function_toporder): Likewise. * rtl.h: Don't use variable_size gty attribute. * sese.c (if_region_set_false_region): Adjust. * stringpool.c (gt_pch_save_stringpool): Likewise. * target-globals.c (save_target_globals): Likewise. * toplev.c (general_init): Likewise. * trans-mem.c (record_tm_replacement): Likewise. (split_bb_make_tm_edge): Likewise. * tree-cfg.c (move_sese_region_to_fn): Likewise. * tree-data-ref.h (lambda_vector_new): Likewise. * tree-eh.c (add_stmt_to_eh_lp_fn): Likewise. * tree-iterator.c (tsi_link_before): Likewise. (tsi_link_after): Likewise. * tree-scalar-evolution.c (new_scev_info_str): Likewise. * tree-ssa-loop-niter.c (record_estimate): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Likewise. * tree-ssa-operands.h: Don't use variable_size gty attribute. * tree-ssa.c (init_tree_ssa): Adjust. * tree-ssanames.c (set_range_info): Likewise. (get_ptr_info): Likewise. (duplicate_ssa_name_ptr_info): Likewise. (duplicate_ssa_name_range_info): Likewise. * tree-streamer-in.c (unpack_ts_real_cst_value_fields): Likewise. (unpack_ts_fixed_cst_value_fields): Likewise. * tree.c (build_fixed): Likewise. (build_real): Likewise. (build_string): Likewise. (decl_priority_info): Likewise. (decl_debug_expr_insert): Likewise. (decl_value_expr_insert): Likewise. (decl_debug_args_insert): Likewise. (type_hash_add): Likewise. (build_omp_clause): Likewise. * ubsan.c (decl_for_type_insert): Likewise. * varasm.c (get_unnamed_section): Likewise. (get_noswitch_section): Likewise. (get_section): Likewise. (get_block_for_section): Likewise. (create_block_symbol): Likewise. (build_constant_desc): Likewise. (create_constant_pool): Likewise. (force_const_mem): Likewise. (record_tm_clone_pair): Likewise. * varpool.c (varpool_create_empty_node): Likewise. gcc/c/ChangeLog: * c-decl.c (finish_struct): Adjust. (finish_enum): Likewise. (bind): Adjust. (record_inline_static): Likewise. (push_scope): Likewise. (make_label): Likewise. (lookup_label_for_goto): Likewise. (finish_struct): Likewise. (finish_enum): Likewise. (store_parm_decls): Likewise. (c_push_function_context): Likewise. * c-lang.h: Remove usage of variable_size gty attribute. * c-parser.c (c_parse_init): Adjust. (c_parse_file): Likewise. gcc/java/ChangeLog: * class.c (add_method_1): Adjust. (java_treetreehash_new): Likewise. * constants.c (set_constant_entry): Likewise. (cpool_for_class): Likewise. * decl.c (make_binding_level): Likewise. (java_dup_lang_specific_decl): Likewise. * expr.c (add_type_assertion): Likewise. * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise. (lang_decl): don't use variable_size gty attribute. (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Adjust. (lang_type): Don't use variable_size gty attribute. * jcf-parse.c (java_parse_file): Adjust. (process_zip_dir): Likewise. * jcf.h: Remove usage of variable_size gty attribute. * jcf-reader.c (jcf_parse_constant_pool): Adjust. (jcf_parse_bootstrap_methods): Likewise. gcc/objc/ChangeLog: * objc-act.c (objc_build_string_object): Adjust. (continue_class): Likewise. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. * objc-map.c (objc_map_alloc_ggc): Likewise. (objc_map_private_resize): Likewise. * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Likewise. (hash_name_enter): Likewise. gcc/cp/ChangeLog: * class.c (sorted_fields_type_new): Adjust. * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise. * cp-tree.h: Remove usage of variable_size gty attribute. * decl.c (make_label_decl): Adjust. (check_goto): Likewise. (start_preparsed_function): Likewise. (save_function_data): Likewise. * lex.c (init_reswords): Likewise. (retrofit_lang_decl): Likewise. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. * name-lookup.c (binding_entry_make): Likewise. (binding_table_construct): Likewise. (binding_table_new): Likewise. (cxx_binding_make): Likewise. (pushdecl_maybe_friend_1): Likewise. (begin_scope): Likewise. (push_to_top_level): Likewise. * parser.c (cp_lexer_alloc): Likewise. (cp_lexer_new_from_tokens): Likewise. (cp_token_cache_new): Likewise. (cp_parser_context_new): Likewise. (cp_parser_new): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_template_id): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (register_specialization): Likewise. (add_pending_template): Likewise. (lookup_template_class_1): Likewise. (push_tinst_level): Likewise. * semantics.c (register_constexpr_fundef): Likewise. (cxx_eval_call_expression): Likewise. * typeck2.c (abstract_virtuals_error_sfinae): Likewise. gcc/fortran/ChangeLog: * f95-lang.c (pushlevel): Adjust. * trans-decl.c (gfc_allocate_lang_decl): Adjust. (gfc_find_module): Likewise. * trans-types.c (gfc_get_nodesc_array_type): Likewise. (gfc_get_array_type_bounds): Likewise. (gfc_nonrestricted_type): Likewise. * trans.h: Don't use variable_size gty attribute. gcc/ada/ChangeLog: * gcc-interface/ada-tree.h: Remove usage of variable_size gty annotation. * gcc-interface/decl.c (annotate_value): Adjust. * gcc-interface/trans.c (Attribute_to_gnu): Likewise. (push_range_check_info): Likewise. (Loop_Statement_to_gnu): Likewise. (Subprogram_Body_to_gnu): Likewise. (Compilation_Unit_to_gnu): Likewise. (start_stmt_group): Likewise. * gcc-interface/utils.c (init_gnat_utils): Likewise. (gnat_pushlevel): Likewise. (maybe_pad_type): Likewise. gcc/go/ChangeLog: * go-lang.c (struct GTY): Don't use variable_size gty attribute. gcc/c-family/ChangeLog: * c-common.h (sorted_fields_type): Remove variable_size GTY attribute. * c-pragma.c (push_alignment): Adjust. (handle_pragma_push_options): Likewise. gcc/lto/ChangeLog: * lto-tree.h: Don't use variable_size gty attribute. * lto.c (lto_read_in_decl_state): Adjust. (create_subid_section_table): Likewise. (lto_flatten_files): Likewise. (read_cgraph_and_symbols): Likewise. gcc/objcp/ChangeLog: * objcp-decl.h: Adjust. From-SVN: r210566
2014-05-18 01:07:23 +02:00
TYPE_LANG_SPECIFIC (NODE) \
= (struct lang_type *) ggc_internal_cleared_alloc \
utils.c (init_gnat_to_gnu): Use typed GC allocation. gcc/ada: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC allocation. (init_dummy_type): Likewise. (gnat_pushlevel): Likewise. * gcc-interface/trans.c (Attribute_to_gnu): Likewise. (Subprogram_Body_to_gnu): Likewise. (Compilation_Unit_to_gnu): Likewise. (start_stmt_group): Likewise. (extract_encoding): Likewise. (decode_name): Likewise. * gcc-interface/misc.c (gnat_printable_name): Likewise. * gcc-interface/decl.c (annotate_value): Likewise. * gcc-interface/ada-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. (SET_TYPE_LANG_SPECIFIC): Use typed GC allocation. (SET_DECL_LANG_SPECIFIC): Likewise. gcc/c-family: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * c-pragma.c (push_alignment): Use typed GC allocation. (handle_pragma_push_options): Likewise. * c-common.c (parse_optimize_options): Likewise. * c-common.h (struct sorted_fields_type): Add variable_size GTY option. gcc/cp: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * typeck2.c (abstract_virtuals_error): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (register_specialization): Likewise. (add_pending_template): Likewise. (lookup_template_class): Likewise. (push_tinst_level): Likewise. * parser.c (cp_lexer_new_main): Likewise. (cp_lexer_new_from_tokens): Likewise. (cp_token_cache_new): Likewise. (cp_parser_context_new): Likewise. (cp_parser_new): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_template_id): Likewise. * name-lookup.c (binding_entry_make): Likewise. (binding_table_construct): Likewise. (binding_table_new): Likewise. (cxx_binding_make): Likewise. (pushdecl_maybe_friend): Likewise. (begin_scope): Likewise. (push_to_top_level): Likewise. * lex.c (init_reswords): Likewise. (retrofit_lang_decl): Likewise. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. * decl.c (make_label_decl): Likewise. (check_goto): Likewise. (start_preparsed_function): Likewise. (save_function_data): Likewise. * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise. * class.c (finish_struct_1): Likewise. * cp-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * parser.c (cp_parser_new): Update comment to not reference ggc_alloc. gcc/fortran: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * trans-types.c (gfc_get_nodesc_array_type): Use typed GC allocation. (gfc_get_array_type_bounds): Likewise. * trans-decl.c (gfc_allocate_lang_decl): Likewise. (gfc_find_module): Likewise. * f95-lang.c (pushlevel): Likewise. * trans.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. gcc/java: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation. * jcf-parse.c (java_parse_file): Likewise. (process_zip_dir): Likewise. * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise. (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise. * expr.c (add_type_assertion): Likewise. * decl.c (make_binding_level): Likewise. (java_dup_lang_specific_decl): Likewise. * constants.c (set_constant_entry): Likewise. (cpool_for_class): Likewise. * class.c (add_method_1): Likewise. (java_treetreehash_new): Likewise. * java-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * jch.h (struct cpool_entry): Likewise. * java-tree.h (java_treetreehash_create): Remove parameter ggc. * except.c (prepare_eh_table_type): Update java_treetreehash_create call. * class.c (add_method_1): Update java_treetreehash_create call. (java_treetreehash_create): Remove parameter gc. Use htab_create_ggc. gcc/lto: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * lto.c (lto_read_in_decl_state): Use typed GC allocation. (lto_file_read): Likewise. (new_partition): Likewise. (read_cgraph_and_symbols): Likewise. gcc/objc: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. * objc-act.c (objc_volatilize_decl): Likewise. (objc_build_string_object): Likewise. (hash_init): Likewise. (hash_enter): Likewise. (hash_add_attr): Likewise. (add_class): Likewise. (start_class): Likewise. gcc/objcp: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * objcp-decl.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. gcc: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * doc/tm.texi (Per-Function Data): Do not reference ggc_alloc. * doc/gty.texi (GTY Options): Document typed GC allocation and variable_size GTY option. * ggc-internal.h: New. * ggc.h: Update copyright year. (digit_string): Move to stringpool.c. (ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots) (gt_pch_save_stringpool, gt_pch_fixup_stringpool) (gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object) (init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size) (ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write) (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read) (ggc_force_collect, ggc_get_size, ggc_statistics) (ggc_print_common_statistics): Move to ggc-internal.h. (digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat) (ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW) (GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec) (ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic) (ggc_min_heapsize_heuristic, ggc_alloc_zone) (ggc_alloc_zone_pass_stat): Remove. (ggc_internal_alloc_stat, ggc_internal_alloc) (ggc_internal_cleared_alloc_stat): New. (GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine. (ggc_internal_vec_alloc_stat) (ggc_internal_cleared_vec_alloc_stat) (ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc) (ggc_alloc_atomic_stat, ggc_alloc_atomic) (ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args) (ggc_cleared_alloc_ptr_array_two_args): New. (htab_create_ggc, splay_tree_new_ggc): Redefine. (ggc_splay_alloc): Change the type of the first argument to enum gt_types_enum. (ggc_alloc_string): Make macro. (ggc_alloc_string_stat): New. (ggc_strdup): Redefine. (rtl_zone, tree_zone, tree_id_zone): Declare unconditionally. (ggc_alloc_rtvec_sized): New. (ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat) (ggc_internal_cleared_alloc_zone_stat) (ggc_internal_zone_alloc_stat) (ggc_internal_zone_cleared_alloc_stat) (ggc_internal_zone_vec_alloc_stat) (ggc_alloc_zone_rtx_def_stat) (ggc_alloc_zone_tree_node_stat) (ggc_alloc_zone_cleared_tree_node_stat) (ggc_alloc_cleared_gimple_statement_d_stat): New. * ggc-common.c: Include ggc-internal.h. (ggc_internal_cleared_alloc_stat): Rename from ggc_alloc_cleared_stat. (ggc_realloc_stat): Use ggc_internal_alloc_stat. (ggc_calloc): Remove. (ggc_cleared_alloc_htab_ignore_args): New. (ggc_cleared_alloc_ptr_array_two_args): New. (ggc_splay_alloc): Add obj_type parameter. (init_ggc_heuristics): Formatting fixes. * ggc-none.c: Update copyright year. (ggc_alloc_stat): Rename to ggc_alloc_stat. (ggc_alloc_cleared_stat): Rename to ggc_internal_cleared_alloc_stat. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-page.c: Update copyright year. Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_typed_stat): Call ggc_internal_alloc_stat. (ggc_alloc_stat): Rename to ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-zone.c: Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat): New. (ggc_internal_cleared_alloc_zone_stat): New. (ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat. (ggc_alloc_stat): Rename ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. * stringpool.c: Update copyright year. Include ggc-internal.h (digit_vector): Make static. (digit_string): Moved from ggc.h. (stringpool_ggc_alloc): Use ggc_alloc_atomic. (ggc_alloc_string): Rename to ggc_alloc_string_stat. * Makefile.in (GGC_INTERNAL_H): New. (ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add $(GGC_INTERNAL_H) to dependencies. * gentype.c: Update copyright year. (walk_type): Accept variable_size GTY option. (USED_BY_TYPED_GC_P): New macro. (write_enum_defn): Use USED_BY_TYPED_GC_P. Do not output whitespace at the end of strings. (get_type_specifier, variable_size_p): New functions. (alloc_quantity, alloc_zone): New enums. (write_typed_alloc_def): New function. (write_typed_struct_alloc_def): Likewise. (write_typed_typed_typedef_alloc_def): Likewise. (write_typed_alloc_defns): Likewise. (output_typename, write_splay_tree_allocator_def): Likewise. (write_splay_tree_allocators): Likewise. (main): Call write_typed_alloc_defns and write_splay_tree_allocators. * lto-streamer.h (lto_file_decl_data_ptr): New. * passes.c (order): Define using cgraph_node_ptr. * strinpool.c (struct string_pool_data): Declare nested_ptr using ht_identifier_ptr. * gimple.h (union gimple_statement_d): Likewise. * rtl.h (struct rtx_def): Likewise. (struct rtvec_def): Likewise. * tree.h (union tree_node): Likewise. * tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise. * cfgloop.c (record_loop_exits): Use htab_create_ggc. * tree-scalar-evolution.c (scev_initialize): Likewise. * alias.c (record_alias_subset): Update splay_tree_new_ggc call. * dwarf2asm.c (dw2_force_const_mem): Likewise. * omp-low.c (lower_omp_critical): Likewise. * bitmap.h (struct bitmap_head_def): Update comment to not reference ggc_alloc. * config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC. * ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC. * ipa-prop.c (duplicate_ggc_array): Rename to duplicate_ipa_jump_func_array. Use typed GC allocation. (ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array. * gimple.c (gimple_alloc_stat): Use ggc_alloc_cleared_gimple_statement_d_stat. * varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def. * tree.c (make_node_stat): Use ggc_alloc_zone_cleared_tree_node_stat. (make_tree_vec_stat): Likewise. (build_vl_exp_stat): Likewise. (copy_node_stat): Use ggc_alloc_zone_tree_node_stat. (make_tree_binfo_stat): Likewise. (tree_cons_stat): Likewise. * rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat. (shallow_copy_rtx_stat): Likewise. (make_node_stat): Likewise. * lto-symtab.c: Fix comment. * tree-cfg.c (create_bb): Update comment to not reference ggc_alloc_cleared. * tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is value. * varpool.c (varpool_node): Use typed GC allocation. (varpool_extra_name_alias): Likewise. * varasm.c (emutls_decl): Likewise. (get_unnamed_section): Likewise. (get_noswitch_section): Likewise. (get_section): Likewise. (get_block_for_section): Likewise. (build_constant_desc): Likewise. (create_constant_pool): Likewise. (force_const_mem): Likewise. * tree.c (build_vl_exp_stat): Likewise. (build_real): Likewise. (build_string): Likewise. (decl_debug_expr_insert): Likewise. (decl_value_expr_insert): Likewise. (type_hash_add): Likewise. (build_omp_clause): Likewise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise. * tree-ssa.c (init_tree_ssa): Likewise. * tree-ssa-structalias.c (heapvar_insert): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Likewise. * tree-ssa-loop-niter.c (record_estimate): Likewise. * tree-ssa-alias.c (get_ptr_info): Likewise. * tree-scalar-evolution.c (new_scev_info_str): Likewise. * tree-phinodes.c (allocate_phi_node): Likewise. * tree-iterator.c (tsi_link_before): Likewise. (tsi_link_after): Likewise. * tree-eh.c (add_stmt_to_eh_lp_fn): Likewise. * tree-dfa.c (create_var_ann): Likewise. * tree-cfg.c (create_bb): Likewise. * toplev.c (alloc_for_identifier_to_locale): Likewise. (general_init): Likewise. * stringpool.c (stringpool_ggc_alloc): Likewise. (gt_pch_save_stringpool): Likewise. * sese.c (if_region_set_false_region): Likewise. * passes.c (do_per_function_toporder): Likewise. * optabs.c (set_optab_libfunc): Likewise. (set_conv_libfunc): Likewise. * lto-symtab.c (lto_symtab_register_decl): Likewise. * lto-streamer-in.c (lto_input_eh_catch_list): Likewise. (input_eh_region): Likewise. (input_eh_lp): Likewise. (make_new_block): Likewise. (unpack_ts_real_cst_value_fields): Likewise. * lto-section-in.c (lto_new_in_decl_state): Likewise. * lto-cgraph.c (input_node_opt_summary): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * lambda.h (lambda_vector_new): Likewise. * lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise. * ira.c (update_equiv_regs): Likewise. * ipa.c (cgraph_node_set_new): Likewise. (cgraph_node_set_add): Likewise. (varpool_node_set_new): Likewise. (varpool_node_set_add): Likewise. * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise. (duplicate_ipa_jump_func_array): Likewise. (ipa_read_node_info): Likewise. * ipa-cp.c (ipcp_create_replace_map): Likewise. * integrate.c (get_hard_reg_initial_val): Likewise. * gimple.c (gimple_alloc_stat): Likewise. (gimple_build_omp_for): Likewise. (gimple_seq_alloc): Likewise. (gimple_copy): Likewise. * gimple-iterator.c (gsi_insert_before_without_update): Likewise. (gsi_insert_after_without_update): Likewise. * function.c (add_frame_space): Likewise. (insert_temp_slot_address): Likewise. (assign_stack_temp_for_type): Likewise. (allocate_struct_function): Likewise. (types_used_by_var_decl_insert): Likewise. * except.c (init_eh_for_function): Likewise. (gen_eh_region): Likewise. (gen_eh_region_catch): Likewise. (gen_eh_landing_pad): Likewise. (add_call_site): Likewise. * emit-rtl.c (get_mem_attrs): Likewise. (get_reg_attrs): Likewise. (start_sequence): Likewise. (init_emit): Likewise. * dwarf2out.c (new_cfi): Likewise. (queue_reg_save): Likewise. (dwarf2out_frame_init): Likewise. (new_loc_descr): Likewise. (find_AT_string): Likewise. (new_die): Likewise. (add_var_loc_to_decl): Likewise. (clone_die): Likewise. (clone_as_declaration): Likewise. (break_out_comdat_types): Likewise. (new_loc_list): Likewise. (loc_descriptor): Likewise. (add_loc_descr_to_each): Likewise. (add_const_value_attribute): Likewise. (tree_add_const_value_attribute): Likewise. (add_comp_dir_attribute): Likewise. (add_name_and_src_coords_attributes): Likewise. (lookup_filename): Likewise. (store_vcall_insn): Likewise. (dwarf2out_init): Likewise. * dbxout.c (dbxout_init): Likewise. * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise. * config/sparc/sparc.c (sparc_init_machine_status): Likewise. * config/score/score7.c (score7_output_external): Likewise. * config/score/score3.c (score3_output_external): Likewise. * config/s390/s390.c (s390_init_machine_status): Likewise. * config/rs6000/rs6000.c (builtin_function_type): Likewise. (rs6000_init_machine_status): Likewise. (output_toc): Likewise. * config/pa/pa.c (pa_init_machine_status): Likewise. (get_deferred_plabel): Likewise. * config/moxie/moxie.c (moxie_init_machine_status): Likewise. * config/mmix/mmix.c (mmix_init_machine_status): Likewise. * config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise. * config/mep/mep.c (mep_init_machine_status): Likewise. (mep_note_pragma_flag): Likewise. * config/m32c/m32c.c (m32c_init_machine_status): Likewise. * config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise. * config/ia64/ia64.c (ia64_init_machine_status): Likewise. * config/i386/winnt.c (i386_pe_record_external_function): Likewise. (i386_pe_maybe_record_exported_symbol): Likewise. * config/i386/i386.c (get_dllimport_decl): Likewise. (ix86_init_machine_status): Likewise. (assign_386_stack_local): Likewise. * config/frv/frv.c (frv_init_machine_status): Likewise. * config/darwin.c (machopic_indirection_name): Likewise. * config/cris/cris.c (cris_init_machine_status): Likewise. * config/bfin/bfin.c (bfin_init_machine_status): Likewise. * config/avr/avr.c (avr_init_machine_status): Likewise. * config/arm/arm.c (arm_init_machine_status): Likewise. * config/alpha/alpha.c (alpha_init_machine_status): Likewise. (alpha_need_linkage): Likewise. (alpha_use_linkage): Likewise. * cgraph.c (cgraph_allocate_node): Likewise. (cgraph_create_edge_1): Likewise. (cgraph_create_indirect_edge): Likewise. (cgraph_add_asm_node): Likewise. * cfgrtl.c (init_rtl_bb_info): Likewise. * cfgloop.c (alloc_loop): Likewise. (rescan_loop_exit): Likewise. * cfg.c (init_flow): Likewise. (alloc_block): Likewise. (unchecked_make_edge): Likewise. * c-parser.c (c_parse_init): Likewise. (c_parse_file): Likewise. * c-decl.c (bind): Likewise. (record_inline_static): Likewise. (push_scope): Likewise. (make_label): Likewise. (lookup_label_for_goto): Likewise. (finish_struct): Likewise. (finish_enum): Likewise. (c_push_function_context): Likewise. * bitmap.c (bitmap_element_allocate): Likewise. (bitmap_gc_alloc_stat): Likewise. * alias.c (record_alias_subset): Likewise. (init_alias_analysis): Likewise. include: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * splay-tree.h: Update copyright years. (splay_tree_s): Document fields. (splay_tree_new_typed_alloc): New. * hashtab.h: Update copyright years. (htab_create_typed_alloc): New. libcpp: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * include/symtab.h (ht_identifier_ptr): New. libiberty: 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> * splay-tree.c: Update copyright years. (splay_tree_new_typed_alloc): New. (splay_tree_new_with_allocator): Use it. * hashtab.c: Update copyright years. (htab_create_typed_alloc): New. (htab_create_alloc): Use it. * functions.texi: Regenerate. From-SVN: r160425
2010-06-08 09:25:24 +02:00
(sizeof (struct lang_type_ptrmem)); \
TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \
} \
TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \
} while (0)
1994-02-24 02:02:37 +01:00
/* For a pointer-to-member type of the form `T X::*', this is `X'.
For a type like `void (X::*)() const', this type is `X', not `const
X'. To get at the `const X' you have to look at the
TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have
type `const X*'. */
#define TYPE_PTRMEM_CLASS_TYPE(NODE) \
(TYPE_PTRDATAMEM_P (NODE) \
fold-const.c (force_fit_type): Handle OFFSET_TYPE. * fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-23 01:30:22 +02:00
? TYPE_OFFSET_BASETYPE (NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
: TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE))
/* For a pointer-to-member type of the form `T X::*', this is `T'. */
#define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \
(TYPE_PTRDATAMEM_P (NODE) \
fold-const.c (force_fit_type): Handle OFFSET_TYPE. * fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-23 01:30:22 +02:00
? TREE_TYPE (NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
: TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
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
/* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
`X'. */
#define PTRMEM_CST_CLASS(NODE) \
TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
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
/* For a pointer-to-member constant `X::Y' this is the _DECL for
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
`Y'. */
#define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
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
/* The expression in question for a TYPEOF_TYPE. */
split tree_type split tree_type gcc/ada/ * gcc-interface/ada-tree.h (TYPE_OBJECT_RECORD_TYPE): Use TYPE_MINVAL. (TYPE_GCC_MIN_VALUE): Use TYPE_MINVAL. (TYPE_GCC_MAX_VALUE): Use TYPE_MAXVAL. gcc/cp/ * cp-tree.h (TYPENAME_TYPE_FULLNAME, TYPEOF_TYPE_EXPR): Use TYPE_VALUES_RAW. (UNDERLYING_TYPE_TYPE, DECLTYPE_TYPE_EXPR): Likewise. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. gcc/ * ggc-page.c (extra_order_size_table): Use struct tree_type_non_common. * lto-streamer-in.c (unpack_ts_type_value_fields): Rename to... (unpack_ts_type_common_value_fields): ...this. Update comment. (unpack_value_fields): Adjust for renaming. (lto_input_ts_type_tree_pointers): Split into... (lto_input_ts_type_common_tree_pointer): ...this and... (lto_input_ts_type_non_common_tree_pointers): ...this. (lto_input_tree_pointers): Adjust for above split. * lto-streamer-out.c (pack_ts_type_value_fields): Rename to... (pack_ts_type_common_value_fields): ...this. Update comment. (lto_output_ts_type_tree_pointers): Split into... (lto_output_ts_type_common_tree_pointers): ...this and... (lto_output_ts_type_non_common_tree_pointers): ...this. (lto_output_tree_pointers): Adjust for above split. * lto-streamer.c (check_handled_ts_structures): Mark TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, and TS_TYPE_NON_COMMON as handled. * stor-layout.c (vector_type_mode): Adjust location of mode field. * tree.h (MARK_TS_TYPE_COMMON, MARK_TS_TYPE_WITH_LANG_SPECIFIC): Define. (struct tree_type): Split into... (struct tree_type_common: ...this and... (struct tree_type_with_lang_specific): ...this and... (struct tree_type_non_common): ...this. Adjust accessor macros accordingly. (TYPE_VALUES_RAW): Define. (union tree_node): Update for above changes. * tree.c (tree_node_structure_for_code) [tcc_type]: Return TS_TYPE_NON_COMMON. (initialize_tree_contains_struct) [TS_TYPE]: Use TS_TYPE_COMMON. Add TS_TYPE_WITH_LANG_SPECIFIC and TS_TYPE_NON_COMMON. (tree_code_size) [tcc_type]: Use struct tree_type_non_common. * treestructu.def (TS_TYPE): Remove. (TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, TS_TYPE_NON_COMMON): Define. gcc/java/ * java-tree.h (TYPE_ARGUMENT_SIGNATURE): Use TYPE_MINVAL. gcc/lto/ * lto.c (lto_ft_type): Use TYPE_MINVAL and TYPE_MAXVAL. Adjust location of binfo field. (lto_fixup_prevailing_decls): Likewise. gcc/objc/ * objc-act.h (CLASS_NAME, CLASS_SUPER_NAME): Use proper accessors. (CLASS_NST_METHODS, CLASS_CLS_METHODS): Likewise. (PROTOCOL_NAME, PROTOCOL_NST_METHODS, PROTOCOL_CLS_METHODS): Likewise. From-SVN: r173658
2011-05-11 15:48:55 +02:00
#define TYPEOF_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (TYPEOF_TYPE_CHECK (NODE)))
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
/* The type in question for an UNDERLYING_TYPE. */
#define UNDERLYING_TYPE_TYPE(NODE) \
split tree_type split tree_type gcc/ada/ * gcc-interface/ada-tree.h (TYPE_OBJECT_RECORD_TYPE): Use TYPE_MINVAL. (TYPE_GCC_MIN_VALUE): Use TYPE_MINVAL. (TYPE_GCC_MAX_VALUE): Use TYPE_MAXVAL. gcc/cp/ * cp-tree.h (TYPENAME_TYPE_FULLNAME, TYPEOF_TYPE_EXPR): Use TYPE_VALUES_RAW. (UNDERLYING_TYPE_TYPE, DECLTYPE_TYPE_EXPR): Likewise. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. gcc/ * ggc-page.c (extra_order_size_table): Use struct tree_type_non_common. * lto-streamer-in.c (unpack_ts_type_value_fields): Rename to... (unpack_ts_type_common_value_fields): ...this. Update comment. (unpack_value_fields): Adjust for renaming. (lto_input_ts_type_tree_pointers): Split into... (lto_input_ts_type_common_tree_pointer): ...this and... (lto_input_ts_type_non_common_tree_pointers): ...this. (lto_input_tree_pointers): Adjust for above split. * lto-streamer-out.c (pack_ts_type_value_fields): Rename to... (pack_ts_type_common_value_fields): ...this. Update comment. (lto_output_ts_type_tree_pointers): Split into... (lto_output_ts_type_common_tree_pointers): ...this and... (lto_output_ts_type_non_common_tree_pointers): ...this. (lto_output_tree_pointers): Adjust for above split. * lto-streamer.c (check_handled_ts_structures): Mark TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, and TS_TYPE_NON_COMMON as handled. * stor-layout.c (vector_type_mode): Adjust location of mode field. * tree.h (MARK_TS_TYPE_COMMON, MARK_TS_TYPE_WITH_LANG_SPECIFIC): Define. (struct tree_type): Split into... (struct tree_type_common: ...this and... (struct tree_type_with_lang_specific): ...this and... (struct tree_type_non_common): ...this. Adjust accessor macros accordingly. (TYPE_VALUES_RAW): Define. (union tree_node): Update for above changes. * tree.c (tree_node_structure_for_code) [tcc_type]: Return TS_TYPE_NON_COMMON. (initialize_tree_contains_struct) [TS_TYPE]: Use TS_TYPE_COMMON. Add TS_TYPE_WITH_LANG_SPECIFIC and TS_TYPE_NON_COMMON. (tree_code_size) [tcc_type]: Use struct tree_type_non_common. * treestructu.def (TS_TYPE): Remove. (TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, TS_TYPE_NON_COMMON): Define. gcc/java/ * java-tree.h (TYPE_ARGUMENT_SIGNATURE): Use TYPE_MINVAL. gcc/lto/ * lto.c (lto_ft_type): Use TYPE_MINVAL and TYPE_MAXVAL. Adjust location of binfo field. (lto_fixup_prevailing_decls): Likewise. gcc/objc/ * objc-act.h (CLASS_NAME, CLASS_SUPER_NAME): Use proper accessors. (CLASS_NST_METHODS, CLASS_CLS_METHODS): Likewise. (PROTOCOL_NAME, PROTOCOL_NST_METHODS, PROTOCOL_CLS_METHODS): Likewise. From-SVN: r173658
2011-05-11 15:48:55 +02:00
(TYPE_VALUES_RAW (UNDERLYING_TYPE_CHECK (NODE)))
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
[multiple changes] 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * gcc/c-family/c-common.c (c_common_reswords): Add __bases, __direct_bases. * gcc/c-family/c-common.h: Add RID_BASES and RID_DIRECT_BASES. 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * cp-tree.def: Add BASES as a new tree code. * cp-tree.h (enum cp_trait_kind): Add CPTK_BASES, CPTK_DIRECT_BASES. (BASES_TYPE, BASES_DIRECT): Define. (calculate_bases, finish_bases, calculate_direct_bases): Declare. * parser.c (cp_parser_trait_expr, cp_parser_template_argument_list, (cp_parser_simple_type_specifier, cp_parser_save_nsdmi): Use them. * pt.c (find_parameter_packs_r, tsubst_pack_expansion): Likewise. * semantics.c (calculate_bases, finish_bases, calculate_direct_bases, dfs_calculate_bases_pre, dfs_calculate_bases_post, calculate_bases_helper): Define. 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * g++.dg/ext/bases.C: New test. 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * include/tr2/type_traits (bases, direct_bases, typelist): New. 2011-10-17 Benjamin Kosnik <bkoz@redhat.com> * libstdc++-v3/include/Makefile.am: Add tr2 directory and includes. * libstdc++-v3/include/Makefile.in: Regenerate. * scripts/create_testsuite_files: Search tr2 directory. * testsuite/libstdc++-dg/conformance.exp: Same. * testsuite/tr2/bases/requirements/explicit_instantiation.cc: New. * testsuite/tr2/bases/requirements/typedefs.cc: New. * testsuite/tr2/bases/value.cc: New. * testsuite/tr2/direct_bases/requirements/ explicit_instantiation.cc: New. * testsuite/tr2/direct_bases/requirements/typedefs.cc: New. * testsuite/tr2/direct_bases/value.cc: New. From-SVN: r180121
2011-10-18 04:58:06 +02:00
/* The type in question for BASES. */
#define BASES_TYPE(NODE) \
(TYPE_VALUES_RAW (BASES_CHECK (NODE)))
#define BASES_DIRECT(NODE) \
TREE_LANG_FLAG_0 (BASES_CHECK (NODE))
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
/* The expression in question for a DECLTYPE_TYPE. */
split tree_type split tree_type gcc/ada/ * gcc-interface/ada-tree.h (TYPE_OBJECT_RECORD_TYPE): Use TYPE_MINVAL. (TYPE_GCC_MIN_VALUE): Use TYPE_MINVAL. (TYPE_GCC_MAX_VALUE): Use TYPE_MAXVAL. gcc/cp/ * cp-tree.h (TYPENAME_TYPE_FULLNAME, TYPEOF_TYPE_EXPR): Use TYPE_VALUES_RAW. (UNDERLYING_TYPE_TYPE, DECLTYPE_TYPE_EXPR): Likewise. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. gcc/ * ggc-page.c (extra_order_size_table): Use struct tree_type_non_common. * lto-streamer-in.c (unpack_ts_type_value_fields): Rename to... (unpack_ts_type_common_value_fields): ...this. Update comment. (unpack_value_fields): Adjust for renaming. (lto_input_ts_type_tree_pointers): Split into... (lto_input_ts_type_common_tree_pointer): ...this and... (lto_input_ts_type_non_common_tree_pointers): ...this. (lto_input_tree_pointers): Adjust for above split. * lto-streamer-out.c (pack_ts_type_value_fields): Rename to... (pack_ts_type_common_value_fields): ...this. Update comment. (lto_output_ts_type_tree_pointers): Split into... (lto_output_ts_type_common_tree_pointers): ...this and... (lto_output_ts_type_non_common_tree_pointers): ...this. (lto_output_tree_pointers): Adjust for above split. * lto-streamer.c (check_handled_ts_structures): Mark TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, and TS_TYPE_NON_COMMON as handled. * stor-layout.c (vector_type_mode): Adjust location of mode field. * tree.h (MARK_TS_TYPE_COMMON, MARK_TS_TYPE_WITH_LANG_SPECIFIC): Define. (struct tree_type): Split into... (struct tree_type_common: ...this and... (struct tree_type_with_lang_specific): ...this and... (struct tree_type_non_common): ...this. Adjust accessor macros accordingly. (TYPE_VALUES_RAW): Define. (union tree_node): Update for above changes. * tree.c (tree_node_structure_for_code) [tcc_type]: Return TS_TYPE_NON_COMMON. (initialize_tree_contains_struct) [TS_TYPE]: Use TS_TYPE_COMMON. Add TS_TYPE_WITH_LANG_SPECIFIC and TS_TYPE_NON_COMMON. (tree_code_size) [tcc_type]: Use struct tree_type_non_common. * treestructu.def (TS_TYPE): Remove. (TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, TS_TYPE_NON_COMMON): Define. gcc/java/ * java-tree.h (TYPE_ARGUMENT_SIGNATURE): Use TYPE_MINVAL. gcc/lto/ * lto.c (lto_ft_type): Use TYPE_MINVAL and TYPE_MAXVAL. Adjust location of binfo field. (lto_fixup_prevailing_decls): Likewise. gcc/objc/ * objc-act.h (CLASS_NAME, CLASS_SUPER_NAME): Use proper accessors. (CLASS_NST_METHODS, CLASS_CLS_METHODS): Likewise. (PROTOCOL_NAME, PROTOCOL_NST_METHODS, PROTOCOL_CLS_METHODS): Likewise. From-SVN: r173658
2011-05-11 15:48:55 +02:00
#define DECLTYPE_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (DECLTYPE_TYPE_CHECK (NODE)))
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
/* Whether the DECLTYPE_TYPE_EXPR of NODE was originally parsed as an
id-expression or a member-access expression. When false, it was
parsed as a full expression. */
#define DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P(NODE) \
split tree_type split tree_type gcc/ada/ * gcc-interface/ada-tree.h (TYPE_OBJECT_RECORD_TYPE): Use TYPE_MINVAL. (TYPE_GCC_MIN_VALUE): Use TYPE_MINVAL. (TYPE_GCC_MAX_VALUE): Use TYPE_MAXVAL. gcc/cp/ * cp-tree.h (TYPENAME_TYPE_FULLNAME, TYPEOF_TYPE_EXPR): Use TYPE_VALUES_RAW. (UNDERLYING_TYPE_TYPE, DECLTYPE_TYPE_EXPR): Likewise. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. gcc/ * ggc-page.c (extra_order_size_table): Use struct tree_type_non_common. * lto-streamer-in.c (unpack_ts_type_value_fields): Rename to... (unpack_ts_type_common_value_fields): ...this. Update comment. (unpack_value_fields): Adjust for renaming. (lto_input_ts_type_tree_pointers): Split into... (lto_input_ts_type_common_tree_pointer): ...this and... (lto_input_ts_type_non_common_tree_pointers): ...this. (lto_input_tree_pointers): Adjust for above split. * lto-streamer-out.c (pack_ts_type_value_fields): Rename to... (pack_ts_type_common_value_fields): ...this. Update comment. (lto_output_ts_type_tree_pointers): Split into... (lto_output_ts_type_common_tree_pointers): ...this and... (lto_output_ts_type_non_common_tree_pointers): ...this. (lto_output_tree_pointers): Adjust for above split. * lto-streamer.c (check_handled_ts_structures): Mark TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, and TS_TYPE_NON_COMMON as handled. * stor-layout.c (vector_type_mode): Adjust location of mode field. * tree.h (MARK_TS_TYPE_COMMON, MARK_TS_TYPE_WITH_LANG_SPECIFIC): Define. (struct tree_type): Split into... (struct tree_type_common: ...this and... (struct tree_type_with_lang_specific): ...this and... (struct tree_type_non_common): ...this. Adjust accessor macros accordingly. (TYPE_VALUES_RAW): Define. (union tree_node): Update for above changes. * tree.c (tree_node_structure_for_code) [tcc_type]: Return TS_TYPE_NON_COMMON. (initialize_tree_contains_struct) [TS_TYPE]: Use TS_TYPE_COMMON. Add TS_TYPE_WITH_LANG_SPECIFIC and TS_TYPE_NON_COMMON. (tree_code_size) [tcc_type]: Use struct tree_type_non_common. * treestructu.def (TS_TYPE): Remove. (TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, TS_TYPE_NON_COMMON): Define. gcc/java/ * java-tree.h (TYPE_ARGUMENT_SIGNATURE): Use TYPE_MINVAL. gcc/lto/ * lto.c (lto_ft_type): Use TYPE_MINVAL and TYPE_MAXVAL. Adjust location of binfo field. (lto_fixup_prevailing_decls): Likewise. gcc/objc/ * objc-act.h (CLASS_NAME, CLASS_SUPER_NAME): Use proper accessors. (CLASS_NST_METHODS, CLASS_CLS_METHODS): Likewise. (PROTOCOL_NAME, PROTOCOL_NST_METHODS, PROTOCOL_CLS_METHODS): Likewise. From-SVN: r173658
2011-05-11 15:48:55 +02:00
(DECLTYPE_TYPE_CHECK (NODE))->type_common.string_flag
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
/* These flags indicate that we want different semantics from normal
decltype: lambda capture just drops references, init capture
uses auto semantics, lambda proxies look through implicit dereference. */
#define DECLTYPE_FOR_LAMBDA_CAPTURE(NODE) \
TREE_LANG_FLAG_0 (DECLTYPE_TYPE_CHECK (NODE))
#define DECLTYPE_FOR_INIT_CAPTURE(NODE) \
TREE_LANG_FLAG_1 (DECLTYPE_TYPE_CHECK (NODE))
#define DECLTYPE_FOR_LAMBDA_PROXY(NODE) \
TREE_LANG_FLAG_2 (DECLTYPE_TYPE_CHECK (NODE))
#define DECLTYPE_FOR_REF_CAPTURE(NODE) \
TREE_LANG_FLAG_3 (DECLTYPE_TYPE_CHECK (NODE))
/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
specified in its declaration. This can also be set for an
erroneously declared PARM_DECL. */
#define DECL_THIS_EXTERN(NODE) \
DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
1994-02-24 02:02:37 +01:00
/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
specified in its declaration. This can also be set for an
erroneously declared PARM_DECL. */
#define DECL_THIS_STATIC(NODE) \
DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
/* Nonzero for FIELD_DECL node means that this field is a lambda capture
field for an array of runtime bound. */
#define DECL_VLA_CAPTURE_P(NODE) \
DECL_LANG_FLAG_1 (FIELD_DECL_CHECK (NODE))
/* Nonzero for PARM_DECL node means that this is an array function
parameter, i.e, a[] rather than *a. */
#define DECL_ARRAY_PARAMETER_P(NODE) \
DECL_LANG_FLAG_1 (PARM_DECL_CHECK (NODE))
/* Nonzero for a FIELD_DECL who's NSMDI is currently being
instantiated. */
#define DECL_INSTANTIATING_NSDMI_P(NODE) \
DECL_LANG_FLAG_2 (FIELD_DECL_CHECK (NODE))
/* Nonzero for FIELD_DECL node means that this field is a base class
of the parent object, as opposed to a member field. */
#define DECL_FIELD_IS_BASE(NODE) \
DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE))
/* Nonzero for FIELD_DECL node means that this field is a simple (no
explicit initializer) lambda capture field, making it invisible to
name lookup in unevaluated contexts. */
#define DECL_NORMAL_CAPTURE_P(NODE) \
DECL_LANG_FLAG_7 (FIELD_DECL_CHECK (NODE))
/* Nonzero if TYPE is an anonymous union or struct type. We have to use a
flag for this because "A union for which objects or pointers are
declared is not an anonymous union" [class.union]. */
#define ANON_AGGR_TYPE_P(NODE) \
(CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr)
#define SET_ANON_AGGR_TYPE_P(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr = 1)
/* Nonzero if TYPE is an anonymous union type. */
#define ANON_UNION_TYPE_P(NODE) \
(TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
1994-02-24 02:02:37 +01:00
/* Define fields and accessors for nodes representing declared names. */
/* Nonzero if TYPE is an unnamed class with a typedef for linkage purposes. */
#define TYPE_WAS_UNNAMED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
1994-02-24 02:02:37 +01:00
/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
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
/* The format of each node in the DECL_FRIENDLIST is as follows:
The TREE_PURPOSE will be the name of a function, i.e., an
IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, whose
TREE_VALUEs are friends with the given name. */
1994-02-24 02:02:37 +01:00
#define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
#define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
#define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
1994-02-24 02:02:37 +01:00
/* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of
each node is a type; the TREE_VALUE is the access granted for this
DECL in that type. The DECL_ACCESS is set by access declarations.
For example, if a member that would normally be public in a
derived class is made protected, then the derived class and the
protected_access_node will appear in the DECL_ACCESS for the node. */
#define DECL_ACCESS(NODE) (LANG_DECL_U2_CHECK (NODE, 0)->access)
/* Nonzero if the FUNCTION_DECL is a global constructor. */
#define DECL_GLOBAL_CTOR_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->global_ctor_p)
/* Nonzero if the FUNCTION_DECL is a global destructor. */
#define DECL_GLOBAL_DTOR_P(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->global_dtor_p)
1994-02-24 02:02:37 +01:00
/* Accessor macros for C++ template decl nodes. */
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
/* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
is a INT_CST whose TREE_INT_CST_LOW indicates the level of the
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
template parameters, with 1 being the outermost set of template
parameters. The TREE_VALUE is a vector, whose elements are the
template parameters at each level. Each element in the vector is a
TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
non-type parameter), or a TYPE_DECL (if the parameter is a type
parameter). The TREE_PURPOSE is the default value, if any. The
TEMPLATE_PARM_INDEX for the parameter is available as the
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
DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL... * tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL; call langhook for unknown declaration. (find_decls_types_r): Do not walk DECL_ARGUMENT_FLD. * tree.h (DECL_ARGUMENTS): Update. * print-tree.c (print_node): Update. * tree-core.h (tree_decl_non_common): Remove arguments. (tree_function_decl): Add arguments. * class.c (build_clone): Do not clear assembler names of templates. * decl.c (cp_tree_node_structure): Add TEMPLATE_DECL. * cp-objcp-common.c (cp_tree_size): Add TEMPLATE_DECL as a special case return sizeof (struct tree_decl_non_common) for other decls. (cp_common_init_ts): Do not initialize NAMESPACE_DECL; initialize TEMPLATE_DECL as MARK_TS_DECL_COMMON. * cp/cp-tree.h (tree_template_decl): New structure. (cp_tree_node_structure_enum): Add TS_CP_TEMPLATE_DECL. (union cp_lang_tree_node): Add template_decl. (DECL_TEMPLATE_PARMS, DECL_TEMPLATE_RESULT): Update. * lto/lto.c (mentions_vars_p_decl_non_common): Skip DECL_ARGUMENT_FLD. mentions_vars_p_function): Do DECL_ARGUMENTS. (lto_fixup_prevailing_decls): Update. * objc-act.c (objc_common_tree_size): New function. * objc-act.h (KEYWORD_KEY_NAME, KEYWORD_ARG_NAME): Add type checking. (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): New macro. (METHOD_SEL_NAME, METHOD_SEL_ARGS, METHOD_ADD_ARGS, METHOD_ADD_ARGS_ELLIPSIS_P, METHOD_DEFINITION, METHOD_ENCODING, METHOD_TYPE_ATTRIBUTES, METHOD_PROPERTY_CONTEXT): Add type checking. (METHOD_SEL_ARGS): Use decl_common.size instead of decl_non_common.result. (PROPERTY_NAME, PROPERTY_GETTER_NAME, PROPERTY_SETTER_NAME, PROPERTY_READONLY, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS, PROPERTY_IVAR_NAME, PROPERTY_DYNAMIC, PROPERTY_HAS_NO_GETTER, PROPERTY_HAS_NO_SETTER, PROPERTY_OPTIONAL): Add type checking. (objc_common_tree_size): Declare. * objc/objc-lang.c (LANG_HOOKS_TREE_SIZE): New macro. From-SVN: r212549
2014-07-15 12:17:32 +02:00
TYPE_DECL).
FIXME: CONST_CAST_TREE is a hack that hopefully will go away after
tree is converted to C++ class hiearchy. */
#define DECL_TEMPLATE_PARMS(NODE) \
tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL... * tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL; call langhook for unknown declaration. (find_decls_types_r): Do not walk DECL_ARGUMENT_FLD. * tree.h (DECL_ARGUMENTS): Update. * print-tree.c (print_node): Update. * tree-core.h (tree_decl_non_common): Remove arguments. (tree_function_decl): Add arguments. * class.c (build_clone): Do not clear assembler names of templates. * decl.c (cp_tree_node_structure): Add TEMPLATE_DECL. * cp-objcp-common.c (cp_tree_size): Add TEMPLATE_DECL as a special case return sizeof (struct tree_decl_non_common) for other decls. (cp_common_init_ts): Do not initialize NAMESPACE_DECL; initialize TEMPLATE_DECL as MARK_TS_DECL_COMMON. * cp/cp-tree.h (tree_template_decl): New structure. (cp_tree_node_structure_enum): Add TS_CP_TEMPLATE_DECL. (union cp_lang_tree_node): Add template_decl. (DECL_TEMPLATE_PARMS, DECL_TEMPLATE_RESULT): Update. * lto/lto.c (mentions_vars_p_decl_non_common): Skip DECL_ARGUMENT_FLD. mentions_vars_p_function): Do DECL_ARGUMENTS. (lto_fixup_prevailing_decls): Update. * objc-act.c (objc_common_tree_size): New function. * objc-act.h (KEYWORD_KEY_NAME, KEYWORD_ARG_NAME): Add type checking. (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): New macro. (METHOD_SEL_NAME, METHOD_SEL_ARGS, METHOD_ADD_ARGS, METHOD_ADD_ARGS_ELLIPSIS_P, METHOD_DEFINITION, METHOD_ENCODING, METHOD_TYPE_ATTRIBUTES, METHOD_PROPERTY_CONTEXT): Add type checking. (METHOD_SEL_ARGS): Use decl_common.size instead of decl_non_common.result. (PROPERTY_NAME, PROPERTY_GETTER_NAME, PROPERTY_SETTER_NAME, PROPERTY_READONLY, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS, PROPERTY_IVAR_NAME, PROPERTY_DYNAMIC, PROPERTY_HAS_NO_GETTER, PROPERTY_HAS_NO_SETTER, PROPERTY_OPTIONAL): Add type checking. (objc_common_tree_size): Declare. * objc/objc-lang.c (LANG_HOOKS_TREE_SIZE): New macro. From-SVN: r212549
2014-07-15 12:17:32 +02:00
((struct tree_template_decl *)CONST_CAST_TREE (TEMPLATE_DECL_CHECK (NODE)))->arguments
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
#define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
#define DECL_NTPARMS(NODE) \
TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL... * tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL; call langhook for unknown declaration. (find_decls_types_r): Do not walk DECL_ARGUMENT_FLD. * tree.h (DECL_ARGUMENTS): Update. * print-tree.c (print_node): Update. * tree-core.h (tree_decl_non_common): Remove arguments. (tree_function_decl): Add arguments. * class.c (build_clone): Do not clear assembler names of templates. * decl.c (cp_tree_node_structure): Add TEMPLATE_DECL. * cp-objcp-common.c (cp_tree_size): Add TEMPLATE_DECL as a special case return sizeof (struct tree_decl_non_common) for other decls. (cp_common_init_ts): Do not initialize NAMESPACE_DECL; initialize TEMPLATE_DECL as MARK_TS_DECL_COMMON. * cp/cp-tree.h (tree_template_decl): New structure. (cp_tree_node_structure_enum): Add TS_CP_TEMPLATE_DECL. (union cp_lang_tree_node): Add template_decl. (DECL_TEMPLATE_PARMS, DECL_TEMPLATE_RESULT): Update. * lto/lto.c (mentions_vars_p_decl_non_common): Skip DECL_ARGUMENT_FLD. mentions_vars_p_function): Do DECL_ARGUMENTS. (lto_fixup_prevailing_decls): Update. * objc-act.c (objc_common_tree_size): New function. * objc-act.h (KEYWORD_KEY_NAME, KEYWORD_ARG_NAME): Add type checking. (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): New macro. (METHOD_SEL_NAME, METHOD_SEL_ARGS, METHOD_ADD_ARGS, METHOD_ADD_ARGS_ELLIPSIS_P, METHOD_DEFINITION, METHOD_ENCODING, METHOD_TYPE_ATTRIBUTES, METHOD_PROPERTY_CONTEXT): Add type checking. (METHOD_SEL_ARGS): Use decl_common.size instead of decl_non_common.result. (PROPERTY_NAME, PROPERTY_GETTER_NAME, PROPERTY_SETTER_NAME, PROPERTY_READONLY, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS, PROPERTY_IVAR_NAME, PROPERTY_DYNAMIC, PROPERTY_HAS_NO_GETTER, PROPERTY_HAS_NO_SETTER, PROPERTY_OPTIONAL): Add type checking. (objc_common_tree_size): Declare. * objc/objc-lang.c (LANG_HOOKS_TREE_SIZE): New macro. From-SVN: r212549
2014-07-15 12:17:32 +02:00
/* For function, method, class-data templates.
FIXME: CONST_CAST_TREE is a hack that hopefully will go away after
tree is converted to C++ class hiearchy. */
#define DECL_TEMPLATE_RESULT(NODE) \
tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL... * tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL, NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL; call langhook for unknown declaration. (find_decls_types_r): Do not walk DECL_ARGUMENT_FLD. * tree.h (DECL_ARGUMENTS): Update. * print-tree.c (print_node): Update. * tree-core.h (tree_decl_non_common): Remove arguments. (tree_function_decl): Add arguments. * class.c (build_clone): Do not clear assembler names of templates. * decl.c (cp_tree_node_structure): Add TEMPLATE_DECL. * cp-objcp-common.c (cp_tree_size): Add TEMPLATE_DECL as a special case return sizeof (struct tree_decl_non_common) for other decls. (cp_common_init_ts): Do not initialize NAMESPACE_DECL; initialize TEMPLATE_DECL as MARK_TS_DECL_COMMON. * cp/cp-tree.h (tree_template_decl): New structure. (cp_tree_node_structure_enum): Add TS_CP_TEMPLATE_DECL. (union cp_lang_tree_node): Add template_decl. (DECL_TEMPLATE_PARMS, DECL_TEMPLATE_RESULT): Update. * lto/lto.c (mentions_vars_p_decl_non_common): Skip DECL_ARGUMENT_FLD. mentions_vars_p_function): Do DECL_ARGUMENTS. (lto_fixup_prevailing_decls): Update. * objc-act.c (objc_common_tree_size): New function. * objc-act.h (KEYWORD_KEY_NAME, KEYWORD_ARG_NAME): Add type checking. (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): New macro. (METHOD_SEL_NAME, METHOD_SEL_ARGS, METHOD_ADD_ARGS, METHOD_ADD_ARGS_ELLIPSIS_P, METHOD_DEFINITION, METHOD_ENCODING, METHOD_TYPE_ATTRIBUTES, METHOD_PROPERTY_CONTEXT): Add type checking. (METHOD_SEL_ARGS): Use decl_common.size instead of decl_non_common.result. (PROPERTY_NAME, PROPERTY_GETTER_NAME, PROPERTY_SETTER_NAME, PROPERTY_READONLY, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS, PROPERTY_IVAR_NAME, PROPERTY_DYNAMIC, PROPERTY_HAS_NO_GETTER, PROPERTY_HAS_NO_SETTER, PROPERTY_OPTIONAL): Add type checking. (objc_common_tree_size): Declare. * objc/objc-lang.c (LANG_HOOKS_TREE_SIZE): New macro. From-SVN: r212549
2014-07-15 12:17:32 +02:00
((struct tree_template_decl *)CONST_CAST_TREE(TEMPLATE_DECL_CHECK (NODE)))->result
/* For a function template at namespace scope, DECL_TEMPLATE_INSTANTIATIONS
lists all instantiations and specializations of the function so that
tsubst_friend_function can reassign them to another template if we find
that the namespace-scope template is really a partial instantiation of a
friend template.
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
For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
all instantiations and specializations of the class type, including
partial instantiations and partial specializations, so that if we
explicitly specialize a partial instantiation we can walk the list
in maybe_process_partial_specialization and reassign them or complain
as appropriate.
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
In both cases, the TREE_PURPOSE of each node contains the arguments
used; the TREE_VALUE contains the generated variable. The template
arguments are always complete. For example, given:
template <class T> struct S1 {
template <class U> struct S2 {};
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
template <class U> struct S2<U*> {};
};
the record for the partial specialization will contain, as its
argument list, { {T}, {U*} }, and will be on the
DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
<class U> struct S1<T>::S2'.
This list is not used for other templates. */
#define DECL_TEMPLATE_INSTANTIATIONS(NODE) \
DECL_SIZE_UNIT (TEMPLATE_DECL_CHECK (NODE))
/* For a class template, this list contains the partial
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
specializations of this template. (Full specializations are not
recorded on this list.) The TREE_PURPOSE holds the arguments used
in the partial specialization (e.g., for `template <class T> struct
S<T*, int>' this will be `T*, int'.) The arguments will also include
any outer template arguments. The TREE_VALUE holds the TEMPLATE_DECL
for the partial specialization. The TREE_TYPE is the _TYPE node for
the partial specialization.
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
This list is not used for other templates. */
#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) \
DECL_SIZE (TEMPLATE_DECL_CHECK (NODE))
/* Nonzero for a DECL which is actually a template parameter. Keep
these checks in ascending tree code order. */
#define DECL_TEMPLATE_PARM_P(NODE) \
cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * call.c (equal_functions): Use DECL_LOCAL_FUCNTION_P, not TREE_PERMANENT. * decl.c (pushdecl): Set DECL_LOCAL_FUNCTION_P. * decl2.c (lookup_arg_dependent): Use it. * cp-tree.h (cp_finish_decl): Change prototype. (finish_static_data_member_decl): Likewise. (push_permanent_obstack): Remove declaration. (push_expression_obstack): Likewise. (push_scratch_obstack): Likewise. (DECL_TEMPLATE_PARM_P): Robustify. (SET_DECL_TEMPLATE_PARM_P): New macro. * class.c (add_method): Don't manipulate obstacks. (finish_vtbls): Likewise. * cvt.c (build_up_reference): Adjust calls to cp_finish_decl. * decl.c (binding_for_name): Don't manipulate obstacks. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (implicitly_declare): Likewise. (build_typename_type): Likewise. (start_decl): Likewise. (cp_finish_decl): Likewise. (finish_decl): Likewise. (destroy_local_static): Likewise. (expand_static_init): Likewise. (complete_array_type): Likewise. (grokvardecl): Likewise. (build_ptrmemfnc_type): Likewise. (grokdeclarator): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. (start_enum): Likewise. (finish_enum): Likewise. (start_function): Likewise. (finish_function): Likewise. (start_method): Adjust call to cp_finish_decl. * decl2.c (finish_static_data_member_decl): Don't manipulate obstacks. (grokfield): Likewise. (grokbitfield): Likewise. (get_temp_name): Likewise. (get_sentry): Likewise. (fnish_file): Likewise. (lookup_arg_dependent): Likewise. * except.c (call_eh_info): Likewise. (push_eh_info): Likewise. (do_pop_exception): Likewise. (initialize_handler_parm): Likewise. (expand_end_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * expr.c (extract_scalar_init): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (snarf_defarg): Likewise. (add_defarg_fn): Likewise. (is_global): Simplify. (do_identifier): Don't check TREE_PERMANENT. * method.c (emit_thunk): Don't manipulate obstacks. * parse.y (condition): Adjust call to cp_finish_decl. (primary): Likewise. (initdcl): Likewise. (initdcl0_innards): Likewise. (nomods_initdcl0): Likewise. * pt.c (push_inline_template_parms_recursive): Use SET_DECL_TEMPLATE_PARM_P. (process_template_parm): Likewise. (lookup_template_class): Don't manipulate obstacks. (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_decl): Don't manipulate obstacks. (tsubst_expr): Likewise. (instantiate_template): Likewise. (instantiate_decl): Adjust calls to cp_finish_decl. * rtti.c (call_void_fn): Don't manipulate obstacks. (get_tinfo_var): Likewise. (get_tinfo_fn_unused): Likewise. (build_dynamic_cast_1): Likewise. (expand_si_desc): Likewise. (expand_class_desc): Likewise. (expand_ptr_desc): Likewise. (expand_attr_desc): Likewise. (expand_generic_desc): Likewise. (synthesize_tinfo_fn): Likewise. * search.c (expand_upcast_fixups): Likewise. * semantics.c (finish_asm_stmt): Likewise. (finish_named_return_value): Likewise. (begin_class_definition): Likewise. (finish_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (build_cplus_method_type): Likewise. (reverse_path): Likewise. (copy_template_template_parm): Likewise. (build_expr_ptr_wrapper): Likewise. (push_expression_obstack): Remove. (push_permanent_obstack): Likewise. * typeck.c (mark_addressable): Likewise. From-SVN: r30527
1999-11-14 21:29:06 +01:00
(DECL_LANG_FLAG_0 (NODE) \
&& (TREE_CODE (NODE) == CONST_DECL \
|| TREE_CODE (NODE) == PARM_DECL \
cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * call.c (equal_functions): Use DECL_LOCAL_FUCNTION_P, not TREE_PERMANENT. * decl.c (pushdecl): Set DECL_LOCAL_FUNCTION_P. * decl2.c (lookup_arg_dependent): Use it. * cp-tree.h (cp_finish_decl): Change prototype. (finish_static_data_member_decl): Likewise. (push_permanent_obstack): Remove declaration. (push_expression_obstack): Likewise. (push_scratch_obstack): Likewise. (DECL_TEMPLATE_PARM_P): Robustify. (SET_DECL_TEMPLATE_PARM_P): New macro. * class.c (add_method): Don't manipulate obstacks. (finish_vtbls): Likewise. * cvt.c (build_up_reference): Adjust calls to cp_finish_decl. * decl.c (binding_for_name): Don't manipulate obstacks. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (implicitly_declare): Likewise. (build_typename_type): Likewise. (start_decl): Likewise. (cp_finish_decl): Likewise. (finish_decl): Likewise. (destroy_local_static): Likewise. (expand_static_init): Likewise. (complete_array_type): Likewise. (grokvardecl): Likewise. (build_ptrmemfnc_type): Likewise. (grokdeclarator): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. (start_enum): Likewise. (finish_enum): Likewise. (start_function): Likewise. (finish_function): Likewise. (start_method): Adjust call to cp_finish_decl. * decl2.c (finish_static_data_member_decl): Don't manipulate obstacks. (grokfield): Likewise. (grokbitfield): Likewise. (get_temp_name): Likewise. (get_sentry): Likewise. (fnish_file): Likewise. (lookup_arg_dependent): Likewise. * except.c (call_eh_info): Likewise. (push_eh_info): Likewise. (do_pop_exception): Likewise. (initialize_handler_parm): Likewise. (expand_end_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * expr.c (extract_scalar_init): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (snarf_defarg): Likewise. (add_defarg_fn): Likewise. (is_global): Simplify. (do_identifier): Don't check TREE_PERMANENT. * method.c (emit_thunk): Don't manipulate obstacks. * parse.y (condition): Adjust call to cp_finish_decl. (primary): Likewise. (initdcl): Likewise. (initdcl0_innards): Likewise. (nomods_initdcl0): Likewise. * pt.c (push_inline_template_parms_recursive): Use SET_DECL_TEMPLATE_PARM_P. (process_template_parm): Likewise. (lookup_template_class): Don't manipulate obstacks. (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_decl): Don't manipulate obstacks. (tsubst_expr): Likewise. (instantiate_template): Likewise. (instantiate_decl): Adjust calls to cp_finish_decl. * rtti.c (call_void_fn): Don't manipulate obstacks. (get_tinfo_var): Likewise. (get_tinfo_fn_unused): Likewise. (build_dynamic_cast_1): Likewise. (expand_si_desc): Likewise. (expand_class_desc): Likewise. (expand_ptr_desc): Likewise. (expand_attr_desc): Likewise. (expand_generic_desc): Likewise. (synthesize_tinfo_fn): Likewise. * search.c (expand_upcast_fixups): Likewise. * semantics.c (finish_asm_stmt): Likewise. (finish_named_return_value): Likewise. (begin_class_definition): Likewise. (finish_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (build_cplus_method_type): Likewise. (reverse_path): Likewise. (copy_template_template_parm): Likewise. (build_expr_ptr_wrapper): Likewise. (push_expression_obstack): Remove. (push_permanent_obstack): Likewise. * typeck.c (mark_addressable): Likewise. From-SVN: r30527
1999-11-14 21:29:06 +01:00
|| TREE_CODE (NODE) == TYPE_DECL \
|| TREE_CODE (NODE) == TEMPLATE_DECL))
/* Mark NODE as a template parameter. */
#define SET_DECL_TEMPLATE_PARM_P(NODE) \
(DECL_LANG_FLAG_0 (NODE) = 1)
cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro. * call.c (equal_functions): Use DECL_LOCAL_FUCNTION_P, not TREE_PERMANENT. * decl.c (pushdecl): Set DECL_LOCAL_FUNCTION_P. * decl2.c (lookup_arg_dependent): Use it. * cp-tree.h (cp_finish_decl): Change prototype. (finish_static_data_member_decl): Likewise. (push_permanent_obstack): Remove declaration. (push_expression_obstack): Likewise. (push_scratch_obstack): Likewise. (DECL_TEMPLATE_PARM_P): Robustify. (SET_DECL_TEMPLATE_PARM_P): New macro. * class.c (add_method): Don't manipulate obstacks. (finish_vtbls): Likewise. * cvt.c (build_up_reference): Adjust calls to cp_finish_decl. * decl.c (binding_for_name): Don't manipulate obstacks. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (implicitly_declare): Likewise. (build_typename_type): Likewise. (start_decl): Likewise. (cp_finish_decl): Likewise. (finish_decl): Likewise. (destroy_local_static): Likewise. (expand_static_init): Likewise. (complete_array_type): Likewise. (grokvardecl): Likewise. (build_ptrmemfnc_type): Likewise. (grokdeclarator): Likewise. (xref_tag): Likewise. (xref_basetypes): Likewise. (start_enum): Likewise. (finish_enum): Likewise. (start_function): Likewise. (finish_function): Likewise. (start_method): Adjust call to cp_finish_decl. * decl2.c (finish_static_data_member_decl): Don't manipulate obstacks. (grokfield): Likewise. (grokbitfield): Likewise. (get_temp_name): Likewise. (get_sentry): Likewise. (fnish_file): Likewise. (lookup_arg_dependent): Likewise. * except.c (call_eh_info): Likewise. (push_eh_info): Likewise. (do_pop_exception): Likewise. (initialize_handler_parm): Likewise. (expand_end_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * expr.c (extract_scalar_init): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (snarf_defarg): Likewise. (add_defarg_fn): Likewise. (is_global): Simplify. (do_identifier): Don't check TREE_PERMANENT. * method.c (emit_thunk): Don't manipulate obstacks. * parse.y (condition): Adjust call to cp_finish_decl. (primary): Likewise. (initdcl): Likewise. (initdcl0_innards): Likewise. (nomods_initdcl0): Likewise. * pt.c (push_inline_template_parms_recursive): Use SET_DECL_TEMPLATE_PARM_P. (process_template_parm): Likewise. (lookup_template_class): Don't manipulate obstacks. (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_decl): Don't manipulate obstacks. (tsubst_expr): Likewise. (instantiate_template): Likewise. (instantiate_decl): Adjust calls to cp_finish_decl. * rtti.c (call_void_fn): Don't manipulate obstacks. (get_tinfo_var): Likewise. (get_tinfo_fn_unused): Likewise. (build_dynamic_cast_1): Likewise. (expand_si_desc): Likewise. (expand_class_desc): Likewise. (expand_ptr_desc): Likewise. (expand_attr_desc): Likewise. (expand_generic_desc): Likewise. (synthesize_tinfo_fn): Likewise. * search.c (expand_upcast_fixups): Likewise. * semantics.c (finish_asm_stmt): Likewise. (finish_named_return_value): Likewise. (begin_class_definition): Likewise. (finish_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (build_cplus_method_type): Likewise. (reverse_path): Likewise. (copy_template_template_parm): Likewise. (build_expr_ptr_wrapper): Likewise. (push_expression_obstack): Remove. (push_permanent_obstack): Likewise. * typeck.c (mark_addressable): Likewise. From-SVN: r30527
1999-11-14 21:29:06 +01:00
/* Nonzero if NODE is a template template parameter. */
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
#define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
(TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
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
/* Nonzero for a DECL that represents a function template. */
#define DECL_FUNCTION_TEMPLATE_P(NODE) \
(TREE_CODE (NODE) == TEMPLATE_DECL \
&& DECL_TEMPLATE_RESULT (NODE) != NULL_TREE \
&& TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_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
/* Nonzero for a DECL that represents a class template or alias
template. */
#define DECL_TYPE_TEMPLATE_P(NODE) \
(TREE_CODE (NODE) == TEMPLATE_DECL \
&& DECL_TEMPLATE_RESULT (NODE) != NULL_TREE \
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_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL)
/* Nonzero for a DECL that represents a class template. */
#define DECL_CLASS_TEMPLATE_P(NODE) \
(DECL_TYPE_TEMPLATE_P (NODE) \
&& DECL_IMPLICIT_TYPEDEF_P (DECL_TEMPLATE_RESULT (NODE)))
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
/* Nonzero for a TEMPLATE_DECL that represents an alias template. */
#define DECL_ALIAS_TEMPLATE_P(NODE) \
(DECL_TYPE_TEMPLATE_P (NODE) \
&& !DECL_ARTIFICIAL (DECL_TEMPLATE_RESULT (NODE)))
/* Nonzero for a NODE which declares a type. */
#define DECL_DECLARES_TYPE_P(NODE) \
(TREE_CODE (NODE) == TYPE_DECL || DECL_TYPE_TEMPLATE_P (NODE))
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
/* Nonzero if NODE declares a function. */
#define DECL_DECLARES_FUNCTION_P(NODE) \
(TREE_CODE (NODE) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (NODE))
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
/* Nonzero if NODE is the typedef implicitly generated for a type when
the type is declared. In C++, `struct S {};' is roughly
equivalent to `struct S {}; typedef struct S S;' in C.
DECL_IMPLICIT_TYPEDEF_P will hold for the typedef indicated in this
example. In C++, there is a second implicit typedef for each
class, called the injected-class-name, in the scope of `S' itself, so that
you can say `S::S'. DECL_SELF_REFERENCE_P will hold for that typedef. */
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
#define DECL_IMPLICIT_TYPEDEF_P(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE))
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
#define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(DECL_LANG_FLAG_2 (NODE) = 1)
#define DECL_SELF_REFERENCE_P(NODE) \
(TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_4 (NODE))
#define SET_DECL_SELF_REFERENCE_P(NODE) \
(DECL_LANG_FLAG_4 (NODE) = 1)
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
/* A `primary' template is one that has its own template header and is not
a partial specialization. A member function of a class template is a
template, but not primary. A member template is primary. Friend
templates are primary, too. */
/* Returns the primary template corresponding to these parameters. */
#define DECL_PRIMARY_TEMPLATE(NODE) \
(TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
/* Returns nonzero if NODE is a primary template. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE))
/* Nonzero iff NODE is a specialization of a template. The value
indicates the type of specializations:
1=implicit instantiation
2=partial or explicit specialization, e.g.:
template <> int min<int> (int, int),
3=explicit instantiation, e.g.:
template int min<int> (int, int);
Note that NODE will be marked as a specialization even if the
template it is instantiating is not a primary template. For
example, given:
template <typename T> struct O {
void f();
struct I {};
};
both O<int>::f and O<int>::I will be marked as instantiations.
If DECL_USE_TEMPLATE is nonzero, then DECL_TEMPLATE_INFO will also
be non-NULL. */
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->u.base.use_template)
/* Like DECL_USE_TEMPLATE, but for class types. */
#define CLASSTYPE_USE_TEMPLATE(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->use_template)
/* True if NODE is a specialization of a primary template. */
#define CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P(NODE) \
(CLASS_TYPE_P (NODE) \
&& CLASSTYPE_USE_TEMPLATE (NODE) \
Emit DWARF for template parameters (PR debug/30161) ChangeLog: PR debug/30161 * include/dwarf2.h (enum dwarf_tag): Added DW_TAG_GNU_template_template_param (enum dwarf_attribute): Added DW_AT_GNU_template_name. gcc/ChangeLog: PR debug/30161 * cgraph.h (cgraph_get_node): Declare ... * cgraph.c (cgraph_get_node): ... new function. * dwarf2out.c (gen_generic_params_dies, generic_parameter_die, tree_add_const_value_attribute_for_decl, make_ith_pack_parameter_name, append_entry_to_tmpl_value_parm_die_table, gen_remaining_tmpl_value_param_die_attribute): New functions. (gen_subprogram_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_const_die): Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_struct_or_union_type_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. (tree_add_const_value_attribute): Handle integral and pointer constants. Update comment. (dwarf_tag_name): Support DW_TAG_GNU_template_template_param. (dwarf_attr_name): Support DW_AT_GNU_template_name. (reference_to_unused): Fix thinko. Remove redundant predicates from tests. (tree_add_const_value_attribute): Make this work for constant expressions only. tree_add_const_value_attribute_for_decl is to be used for variable DECLs now. (add_location_or_const_value_attribute): Use tree_add_const_value_attribute_for_decl now. (dwarf2out_finish): Emit the DW_AT_const_value attribute of DW_TAG_template_value_param DIEs after function DIEs have been emitted. * langhooks.h (lang_hooks_for_types): Add get_argument_pack_elems. (lang_hooks_for_decls): Add generic_generic_parameter_decl_p. (lang_hooks): Added get_innermost_generic_parms, get_innermost_generic_args. * langhooks-def.h (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P): New language hooks. gcc/cp/ChangeLog: PR debug/30161 * cp-tree.h (get_template_info): Parameter should be const. (CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P): Fix typo. (get_template_argument_pack_elems, get_primary_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): Declare ... * pt.c (get_template_argument_pack_elems, get_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): ... New C++ front end implementation of new language hooks. (primary_template_instantiation_p): New private helper. (make_ith_pack_parameter_name): Use snprintf and strnlen instead of printf and strlen. (get_template_info): Const-ify parameter. * cp-lang.c (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_TYPE_PARAMETER_DECL_P): Initialize these interfaces for the C++ front-end. gcc/testsuite/ChangeLog: PR debug/30161 * g++.dg/debug/dwarf2/template-params-1.C: New test. * g++.dg/debug/dwarf2/template-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-1.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-7.C: Likewise. From-SVN: r151249
2009-08-31 23:48:04 +02:00
&& PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
#define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
#define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
(CLASSTYPE_USE_TEMPLATE (NODE) & 1)
#define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
#define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
/* Returns true for an explicit or partial specialization of a class
template. */
#define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
(CLASSTYPE_USE_TEMPLATE (NODE) == 2)
#define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
(CLASSTYPE_USE_TEMPLATE (NODE) = 2)
#define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
#define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
#define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(CLASSTYPE_USE_TEMPLATE (NODE) == 1)
#define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(CLASSTYPE_USE_TEMPLATE (NODE) = 1)
#define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
#define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
#define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(CLASSTYPE_USE_TEMPLATE (NODE) == 3)
#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
(CLASSTYPE_USE_TEMPLATE (NODE) = 3)
/* Nonzero if DECL is a friend function which is an instantiation
from the point of view of the compiler, but not from the point of
view of the language. For example given:
template <class T> struct S { friend void f(T) {}; };
the declaration of `void f(int)' generated when S<int> is
instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
a DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION. */
#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
(DECL_LANG_SPECIFIC (DECL) && DECL_TEMPLATE_INFO (DECL) \
&& !DECL_USE_TEMPLATE (DECL))
/* Nonzero if DECL is a function generated from a function 'temploid',
i.e. template, member of class template, or dependent friend. */
#define DECL_TEMPLOID_INSTANTIATION(DECL) \
(DECL_TEMPLATE_INSTANTIATION (DECL) \
|| DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (DECL))
/* Nonzero if DECL is either defined implicitly by the compiler or
generated from a temploid. */
#define DECL_GENERATED_P(DECL) \
(DECL_TEMPLOID_INSTANTIATION (DECL) || DECL_DEFAULTED_FN (DECL))
/* Nonzero iff we are currently processing a declaration for an
entity with its own template parameter list, and which is not a
full specialization. */
#define PROCESSING_REAL_TEMPLATE_DECL_P() \
(processing_template_decl > template_class_depth (current_scope ()))
/* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
instantiated, i.e. its definition has been generated from the
pattern given in the template. */
#define DECL_TEMPLATE_INSTANTIATED(NODE) \
DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
/* We know what we're doing with this decl now. */
1995-02-18 23:06:40 +01:00
#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
/* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
so that assemble_external will work properly. So we have this flag to
tell us whether the decl is really not external.
This flag does not indicate whether or not the decl is defined in the
current translation unit; it indicates whether or not we should emit the
decl at the end of compilation if it is defined and needed. */
#define DECL_NOT_REALLY_EXTERN(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_LANG_SPECIFIC (NODE)->u.base.not_really_extern)
#define DECL_REALLY_EXTERN(NODE) \
(DECL_EXTERNAL (NODE) \
&& (!DECL_LANG_SPECIFIC (NODE) || !DECL_NOT_REALLY_EXTERN (NODE)))
/* A thunk is a stub function.
A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
The address of the ordinary FUNCTION_DECL is given by the
DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
FUNCTION_DECL. The job of the thunk is to either adjust the this
pointer before transferring control to the FUNCTION_DECL, or call
FUNCTION_DECL and then adjust the result value. Note, the result
pointer adjusting thunk must perform a call to the thunked
function, (or be implemented via passing some invisible parameter
to the thunked function, which is modified to perform the
adjustment just before returning).
A thunk may perform either, or both, of the following operations:
o Adjust the this or result pointer by a constant offset.
o Adjust the this or result pointer by looking up a vcall or vbase offset
in the vtable.
A this pointer adjusting thunk converts from a base to a derived
class, and hence adds the offsets. A result pointer adjusting thunk
converts from a derived class to a base, and hence subtracts the
offsets. If both operations are performed, then the constant
adjustment is performed first for this pointer adjustment and last
for the result pointer adjustment.
The constant adjustment is given by THUNK_FIXED_OFFSET. If the
vcall or vbase offset is required, THUNK_VIRTUAL_OFFSET is
used. For this pointer adjusting thunks, it is the vcall offset
into the vtable. For result pointer adjusting thunks it is the
binfo of the virtual base to convert to. Use that binfo's vbase
offset.
It is possible to have equivalent covariant thunks. These are
distinct virtual covariant thunks whose vbase offsets happen to
have the same value. THUNK_ALIAS is used to pick one as the
canonical thunk, which will get all the this pointer adjusting
thunks attached to it. */
/* An integer indicating how many bytes should be subtracted from the
this or result pointer when this function is called. */
#define THUNK_FIXED_OFFSET(DECL) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_LANG_SPECIFIC (THUNK_FUNCTION_CHECK (DECL))->u.fn.u5.fixed_offset)
/* A tree indicating how to perform the virtual adjustment. For a this
adjusting thunk it is the number of bytes to be added to the vtable
to find the vcall offset. For a result adjusting thunk, it is the
binfo of the relevant virtual base. If NULL, then there is no
virtual adjust. (The vptr is always located at offset zero from
the this or result pointer.) (If the covariant type is within the
class hierarchy being laid out, the vbase index is not yet known
at the point we need to create the thunks, hence the need to use
binfos.) */
#define THUNK_VIRTUAL_OFFSET(DECL) \
(LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->access)
/* A thunk which is equivalent to another thunk. */
#define THUNK_ALIAS(DECL) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.min.template_info)
/* For thunk NODE, this is the FUNCTION_DECL thunked to. It is
possible for the target to be a thunk too. */
#define THUNK_TARGET(NODE) \
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
(LANG_DECL_FN_CHECK (NODE)->befriending_classes)
re PR c++/22137 (Internal error: Segmentation fault (program cc1plus)) PR c++/22137 * cp-tree.h (QUALIFIED_NAME_IS_TEMPLATE): New macro. (check_template_keyword): New function. (finish_id_expression): Change prototoype. (finish_qualified_id_expr): Change prototype. (build_qualified_name): New function. (finish_class_member_access_expr): Change prototype. * init.c (build_offset_ref): Use build_qualified_name. * mangle.c (write_expression): Likewise. * parser.c (cp_parser_primary_expression): Remove qualifying_class parameter. Add address_p and template_arg_p. Use build_qualified_name. (cp_parser_id_expression): Default *template_p to template_keyword_p. Check for invalid uses of the template keyword. (cp_parser_postfix_expression): Eliminate special handling for qualified names. Adjust call to cp_parser_primary_expression. (cp_parser_postfix_dot_deref_expression): Adjust call to cp_parser_id_expression and finish_class_member_access_expr. (cp_parser_template_argument_list): Add comment. (cp_parser_template_argument): Adjust use of cp_parser_primary_expression. Remove call to finish_qualified_id_expr. (cp_parser_lookup_name): Use build_qualified_name. * pt.c (tsubst): Use build_qualified_name. (tsubst_qualified_id): Likewise. Adjust call to finish_qualified_id_expr. (tsubst_copy): Use build_qualified_name. (tsubst_copy_and_build): Adjusts call to finish_id_expression and finish_class_member_access_expr. * semantics.c (finish_non_static_data_member): Use build_qualified_name. (finish_qualified_id_expr): Add template_p and template_arg_p parameters. (finish_id_expression): Remove qualifiying_class parameter. Add template_p, done, address_p, and template_arg_p. Use build_qualified_name. Adjust calls to finish_class_member_acess_expr. * tree.c (build_qualified_name): New function. * typeck.c (check_template_keyword): New function. (finish_class_member_access_expr): Add template_p argument. Check for invalid uses of the template keyword. PR c++/22137 * g++.dg/parse/template18.C: New test. * g++.dg/template/nontype15.C: Likewise. From-SVN: r105463
2005-10-16 21:38:57 +02:00
/* True for a SCOPE_REF iff the "template" keyword was used to
indicate that the qualified name denotes a template. */
#define QUALIFIED_NAME_IS_TEMPLATE(NODE) \
(TREE_LANG_FLAG_1 (SCOPE_REF_CHECK (NODE)))
re PR c++/22137 (Internal error: Segmentation fault (program cc1plus)) PR c++/22137 * cp-tree.h (QUALIFIED_NAME_IS_TEMPLATE): New macro. (check_template_keyword): New function. (finish_id_expression): Change prototoype. (finish_qualified_id_expr): Change prototype. (build_qualified_name): New function. (finish_class_member_access_expr): Change prototype. * init.c (build_offset_ref): Use build_qualified_name. * mangle.c (write_expression): Likewise. * parser.c (cp_parser_primary_expression): Remove qualifying_class parameter. Add address_p and template_arg_p. Use build_qualified_name. (cp_parser_id_expression): Default *template_p to template_keyword_p. Check for invalid uses of the template keyword. (cp_parser_postfix_expression): Eliminate special handling for qualified names. Adjust call to cp_parser_primary_expression. (cp_parser_postfix_dot_deref_expression): Adjust call to cp_parser_id_expression and finish_class_member_access_expr. (cp_parser_template_argument_list): Add comment. (cp_parser_template_argument): Adjust use of cp_parser_primary_expression. Remove call to finish_qualified_id_expr. (cp_parser_lookup_name): Use build_qualified_name. * pt.c (tsubst): Use build_qualified_name. (tsubst_qualified_id): Likewise. Adjust call to finish_qualified_id_expr. (tsubst_copy): Use build_qualified_name. (tsubst_copy_and_build): Adjusts call to finish_id_expression and finish_class_member_access_expr. * semantics.c (finish_non_static_data_member): Use build_qualified_name. (finish_qualified_id_expr): Add template_p and template_arg_p parameters. (finish_id_expression): Remove qualifiying_class parameter. Add template_p, done, address_p, and template_arg_p. Use build_qualified_name. Adjust calls to finish_class_member_acess_expr. * tree.c (build_qualified_name): New function. * typeck.c (check_template_keyword): New function. (finish_class_member_access_expr): Add template_p argument. Check for invalid uses of the template keyword. PR c++/22137 * g++.dg/parse/template18.C: New test. * g++.dg/template/nontype15.C: Likewise. From-SVN: r105463
2005-10-16 21:38:57 +02:00
/* True for an OMP_ATOMIC that has dependent parameters. These are stored
as an expr in operand 1, and integer_zero_node in operand 0. */
#define OMP_ATOMIC_DEPENDENT_P(NODE) \
(TREE_CODE (TREE_OPERAND (OMP_ATOMIC_CHECK (NODE), 0)) == INTEGER_CST)
/* Used while gimplifying continue statements bound to OMP_FOR nodes. */
#define OMP_FOR_GIMPLIFYING_P(NODE) \
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
(TREE_LANG_FLAG_0 (OMP_LOOP_CHECK (NODE)))
2006-06-06 13:44:09 +02:00
/* A language-specific token attached to the OpenMP data clauses to
hold code (or code fragments) related to ctors, dtors, and op=.
See semantics.c for details. */
#define CP_OMP_CLAUSE_INFO(NODE) \
TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
Makefile.in (omp-low.o): Depend on $(TARGET_H). * Makefile.in (omp-low.o): Depend on $(TARGET_H). * cfgloop.h (struct loop): Add safelen, force_vect, simduid. * function.h (struct function): Add has_force_vect_loops and has_simduid_loops. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND*. * gimple.c (gimple_build_omp_critical): Add KIND argument and handle it. * gimple.def: Update CLAUSES comments. * gimple.h (enum gf_mask): Add GF_OMP_FOR_KIND_{FOR,SIMD}. (gimple_build_omp_for): Add argument to prototype. (gimple_omp_for_kind): New. (gimple_omp_for_set_kind): New. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_LINEAR to GOVD_DATA_SHARE_CLASS. (enum omp_region_type): Add ORT_SIMD. (gimple_add_tmp_var): Handle ORT_SIMD. (gimplify_var_or_parm_decl): Same. (is_gimple_stmt): Same. (omp_firstprivatize_variable): Same. (omp_add_variable): Only use splay_tree_insert if lookup failed. (omp_notice_variable): Handle ORT_SIMD. (omp_is_private): Add SIMD argument and handle it as well as ORT_SIMD. (omp_check_private): Handle ORT_SIMD. (gimplify_scan_omp_clauses): Handle OMP_CLAUSE_LINEAR and OMP_CLAUSE_SAFELEN. (gimplify_adjust_omp_clauses_1): Handle GOVD_LINEAR. Handle OMP_CLAUSE_LASTPRIVATE. (gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_LINEAR and OMP_CLAUSE_SAFELEN. (gimplify_omp_for): Handle OMP_SIMD and OMP_CLAUSE_LINEAR. (gimplify_expr): Handle OMP_SIMD. * internal-fn.c (expand_GOMP_SIMD_LANE): New. (expand_GOMP_SIMD_VF): New. (expand_GOMP_SIMD_LAST_LANE): New. * internal-fn.def (GOMP_SIMD_LANE): New. (GOMP_SIMD_VF): New. (GOMP_SIMD_LAST_LANE): New. * omp-low.c: Include target.h. (extract_omp_for_data): Handle OMP_SIMD, OMP_CLAUSE_LINEAR, OMP_CLAUSE_SAFELEN. (check_omp_nesting_restrictions): Same. (omp_max_vf): New. (lower_rec_simd_input_clauses): New. (lower_rec_input_clauses): Handle OMP_SIMD, GF_OMP_FOR_KIND_SIMD, OMP_CLAUSE_LINEAR. (lower_lastprivate_clauses): Handle OMP_CLAUSE_LINEAR, GF_OMP_FOR_KIND_SIMD, OMP_SIMD. (expand_omp_build_assign): New. (expand_omp_for_init_counts): New. (expand_omp_for_init_vars): New. (extract_omp_for_update_vars): New. (expand_omp_for_generic): Use expand_omp_for_{init,update}_vars and rewrite accordingly. (expand_omp_simd): New. (expand_omp_for): Use expand_omp_simd. (lower_omp_for_lastprivate): Unshare vinit when appropriate. (lower_omp_for): Do not lower the body. * tree-data-ref (get_references_in_stmt): Allow IFN_GOMP_SIMD_LANE in their own loops. * tree-flow.h (find_omp_clause): Remove prototype. * tree-if-conv.c (main_tree_if_conversion): Run if doing if conversion, forcing vectorization of the loop, or if flag_tree_vectorize. (gate_tree_if_conversion): Similarly. * tree-inline.c (remap_gimple_stmt): Pass for kind argument to gimple_build_omp_for. (copy_cfg_body): set has_force_vect_loops and has_simduid_loops. * tree-parloops (create_parallel_loop): Pass kind argument to gimple_build_omp_for. * tree-pretty-print.c (dump_omp_clause): Add cases for OMP_CLAUSE_UNIFORM, OMP_CLAUSE_LINEAR, OMP_CLAUSE_SAFELEN, OMP_CLAUSE__SIMDUID_. (dump_generic_node): Handle OMP_SIMD. * tree-ssa-ccp.c (likely_value): Handle IFN_GOMP_SIMD*. * tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely_1): Do not unroll OMP_SIMD loops here. * tree-ssa-loop.c (gate_tree_vectorize): Run if has_force_vect_loops. * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Handle loop->safelen (vect_analyze_data_refs): Handle simd loops. * tree-vect-loop.c (vectorizable_live_operation): Handle IFN_GOMP_SIMD*. * tree-vect-stmts.c (vectorizable_call): Handle IFN_GOMP_SIMD_LANE. (vectorizable_store): Handle STMT_VINFO_SIMD_LANE_ACCESS_P. (vectorizable_load): Same. * tree-vectorizer.c: Include hash-table.h and tree-ssa-propagate.h. (struct simduid_to_vf): New. (simduid_to_vf::hash): New. (simduid_to-vf::equal): New. (struct simd_array_to_simduid): New. (simd_array_to_simduid::hash): New. (simd_array_to_simduid::equal): New. (adjust_simduid_builtins): New. (struct note_simd_array_uses_struct): New. (note_simd_array_uses_cb): New. (note_simd_array_uses): New. (vectorize_loops): Handle simd hints and adjust simd builtins accordingly. * tree-vectorizer.h (struct _stmt_vec_info): Add simd_lane_access_p field. (STMT_VINFO_SIMD_LANE_ACCESS_P): New macro. * tree.c (omp_clause_num_ops): Add entries for OMP_CLAUSE_LINEAR, OMP_CLAUSE_SAFELEN, OMP_CLAUSE__SIMDUID_, OMP_CLAUSE_UNIFORM. (omp_clause_code_name): Same. (walk_tree_1): Handle OMP_CLAUSE_UNIFORM, OMP_CLAUSE_SAFELEN, OMP_CLAUSE__SIMDUID_, OMP_CLAUSE_LINEAR. * tree.def (OMP_SIMD): New entry. * tree.h (enum omp_clause_code): Add entries for OMP_CLAUSE_LINEAR, OMP_CLAUSE_UNIFORM, OMP_CLAUSE_SAFELEN, OMP_CLAUSE__SIMDUID_. (OMP_CLAUSE_DECL): Adjust range for new clauses. (OMP_CLAUSE_LINEAR_NO_COPYIN): New. (OMP_CLAUSE_LINEAR_NO_COPYOUT): New. (OMP_CLAUSE_LINEAR_STEP): New. (OMP_CLAUSE_SAFELEN_EXPR): New. (OMP_CLAUSE__SIMDUID__DECL): New. (find_omp_clause): New prototype. cp/ * cp-tree.h (CP_OMP_CLAUSE_INFO): Adjust range for new clauses. Co-Authored-By: Aldy Hernandez <aldyh@redhat.com> From-SVN: r202029
2013-08-27 20:38:00 +02:00
OMP_CLAUSE_LINEAR))
/* Nonzero if this transaction expression's body contains statements. */
#define TRANSACTION_EXPR_IS_STMT(NODE) \
TREE_LANG_FLAG_0 (TRANSACTION_EXPR_CHECK (NODE))
/* These macros provide convenient access to the various _STMT nodes
created when parsing template declarations. */
#define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
#define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1)
c-common.h (IF_COND): Moved here from cp/cp-tree.h. * c-common.h (IF_COND): Moved here from cp/cp-tree.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * c-common.def: Added SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * gencheck.c (tree_codes[]): Added '#include "c-common.def"'. * cp/cp-tree.h (IF_COND): Move to c-common.h. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. (SCOPE_BEGIN_P): Likewise. (SCOPE_END_P): Likewise. (SCOPE_STMT_BLOCK): Likewise. (SCOPE_NULLIFIED_P): Likewise. (SCOPE_NO_CLEANUPS_P): Likewise. (SCOPE_PARTIAL_P): Likewise. (ASM_VOLATILE_P): Likewise. (STMT_LINENO): Likewise. (STMT_LINENO_FOR_FN_P): Likewise. * cp/cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def. * cp/Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def. (cc1plus$(exeext)): Added $(srcdir)/c-common.def. * cp/lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'. (cplus_tree_code_length[]): Added '#include "c-common.def"'. (cplus_tree_code_name[]): Added '#include "c-common.def"'. From-SVN: r34552
2000-06-14 19:26:18 +02:00
#define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0)
#define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1)
#define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0)
/* Nonzero if this try block is a function try block. */
#define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
#define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0)
#define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1)
#define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE))
Make-lang.in (CXX_SRCS): Add optimize.c. 1999-11-25 Mark Mitchell <mark@codesourcery.com> * Make-lang.in (CXX_SRCS): Add optimize.c. * Makefile.in (CXX_OBJS): Add optimize.o. (CXX_TREE_H): Add splay-tree.h, system.h, and $(CONFIG_H). (spew.o, lex.o, decl.o, decl2.o, typeck2.o, typeck.o): Adjust. (class.o, call.o, friend.o, init.o, method.o, cvt.o): Likewise. (search.o, tree.o, ptree.o, rtti.o, except.o, expr.o): Likewise. (xref.o, pt.o, error.o, errfn.o, repo.o, semantics.o): Likewise. (dump.o): Likewise. (optimize.o): New target. * class.c: Don't include splay-tree.h. * cp-tree.def (CTOR_COMPLETE): Rename to CTOR_STMT. * cp-tree.h: Include splay-tree.h. (DECL_UNINLINABLE): New macro. (CTOR_BEGIN_P, CTOR_END_P): New macros. (flag_inline_trees): New variable. (local_variable_p): New function. (nonstatic_local_decl_p): Likewise. (optimize_function): Likewise. (cplus_unsave_expr_now): Remove. (copy_tree_r): Declare. (remap_save_expr): Likewise. * decl.c (local_variable_p): Don't make it static. (local_variable_p_walkfn): New function. (make_rtl_for_local_static): Remove code to try to avoid writing out static constants. (emit_local_var): Fix indentation. (nonstatic_local_decl_p): New function. (check_default_argument): Use local_variable_p_walkfn, not local_variable_p, when walking the tree. (start_function): Set the DECL_CONTEXT for automatically generated labels. (finish_constructor_body): Use CTOR_STMT to mark the end of a constructor. * decl2.c: Don't include splay-tree.h. (flag_inline_trees): Define. * dump.c: Don't include splay-tree.h. * except.c (expand_end_catch_block): Fix comment formatting. (expand_end_eh_spec): Set DECL_CONTEXT on temporary variables. (expand_throw): Tidy comment. * init.c (build_vec_delete_1): Use create_temporary_var. * lex.c (cplus_tree_code_type): Make it static. (cplus_tree_code_length): Likewise. (cplus_tree_code_name): Likewise. * optimize.c: New file. * semantics.c (finish_goto_stmt): Set DECL_UNLINABLE for functions with computed gotos. (setup_vtbl_ptr): Mark the beginnings of constructors with CTOR_STMT. (expand_stmt): Handle CTOR_STMT, not CTOR_COMPLETE. (expand_body): Call optimize_function. Save bodies if we're doing inlining on trees. * tree.c: Don't include splay-tree.h. Include insn-config.h and integrate.h. (copy_tree_r): Make it public. (statement_code_p): New function. (mark_local_for_remap_r): Likewise. (cp_usave_r): Likewise. (cp_unsave): Likewise. (build_cplus_new): Set DECL_CONTEXT for temporary variables. (walk_tree): Walk into `s' class nodes. Walk statement chains. (copy_tree_r): Handle 's' class nodes. Restore chains for statements. Nullify scopes. Don't copy types. (init_tree): Set lang_unsave to cp_unsave. (remap_save_expr): Define. * ir.texi: Document CTOR_STMT. From-SVN: r30669
1999-11-25 21:32:04 +01:00
/* CLEANUP_STMT accessors. The statement(s) covered, the cleanup to run
and the VAR_DECL for which this cleanup exists. */
#define CLEANUP_BODY(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0)
#define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
#define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 2)
/* IF_STMT accessors. These give access to the condition of the if
statement, the then block of the if statement, and the else block
of the if statement if it exists. */
#define IF_COND(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 0)
#define THEN_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 1)
#define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2)
#define IF_SCOPE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 3)
#define IF_STMT_CONSTEXPR_P(NODE) TREE_LANG_FLAG_0 (IF_STMT_CHECK (NODE))
c-common.def: Move FOR_STMT... ./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
2005-04-09 05:18:18 +02:00
/* WHILE_STMT accessors. These give access to the condition of the
while statement and the body of the while statement, respectively. */
#define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
#define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
c-common.def: Move FOR_STMT... ./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
2005-04-09 05:18:18 +02:00
/* DO_STMT accessors. These give access to the condition of the do
statement and the body of the do statement, respectively. */
#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
c-common.def: Move FOR_STMT... ./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
2005-04-09 05:18:18 +02:00
/* FOR_STMT accessors. These give access to the init statement,
condition, update expression, and body of the for statement,
respectively. */
#define FOR_INIT_STMT(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 0)
#define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
#define FOR_SCOPE(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 4)
c-common.def: Move FOR_STMT... ./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
2005-04-09 05:18:18 +02:00
/* RANGE_FOR_STMT accessors. These give access to the declarator,
expression, body, and scope of the statement, respectively. */
#define RANGE_FOR_DECL(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 0)
#define RANGE_FOR_EXPR(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 1)
#define RANGE_FOR_BODY(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 2)
#define RANGE_FOR_SCOPE(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 3)
#define RANGE_FOR_IVDEP(NODE) TREE_LANG_FLAG_6 (RANGE_FOR_STMT_CHECK (NODE))
c-common.def: Move FOR_STMT... ./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
2005-04-09 05:18:18 +02:00
#define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
#define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
#define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
#define SWITCH_STMT_SCOPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 3)
c-common.def: Move FOR_STMT... ./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
2005-04-09 05:18:18 +02:00
/* STMT_EXPR accessor. */
#define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
/* EXPR_STMT accessor. This gives the expression associated with an
expression statement. */
#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
/* True if this TARGET_EXPR was created by build_cplus_new, and so we can
discard it if it isn't useful. */
#define TARGET_EXPR_IMPLICIT_P(NODE) \
TREE_LANG_FLAG_0 (TARGET_EXPR_CHECK (NODE))
/* True if this TARGET_EXPR is the result of list-initialization of a
temporary. */
#define TARGET_EXPR_LIST_INIT_P(NODE) \
TREE_LANG_FLAG_1 (TARGET_EXPR_CHECK (NODE))
/* True if this TARGET_EXPR expresses direct-initialization of an object
to be named later. */
#define TARGET_EXPR_DIRECT_INIT_P(NODE) \
TREE_LANG_FLAG_2 (TARGET_EXPR_CHECK (NODE))
/* True if NODE is a TARGET_EXPR that just expresses a copy of its INITIAL; if
the initializer has void type, it's doing something more complicated. */
#define SIMPLE_TARGET_EXPR_P(NODE) \
(TREE_CODE (NODE) == TARGET_EXPR \
&& !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (NODE))))
/* True if EXPR expresses direct-initialization of a TYPE. */
#define DIRECT_INIT_EXPR_P(TYPE,EXPR) \
(TREE_CODE (EXPR) == TARGET_EXPR && TREE_LANG_FLAG_2 (EXPR) \
&& same_type_ignoring_top_level_qualifiers_p (TYPE, TREE_TYPE (EXPR)))
/* True if this CONVERT_EXPR is for a conversion to virtual base in
an NSDMI, and should be re-evaluated when used in a constructor. */
#define CONVERT_EXPR_VBASE_PATH(NODE) \
TREE_LANG_FLAG_0 (CONVERT_EXPR_CHECK (NODE))
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
/* True if SIZEOF_EXPR argument is type. */
#define SIZEOF_EXPR_TYPE_P(NODE) \
TREE_LANG_FLAG_0 (SIZEOF_EXPR_CHECK (NODE))
1994-02-24 02:02:37 +01:00
/* An enumeration of the kind of tags that C++ accepts. */
enum tag_types {
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
none_type = 0, /* Not a tag type. */
record_type, /* "struct" types. */
class_type, /* "class" types. */
union_type, /* "union" types. */
enum_type, /* "enum" types. */
typename_type, /* "typename" types. */
2016-05-25 20:41:21 +02:00
scope_type /* namespace or tagged type name followed by :: */
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
};
1994-02-24 02:02:37 +01:00
/* The various kinds of lvalues we distinguish. */
alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry. gcc/ChangeLog: * alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry. Change all uses. * except.c (struct call_site_record_d): Rename from struct call_site_record. Change all uses. * except.h (struct eh_region_d): Rename from struct eh_region. Change all uses. * gcse.c (struct hash_table_d): Rename from struct hash_table. Change all uses. * graphite.c (struct ivtype_map_elt_d): Rename fromstruct ivtype_map_elt. Change all uses. (struct rename_map_elt_d): Rename fromstruct rename_map_elt. Change all uses. (struct ifsese_d): Rename fromstruct ifsese. Change all uses. * graphite.h (struct name_tree_d): Rename from struct name_tree. Change all uses. (struct sese_d): Rename from struct sese. Change all uses. * omega.h (struct eqn_d): Rename from struct eqn. Change all uses. (struct omega_pb_d): Rename from struct omega_pb. Change all uses. * optabs.h (struct optab_d): Rename from struct optab. Change all uses. (struct convert_optab_d): Rename from struct convert_optab. Change all uses. * tree-pass.h (struct ipa_opt_pass_d): Rename fromstruct ipa_opt_pass. Change all uses. * tree-predcom.c (struct dref_d): Rename from struct dref. Change all uses. * c-decl.c (pushtag): If -Wc++-compat, warn if the tag is already defined as a typedef. (grokdeclarator): If -Wc++-compat, warn if a typedef is already defined as a tag. gcc/cp/ChangeLog: * cp-tree.h (enum cp_lvalue_kind_flags): Rename from cp_lvalue_kind. Change all uses. (enum base_access_flags): Rename from enum base_access. Change all uses. * parser.c (enum cp_parser_flags): Remove enum tag. gcc/testsuite/ChangeLog: * gcc.dg/Wcxx-compat-10.c: New testcase. libcpp/ChangeLog: * include/cpplib.h (enum cpp_builtin_type): Rename from enum builtin_type. Change all uses. From-SVN: r147605
2009-05-16 08:54:11 +02:00
enum cp_lvalue_kind_flags {
clk_none = 0, /* Things that are not an lvalue. */
clk_ordinary = 1, /* An ordinary lvalue. */
2012-04-06 15:25:37 +02:00
clk_rvalueref = 2,/* An xvalue (rvalue formed using an rvalue reference) */
clk_class = 4, /* A prvalue of class or array type. */
clk_bitfield = 8, /* An lvalue for a bit-field. */
clk_packed = 16 /* An lvalue for a packed field. */
combine.c (record_value_for_reg): Change 0 to VOIDmode, twice. gcc/: * combine.c (record_value_for_reg): Change 0 to VOIDmode, twice. (record_dead_and_set_regs): Likewise. * df.h (struct df_mw_hardreg): Change flags field to int. (struct df_base_ref): Likewise. (struct df): Change changeable_flags field to int. * df-scan.c (df_defs_record): Change clobber_flags to int. * dwarf2.h (enum dwarf_tag): Make lo_user and hi_user values enum constants rather than #define macros. (enum dwarf_attribute, enum dwarf_location_atom): Likewise. (enum dwarf_type, enum dwarf_endianity_encoding): Likewise. (enum dwarf_calling_convention): Likewise. (enum dwarf_line_number_x_ops): Likewise. (enum dwarf_call_frame_info): Likewise. (enum dwarf_source_language): Likewise. * dwarf2out.c (int_loc_descriptor): Add cast to enum type. (add_calling_convention_attribute): Likewise. * fold-const.c (fold_undefer_overflow_warnings): Add cast to enum type. (combine_comparisons): Change compcode to int. Add cast to enum type. * genrecog.c (maybe_both_true_2): Change c to int. (write_switch): Likewise. Add cast to enum type. * gimplify.c (gimplify_omp_for): Handle return values from gimplify_expr using MIN rather than bitwise or. (gimplify_expr): Add cast to enum type. * ipa-prop.c (update_jump_functions_after_inlining): Change IPA_BOTTOM to IPA_JF_UNKNOWN. * ira.c (setup_class_subset_and_memory_move_costs): Change mode to int. Add casts to enum type. (setup_cover_and_important_classes): Change cl to int. Add casts to enum type. (setup_class_translate): Change cl and mode to int. (ira_init_once): Change mode to int. (free_register_move_costs): Likewise. (setup_prohibited_mode_move_regs): Add casts to enum type. * langhooks.c (add_builtin_function_common): Rework assertion that value fits bitfield. * mcf.c (add_fixup_edge): Change type parameter to edge_type. * omega.c (omega_do_elimination): Avoid math on enum types. * optabs.c (expand_vec_shift_expr): Remove casts to int. * opts.c (set_debug_level): Change 2 to enum constant. Use new int local to handle integral_argment value. * regmove.c (try_auto_increment): Change PUT_MODE to PUT_REG_NOTE_KIND. * reload.c (push_secondary_reload): Add casts to enum type. (secondary_reload_class, find_valid_class): Likewise. * reload1.c (emit_input_reload_insns): Likewise. * rtl.h (NOTE_VAR_LOCATION_STATUS): Likewise. * sel-sched.c (init_hard_regs_data): Change cur_mode to int. * sel-sched-ir.c (hash_with_unspec_callback): Change 0 to enum constant. * tree.c (build_common_builtin_nodes): Add casts to enum type. * tree-complex.c (complex_lattice_t): Typedef to int rather than enum type. (expand_complex_libcall): Add casts to enum type. * tree-into-ssa.c (get_ssa_name_ann): Change 0 to enum constant. * tree-vect-loop.c (vect_model_reduction_cost): Compare reduc_code with ERROR_MARK, not NUM_TREE_CODES. (vect_create_epilog_for_reduction): Likewise. (vectorizable_reduction): Don't initialize epiloc_reduc_code. When not using it, set it to ERROR_MARK rather than NUM_TREE_CODES. * tree-vect-patterns.c (vect_pattern_recog_1): Change vec_mode to enum machine_mode. * tree-vect-stmts.c (new_stmt_vec_info): Change 0 to vect_unused_in_loop. Change 0 to loop_vect. * tree-vectorizer.c (vect_set_verbosity_level): Add casts to enum type. * var-tracking.c (get_init_value): Change return type to enum var_init_status. * vec.h (DEF_VEC_FUNC_P) [iterate]: Cast 0 to type T. * config/arm/arm.c (fp_model_for_fpu): Change to array to enum arm_fp_model. (arm_override_options): Add casts to enum type. (arm_emit_tls_decoration): Likewise. * config/i386/i386.c (ix86_function_specific_restore): Add casts to enum type. * config/i386/i386-c.c (ix86_pragma_target_parse): Likewise. * config/ia64/ia64.c (ia64_expand_compare): Change magic to int. * config/rs6000/rs6000.c (rs6000_override_options): Add casts to enum type. * config/s390/s390.c (code_for_builtin_64): Change to array of enum insn_code. (code_for_builtin_31): Likewise. (s390_expand_builtin): Change code_for_builtin to enum insn_code const *. * config/sparc/sparc.c (sparc_override_options): Change value field in struct code_model to enum cmodel. In initializer change 0 to NULL and add cast to enum type. * c-typeck.c (build_modify_expr): Add lhs_origtype parameter. Change all callers. Issue a -Wc++-compat warning using lhs_origtype if necessary. (convert_for_assignment): Issue -Wc++-compat warnings about invalid conversions to enum type on assignment. * c-common.h (build_modify_expr): Update declaration. gcc/cp/: * call.c (build_temp): Change 0 to enum constant. * cp-tree.h (cp_lvalue_kind): Typedef to int rather than enum type. * cp-gimplify.c (cp_gimplify_expr): Add cast to enum type. * decl2.c (constrain_visibility): Likewise. * parser.c (cp_lexer_get_preprocessor_token): Likewise. (cp_parser_flags): Typedef to int rather than enum type. (cp_parser_expression_stack_entry): Change prec field to enum cp_parser_prec. * typeck.c (build_modify_expr): Add lhs_origtype parameter. Change all callers. gcc/fortran/: * gfortran.h (enum gfc_symbol_type): New named enum type, broken out of struct gfc_symbol. (struct gfc_symbol): Use enum gfc_symbol_type. (enum gfc_array_ref_dimen_type): New named enum type, broken out of struct gfc_array_ref). (struct gfc_array_ref): Use enum gfc_array_ref_dimen_type. (mod_pointee_as): Update declaration. * decl.c (add_global_entry): Change type to enum gfc_symbol_type. (gfc_mod_pointee_as): Change return type to "match". * module.c (mio_array_ref): Add cast to enum type. (mio_symbol): Likewise. * resolve.c (resolve_global_procedure): Change type to enum gfc_symbol_type. * trans-io.c (gfc_build_st_parameter): Change type to unsigned int. gcc/java/: * jcf-parse.c (handle_constant): Add cast to enum type. gcc/objc/: * objc-act.c (get_super_receiver): Update calls to build_modify_expr to pass new argument. gcc/testsuite/: * gcc.dg/Wcxx-compat-4.c: New testcase. From-SVN: r146735
2009-04-24 17:31:38 +02:00
};
/* This type is used for parameters and variables which hold
alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry. gcc/ChangeLog: * alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry. Change all uses. * except.c (struct call_site_record_d): Rename from struct call_site_record. Change all uses. * except.h (struct eh_region_d): Rename from struct eh_region. Change all uses. * gcse.c (struct hash_table_d): Rename from struct hash_table. Change all uses. * graphite.c (struct ivtype_map_elt_d): Rename fromstruct ivtype_map_elt. Change all uses. (struct rename_map_elt_d): Rename fromstruct rename_map_elt. Change all uses. (struct ifsese_d): Rename fromstruct ifsese. Change all uses. * graphite.h (struct name_tree_d): Rename from struct name_tree. Change all uses. (struct sese_d): Rename from struct sese. Change all uses. * omega.h (struct eqn_d): Rename from struct eqn. Change all uses. (struct omega_pb_d): Rename from struct omega_pb. Change all uses. * optabs.h (struct optab_d): Rename from struct optab. Change all uses. (struct convert_optab_d): Rename from struct convert_optab. Change all uses. * tree-pass.h (struct ipa_opt_pass_d): Rename fromstruct ipa_opt_pass. Change all uses. * tree-predcom.c (struct dref_d): Rename from struct dref. Change all uses. * c-decl.c (pushtag): If -Wc++-compat, warn if the tag is already defined as a typedef. (grokdeclarator): If -Wc++-compat, warn if a typedef is already defined as a tag. gcc/cp/ChangeLog: * cp-tree.h (enum cp_lvalue_kind_flags): Rename from cp_lvalue_kind. Change all uses. (enum base_access_flags): Rename from enum base_access. Change all uses. * parser.c (enum cp_parser_flags): Remove enum tag. gcc/testsuite/ChangeLog: * gcc.dg/Wcxx-compat-10.c: New testcase. libcpp/ChangeLog: * include/cpplib.h (enum cpp_builtin_type): Rename from enum builtin_type. Change all uses. From-SVN: r147605
2009-05-16 08:54:11 +02:00
combinations of the flags in enum cp_lvalue_kind_flags. */
combine.c (record_value_for_reg): Change 0 to VOIDmode, twice. gcc/: * combine.c (record_value_for_reg): Change 0 to VOIDmode, twice. (record_dead_and_set_regs): Likewise. * df.h (struct df_mw_hardreg): Change flags field to int. (struct df_base_ref): Likewise. (struct df): Change changeable_flags field to int. * df-scan.c (df_defs_record): Change clobber_flags to int. * dwarf2.h (enum dwarf_tag): Make lo_user and hi_user values enum constants rather than #define macros. (enum dwarf_attribute, enum dwarf_location_atom): Likewise. (enum dwarf_type, enum dwarf_endianity_encoding): Likewise. (enum dwarf_calling_convention): Likewise. (enum dwarf_line_number_x_ops): Likewise. (enum dwarf_call_frame_info): Likewise. (enum dwarf_source_language): Likewise. * dwarf2out.c (int_loc_descriptor): Add cast to enum type. (add_calling_convention_attribute): Likewise. * fold-const.c (fold_undefer_overflow_warnings): Add cast to enum type. (combine_comparisons): Change compcode to int. Add cast to enum type. * genrecog.c (maybe_both_true_2): Change c to int. (write_switch): Likewise. Add cast to enum type. * gimplify.c (gimplify_omp_for): Handle return values from gimplify_expr using MIN rather than bitwise or. (gimplify_expr): Add cast to enum type. * ipa-prop.c (update_jump_functions_after_inlining): Change IPA_BOTTOM to IPA_JF_UNKNOWN. * ira.c (setup_class_subset_and_memory_move_costs): Change mode to int. Add casts to enum type. (setup_cover_and_important_classes): Change cl to int. Add casts to enum type. (setup_class_translate): Change cl and mode to int. (ira_init_once): Change mode to int. (free_register_move_costs): Likewise. (setup_prohibited_mode_move_regs): Add casts to enum type. * langhooks.c (add_builtin_function_common): Rework assertion that value fits bitfield. * mcf.c (add_fixup_edge): Change type parameter to edge_type. * omega.c (omega_do_elimination): Avoid math on enum types. * optabs.c (expand_vec_shift_expr): Remove casts to int. * opts.c (set_debug_level): Change 2 to enum constant. Use new int local to handle integral_argment value. * regmove.c (try_auto_increment): Change PUT_MODE to PUT_REG_NOTE_KIND. * reload.c (push_secondary_reload): Add casts to enum type. (secondary_reload_class, find_valid_class): Likewise. * reload1.c (emit_input_reload_insns): Likewise. * rtl.h (NOTE_VAR_LOCATION_STATUS): Likewise. * sel-sched.c (init_hard_regs_data): Change cur_mode to int. * sel-sched-ir.c (hash_with_unspec_callback): Change 0 to enum constant. * tree.c (build_common_builtin_nodes): Add casts to enum type. * tree-complex.c (complex_lattice_t): Typedef to int rather than enum type. (expand_complex_libcall): Add casts to enum type. * tree-into-ssa.c (get_ssa_name_ann): Change 0 to enum constant. * tree-vect-loop.c (vect_model_reduction_cost): Compare reduc_code with ERROR_MARK, not NUM_TREE_CODES. (vect_create_epilog_for_reduction): Likewise. (vectorizable_reduction): Don't initialize epiloc_reduc_code. When not using it, set it to ERROR_MARK rather than NUM_TREE_CODES. * tree-vect-patterns.c (vect_pattern_recog_1): Change vec_mode to enum machine_mode. * tree-vect-stmts.c (new_stmt_vec_info): Change 0 to vect_unused_in_loop. Change 0 to loop_vect. * tree-vectorizer.c (vect_set_verbosity_level): Add casts to enum type. * var-tracking.c (get_init_value): Change return type to enum var_init_status. * vec.h (DEF_VEC_FUNC_P) [iterate]: Cast 0 to type T. * config/arm/arm.c (fp_model_for_fpu): Change to array to enum arm_fp_model. (arm_override_options): Add casts to enum type. (arm_emit_tls_decoration): Likewise. * config/i386/i386.c (ix86_function_specific_restore): Add casts to enum type. * config/i386/i386-c.c (ix86_pragma_target_parse): Likewise. * config/ia64/ia64.c (ia64_expand_compare): Change magic to int. * config/rs6000/rs6000.c (rs6000_override_options): Add casts to enum type. * config/s390/s390.c (code_for_builtin_64): Change to array of enum insn_code. (code_for_builtin_31): Likewise. (s390_expand_builtin): Change code_for_builtin to enum insn_code const *. * config/sparc/sparc.c (sparc_override_options): Change value field in struct code_model to enum cmodel. In initializer change 0 to NULL and add cast to enum type. * c-typeck.c (build_modify_expr): Add lhs_origtype parameter. Change all callers. Issue a -Wc++-compat warning using lhs_origtype if necessary. (convert_for_assignment): Issue -Wc++-compat warnings about invalid conversions to enum type on assignment. * c-common.h (build_modify_expr): Update declaration. gcc/cp/: * call.c (build_temp): Change 0 to enum constant. * cp-tree.h (cp_lvalue_kind): Typedef to int rather than enum type. * cp-gimplify.c (cp_gimplify_expr): Add cast to enum type. * decl2.c (constrain_visibility): Likewise. * parser.c (cp_lexer_get_preprocessor_token): Likewise. (cp_parser_flags): Typedef to int rather than enum type. (cp_parser_expression_stack_entry): Change prec field to enum cp_parser_prec. * typeck.c (build_modify_expr): Add lhs_origtype parameter. Change all callers. gcc/fortran/: * gfortran.h (enum gfc_symbol_type): New named enum type, broken out of struct gfc_symbol. (struct gfc_symbol): Use enum gfc_symbol_type. (enum gfc_array_ref_dimen_type): New named enum type, broken out of struct gfc_array_ref). (struct gfc_array_ref): Use enum gfc_array_ref_dimen_type. (mod_pointee_as): Update declaration. * decl.c (add_global_entry): Change type to enum gfc_symbol_type. (gfc_mod_pointee_as): Change return type to "match". * module.c (mio_array_ref): Add cast to enum type. (mio_symbol): Likewise. * resolve.c (resolve_global_procedure): Change type to enum gfc_symbol_type. * trans-io.c (gfc_build_st_parameter): Change type to unsigned int. gcc/java/: * jcf-parse.c (handle_constant): Add cast to enum type. gcc/objc/: * objc-act.c (get_super_receiver): Update calls to build_modify_expr to pass new argument. gcc/testsuite/: * gcc.dg/Wcxx-compat-4.c: New testcase. From-SVN: r146735
2009-04-24 17:31:38 +02:00
typedef int cp_lvalue_kind;
cp-tree.h (scope_kind): New type. * cp-tree.h (scope_kind): New type. (tmpl_spec_kind): Likewise. (declare_pseudo_global_level): Remove. (pseudo_global_level_p): Rename to template_parm_scope_p. (pushlevel): Remove declaration. (begin_scope): New function. (finish_scope): Likewise. (current_tmpl_spec_kind): Likewise. * decl.c (struct binding_level): Shorten parm_flag to 2 bits. Shorten keep to 2 bits. Rename pseudo_global to template_parms_p. Add template_spec_p. (toplevel_bindings_p): Adjust. (declare_pseudo_global_level): Remove. (pseudo_global_level_p): Rename to template_parm_scope_p. (current_tmpl_spec_kind): New function. (begin_scope): Likewise. (finish_scope): Likewise. (maybe_push_to_top_level): Adjust. (maybe_process_template_type_declaration): Likewise. (pushtag): Likewise. (pushdecl_nonclass_level): Likewise. (lookup_tag): Likewise. (grokfndecl): Handle member template specializations. Share constructor and non-constructor code. * decl2.c (check_classfn): Handle member template specializations. * pt.c (begin_template_parm_list): Use begin_scope. (begin_specialization): Likewise. (end_specialization): Likewise. (check_explicit_specialization): Use current_tmpl_spec_kind. Handle member template specializations. (end_template_decl): Use finish_scope. Remove call to get_pending_sizes. (push_template_decl_real): Remove bogus error message. (tsubst_decl): Fix typo in code contained in comment. (instantiate_template): Handle member template specializations. (most_general_template): Likewise. From-SVN: r32494
2000-03-12 19:47:52 +01:00
/* Various kinds of template specialization, instantiation, etc. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum tmpl_spec_kind {
tsk_none, /* Not a template at all. */
cp-tree.h (scope_kind): New type. * cp-tree.h (scope_kind): New type. (tmpl_spec_kind): Likewise. (declare_pseudo_global_level): Remove. (pseudo_global_level_p): Rename to template_parm_scope_p. (pushlevel): Remove declaration. (begin_scope): New function. (finish_scope): Likewise. (current_tmpl_spec_kind): Likewise. * decl.c (struct binding_level): Shorten parm_flag to 2 bits. Shorten keep to 2 bits. Rename pseudo_global to template_parms_p. Add template_spec_p. (toplevel_bindings_p): Adjust. (declare_pseudo_global_level): Remove. (pseudo_global_level_p): Rename to template_parm_scope_p. (current_tmpl_spec_kind): New function. (begin_scope): Likewise. (finish_scope): Likewise. (maybe_push_to_top_level): Adjust. (maybe_process_template_type_declaration): Likewise. (pushtag): Likewise. (pushdecl_nonclass_level): Likewise. (lookup_tag): Likewise. (grokfndecl): Handle member template specializations. Share constructor and non-constructor code. * decl2.c (check_classfn): Handle member template specializations. * pt.c (begin_template_parm_list): Use begin_scope. (begin_specialization): Likewise. (end_specialization): Likewise. (check_explicit_specialization): Use current_tmpl_spec_kind. Handle member template specializations. (end_template_decl): Use finish_scope. Remove call to get_pending_sizes. (push_template_decl_real): Remove bogus error message. (tsubst_decl): Fix typo in code contained in comment. (instantiate_template): Handle member template specializations. (most_general_template): Likewise. From-SVN: r32494
2000-03-12 19:47:52 +01:00
tsk_invalid_member_spec, /* An explicit member template
specialization, but the enclosing
classes have not all been explicitly
specialized. */
tsk_invalid_expl_inst, /* An explicit instantiation containing
template parameter lists. */
tsk_excessive_parms, /* A template declaration with too many
cp-tree.h (scope_kind): New type. * cp-tree.h (scope_kind): New type. (tmpl_spec_kind): Likewise. (declare_pseudo_global_level): Remove. (pseudo_global_level_p): Rename to template_parm_scope_p. (pushlevel): Remove declaration. (begin_scope): New function. (finish_scope): Likewise. (current_tmpl_spec_kind): Likewise. * decl.c (struct binding_level): Shorten parm_flag to 2 bits. Shorten keep to 2 bits. Rename pseudo_global to template_parms_p. Add template_spec_p. (toplevel_bindings_p): Adjust. (declare_pseudo_global_level): Remove. (pseudo_global_level_p): Rename to template_parm_scope_p. (current_tmpl_spec_kind): New function. (begin_scope): Likewise. (finish_scope): Likewise. (maybe_push_to_top_level): Adjust. (maybe_process_template_type_declaration): Likewise. (pushtag): Likewise. (pushdecl_nonclass_level): Likewise. (lookup_tag): Likewise. (grokfndecl): Handle member template specializations. Share constructor and non-constructor code. * decl2.c (check_classfn): Handle member template specializations. * pt.c (begin_template_parm_list): Use begin_scope. (begin_specialization): Likewise. (end_specialization): Likewise. (check_explicit_specialization): Use current_tmpl_spec_kind. Handle member template specializations. (end_template_decl): Use finish_scope. Remove call to get_pending_sizes. (push_template_decl_real): Remove bogus error message. (tsubst_decl): Fix typo in code contained in comment. (instantiate_template): Handle member template specializations. (most_general_template): Likewise. From-SVN: r32494
2000-03-12 19:47:52 +01:00
template parameter lists. */
tsk_insufficient_parms, /* A template declaration with too few
parameter lists. */
tsk_template, /* A template declaration. */
tsk_expl_spec, /* An explicit specialization. */
tsk_expl_inst /* An explicit instantiation. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
cp-tree.h (scope_kind): New type. * cp-tree.h (scope_kind): New type. (tmpl_spec_kind): Likewise. (declare_pseudo_global_level): Remove. (pseudo_global_level_p): Rename to template_parm_scope_p. (pushlevel): Remove declaration. (begin_scope): New function. (finish_scope): Likewise. (current_tmpl_spec_kind): Likewise. * decl.c (struct binding_level): Shorten parm_flag to 2 bits. Shorten keep to 2 bits. Rename pseudo_global to template_parms_p. Add template_spec_p. (toplevel_bindings_p): Adjust. (declare_pseudo_global_level): Remove. (pseudo_global_level_p): Rename to template_parm_scope_p. (current_tmpl_spec_kind): New function. (begin_scope): Likewise. (finish_scope): Likewise. (maybe_push_to_top_level): Adjust. (maybe_process_template_type_declaration): Likewise. (pushtag): Likewise. (pushdecl_nonclass_level): Likewise. (lookup_tag): Likewise. (grokfndecl): Handle member template specializations. Share constructor and non-constructor code. * decl2.c (check_classfn): Handle member template specializations. * pt.c (begin_template_parm_list): Use begin_scope. (begin_specialization): Likewise. (end_specialization): Likewise. (check_explicit_specialization): Use current_tmpl_spec_kind. Handle member template specializations. (end_template_decl): Use finish_scope. Remove call to get_pending_sizes. (push_template_decl_real): Remove bogus error message. (tsubst_decl): Fix typo in code contained in comment. (instantiate_template): Handle member template specializations. (most_general_template): Likewise. From-SVN: r32494
2000-03-12 19:47:52 +01:00
Correct many new ABI issues regarding vbase and vcall offset layout. Correct many new ABI issues regarding vbase and vcall offset layout. * cp-tree.h (BINFO_VTABLE): Document. (struct lang_type): Tweak formatting. (BINFO_PRIMARY_BINFO): Add to documentation. (CLASSTYPE_VSIZE): Fix typo in comment. (CLASSTYPE_VBASECLASSES): Update documentation. (BINFO_VBASE_MARKED): Remove. (SET_BINFO_VBASE_MARKED): Likewise. (CLEAR_BINFO_VBASE_MARKED): Likewise. (BINFO_FIELDS_MARKED): Remove. (SET_BINFO_FIELDS_MARKED): Likewise. (CLEAR_BINFO_FIELDS_MARKED): Likewise. (enum access_kind): New enumeration. (num_extra_vtbl_entries): Remove declaration. (size_extra_vtbl_entries): Likewise. (get_vtbl_decl_for_binfo): New function. (dfs_vbase_unmark): Remove declaration. (mark_primary_bases): Likewise. * class.c (SAME_FN): Remove. (struct vcall_offset_data_s): Move definition. (build_vbase_pointer): Use `build', not `build_binary_op', to access the vbase pointer under the new ABI. (build_vtable_entry_ref): Use get_vtbl_decl_for_binfo. (build_primary_vtable): Likewise. (dfs_mark_primary_bases): Move here from search.c. (mark_primary_bases): Likewise. (determine_primary_bases): Under the new ABI, don't make a base class a primary base just because we don't yet have any virtual functions. (layout_vtable_decl): Use get_vtbl_decl_for_binfo. (num_vfun_entries): Remove. (dfs_count_virtuals): Likewise. (num_extra_vtbl_entries): Likewise. (size_extra_vtbl_entries): Likewise. (layout_virtual_bases): Iterate in inheritance graph order under the new ABI. (finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to indicate that a vfield is present. (init_class_processing): Initialize access_public_node, etc., from ak_public, etc. (get_vtbl_decl_for_binfo): New function. (dump_class_hierarchy_r): Likewise. (dump_class_hierarchy): Use it. (finish_vtbls): Build the vtbls in inheritance graph order. (dfs_finish_vtbls): Adjust call to build_vtbl_initializer. (initialize_vtable): Use get_vtbl_decl_for_binfo. (accumulate_vtbl_inits): Add comments explaining why a pre-order walk is required. (dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location where the vptr points, even for primary vtables. (build_vtbl_initializer): Adjust handling of vbase and vcall offsets. (build_vcall_and_vbase_vtable_entries): New function. (dfs_build_vbase_offset_vtbl_entries): Remove. (build_vbase_offset_vtbl_entries): Reimplement. (dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that were already handled in a primary base class vtable. (build_vcall_offset_vtbl_entries): Adjust. (build_rtti_vtbl_entries): Adjust. * decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo. * init.c (expand_virtual_init): Simplify. * repo.c (repo_get_id): Use get_vtbl_decl_for_binfo. * rtti.c (create_pseudo_type_info): Adjust calculation of vptr. * search.c (BINFO_ACCESS): New macro. (SET_BINFO_ACCESS): Likewise. (dfs_access_in_type): Manipulate access_kinds, not access nodes. (access_in_type): Likewise. (dfs_accessible_p): Likewise. (protected_accessible_p): Likewise. (lookup_fnfields_1): Adjust documentation. (dfs_mark_primary_bases): Move to class.c (mark_primary_bases): Likewise. (dfs_vbase_unmark): Remove. (virtual_context): Use BINFO_FOR_VBASE. (dfs_get_vbase_types): Simplify. (dfs_build_inheritance_graph_order): New function. (get_vbase_types): Use it. * tree.c (debug_binfo): Use get_vtbl_decl_for_binfo. * tinfo.cc (get_vbase_offset): New function. (__vmi_class_type_info::do_find_public_src): Use it. (__vmi_class_type_info::do_dyncast): Likewise. (__vmi_class_type_info::do_upcast): Likewise. From-SVN: r32905
2000-04-04 20:13:22 +02:00
/* The various kinds of access. BINFO_ACCESS depends on these being
two bit quantities. The numerical values are important; they are
used to initialize RTTI data structures, so changing them changes
the ABI. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum access_kind {
ak_none = 0, /* Inaccessible. */
ak_public = 1, /* Accessible, as a `public' thing. */
ak_protected = 2, /* Accessible, as a `protected' thing. */
ak_private = 3 /* Accessible, as a `private' thing. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
Correct many new ABI issues regarding vbase and vcall offset layout. Correct many new ABI issues regarding vbase and vcall offset layout. * cp-tree.h (BINFO_VTABLE): Document. (struct lang_type): Tweak formatting. (BINFO_PRIMARY_BINFO): Add to documentation. (CLASSTYPE_VSIZE): Fix typo in comment. (CLASSTYPE_VBASECLASSES): Update documentation. (BINFO_VBASE_MARKED): Remove. (SET_BINFO_VBASE_MARKED): Likewise. (CLEAR_BINFO_VBASE_MARKED): Likewise. (BINFO_FIELDS_MARKED): Remove. (SET_BINFO_FIELDS_MARKED): Likewise. (CLEAR_BINFO_FIELDS_MARKED): Likewise. (enum access_kind): New enumeration. (num_extra_vtbl_entries): Remove declaration. (size_extra_vtbl_entries): Likewise. (get_vtbl_decl_for_binfo): New function. (dfs_vbase_unmark): Remove declaration. (mark_primary_bases): Likewise. * class.c (SAME_FN): Remove. (struct vcall_offset_data_s): Move definition. (build_vbase_pointer): Use `build', not `build_binary_op', to access the vbase pointer under the new ABI. (build_vtable_entry_ref): Use get_vtbl_decl_for_binfo. (build_primary_vtable): Likewise. (dfs_mark_primary_bases): Move here from search.c. (mark_primary_bases): Likewise. (determine_primary_bases): Under the new ABI, don't make a base class a primary base just because we don't yet have any virtual functions. (layout_vtable_decl): Use get_vtbl_decl_for_binfo. (num_vfun_entries): Remove. (dfs_count_virtuals): Likewise. (num_extra_vtbl_entries): Likewise. (size_extra_vtbl_entries): Likewise. (layout_virtual_bases): Iterate in inheritance graph order under the new ABI. (finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to indicate that a vfield is present. (init_class_processing): Initialize access_public_node, etc., from ak_public, etc. (get_vtbl_decl_for_binfo): New function. (dump_class_hierarchy_r): Likewise. (dump_class_hierarchy): Use it. (finish_vtbls): Build the vtbls in inheritance graph order. (dfs_finish_vtbls): Adjust call to build_vtbl_initializer. (initialize_vtable): Use get_vtbl_decl_for_binfo. (accumulate_vtbl_inits): Add comments explaining why a pre-order walk is required. (dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location where the vptr points, even for primary vtables. (build_vtbl_initializer): Adjust handling of vbase and vcall offsets. (build_vcall_and_vbase_vtable_entries): New function. (dfs_build_vbase_offset_vtbl_entries): Remove. (build_vbase_offset_vtbl_entries): Reimplement. (dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that were already handled in a primary base class vtable. (build_vcall_offset_vtbl_entries): Adjust. (build_rtti_vtbl_entries): Adjust. * decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo. * init.c (expand_virtual_init): Simplify. * repo.c (repo_get_id): Use get_vtbl_decl_for_binfo. * rtti.c (create_pseudo_type_info): Adjust calculation of vptr. * search.c (BINFO_ACCESS): New macro. (SET_BINFO_ACCESS): Likewise. (dfs_access_in_type): Manipulate access_kinds, not access nodes. (access_in_type): Likewise. (dfs_accessible_p): Likewise. (protected_accessible_p): Likewise. (lookup_fnfields_1): Adjust documentation. (dfs_mark_primary_bases): Move to class.c (mark_primary_bases): Likewise. (dfs_vbase_unmark): Remove. (virtual_context): Use BINFO_FOR_VBASE. (dfs_get_vbase_types): Simplify. (dfs_build_inheritance_graph_order): New function. (get_vbase_types): Use it. * tree.c (debug_binfo): Use get_vtbl_decl_for_binfo. * tinfo.cc (get_vbase_offset): New function. (__vmi_class_type_info::do_find_public_src): Use it. (__vmi_class_type_info::do_dyncast): Likewise. (__vmi_class_type_info::do_upcast): Likewise. From-SVN: r32905
2000-04-04 20:13:22 +02:00
/* The various kinds of special functions. If you add to this list,
you should update special_function_p as well. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum special_function_kind {
sfk_none = 0, /* Not a special function. This enumeral
must have value zero; see
special_function_p. */
sfk_constructor, /* A constructor. */
sfk_copy_constructor, /* A copy constructor. */
sfk_move_constructor, /* A move constructor. */
sfk_copy_assignment, /* A copy assignment operator. */
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
sfk_move_assignment, /* A move assignment operator. */
sfk_destructor, /* A destructor. */
sfk_complete_destructor, /* A destructor for complete objects. */
sfk_base_destructor, /* A destructor for base subobjects. */
sfk_deleting_destructor, /* A destructor for complete objects that
deletes the object after it has been
destroyed. */
sfk_conversion, /* A conversion operator. */
sfk_deduction_guide, /* A class template deduction guide. */
sfk_inheriting_constructor /* An inheriting constructor */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
/* The various kinds of linkage. From [basic.link],
A name is said to have linkage when it might denote the same
object, reference, function, type, template, namespace or value
as a name introduced in another scope:
-- When a name has external linkage, the entity it denotes can
be referred to from scopes of other translation units or from
other scopes of the same translation unit.
-- When a name has internal linkage, the entity it denotes can
be referred to by names from other scopes in the same
translation unit.
-- When a name has no linkage, the entity it denotes cannot be
referred to by names from other scopes. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum linkage_kind {
lk_none, /* No linkage. */
lk_internal, /* Internal linkage. */
lk_external /* External linkage. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum duration_kind {
dk_static,
dk_thread,
dk_auto,
dk_dynamic
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
Rename instantiate_type_flags to tsubst_flags_t & expand use. * cp-tree.h (instantiate_type_flags): Rename to ... (tsubst_flags_t): ... here. Rename itf_complain to tf_error, add tf_warning flag. (instantiate_type): Adjust prototype. (tsubst, tsubst_expr, tsubst_copy, lookup_template_class, do_type_instantiation, cp_build_qualified_type_real): Likewise. cp_build_qualified_type: Adjust. * class.c (instantiate_type): Adjust parameter. Rename itf_* to tf_*. * call.c (standard_conversion): Rename itf_* to tf_*. (reference_binding): Likewise. (convert_like_real): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_reference): Likewise. * decl.c (lookup_namespace_name): Use tf_* flags. (make_typename_type): Likewise. (grokdeclarator): Likewise. * pt.c (convert_nontype_argument): Adjust COMPLAIN usage. (coerce_template_template_parms, convert_template_argument, coerce_template_parms, maybe_get_template_decl_from_type_decl, lookup_template_class, tsubst_friend_function, tsubst_friend_class, instantiate_class_template, tsubst_template_arg_vector, tsubst_template_parms, tsubst_aggr_type, tsubst_default_argument, tsubst_decl, tsubst_arg_types, tsubst_function_type, tsubst_call_declarator_parms, tsubst, tsubst_copy, tsubst_expr, instantiate_template, fn_type_unification, resolve_overloaded_unification, verify_class_unification, unify, get_bindings_real, do_type_instantiation, regenerate_decl_from_template, instantiate_decl, tsubst_initializer_list, tsubst_enum, get_mostly_instantiated_function_type, invalid_nontype_parm_type_p): Likewise. * tree.c (cp_build_qualified_type_real): Likewise. * typeck.c (build_binary_op): Rename itf_* to tf_*. (build_ptrmemfunc): Likewise. (convert_for_assignment): Likewise. From-SVN: r49591
2002-02-07 21:51:15 +01:00
/* Bitmask flags to control type substitution. */
enum tsubst_flags {
tf_none = 0, /* nothing special */
tf_error = 1 << 0, /* give error messages */
tf_warning = 1 << 1, /* give warnings too */
tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */
tf_keep_type_decl = 1 << 3, /* retain typedef type decls
(make_typename_type use) */
tf_ptrmem_ok = 1 << 4, /* pointers to member ok (internal
instantiate_type use) */
tf_user = 1 << 5, /* found template must be a user template
(lookup_template_class use) */
tf_conv = 1 << 6, /* We are determining what kind of
conversion might be permissible,
not actually performing the
conversion. */
tf_decltype = 1 << 7, /* We are the operand of decltype.
Used to implement the special rules
for calls in decltype (5.2.2/11). */
Implement return type deduction for normal functions with -std=c++1y. * cp-tree.h (FNDECL_USED_AUTO): New macro. (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P): Remove. (dependent_lambda_return_type_node): Remove. (CPTI_DEPENDENT_LAMBDA_RETURN_TYPE): Remove. (struct language_function): Add x_auto_return_pattern field. (current_function_auto_return_pattern): New. (enum tsubst_flags): Add tf_partial. * decl.c (decls_match): Handle auto return comparison. (duplicate_decls): Adjust error message for auto return. (cxx_init_decl_processing): Remove dependent_lambda_return_type_node. (cp_finish_decl): Don't do auto deduction for functions. (grokdeclarator): Allow auto return without trailing return type in C++1y mode. (check_function_type): Defer checking of deduced return type. (start_preparsed_function): Set current_function_auto_return_pattern. (finish_function): Set deduced return type to void if not previously deduced. * decl2.c (change_return_type): Handle error_mark_node. (mark_used): Always instantiate functions with deduced return type. Complain about use if deduction isn't done. * parser.c (cp_parser_lambda_declarator_opt): Use 'auto' for initial return type. (cp_parser_lambda_body): Don't deduce return type in a template. (cp_parser_conversion_type_id): Allow auto in C++1y. * pt.c (instantiate_class_template_1): Don't mess with LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P. (tsubst_copy_and_build): Likewise. (fn_type_unification, tsubst): Don't reduce the template parm level of 'auto' during deduction. (unify): Compare 'auto' specially. (get_bindings): Change test. (always_instantiate_p): Always instantiate functions with deduced return type. (do_auto_deduction): Handle error_mark_node and lambda context. Don't check for use in initializer. (contains_auto_r): Remove. * search.c (lookup_conversions_r): Handle auto conversion function. * semantics.c (lambda_return_type): Handle null return. Don't mess with dependent_lambda_return_type_node. (apply_deduced_return_type): Rename from apply_lambda_return_type. * typeck.c (merge_types): Handle auto. (check_return_expr): Do auto deduction. * typeck2.c (add_exception_specifier): Fix complain check. From-SVN: r185768
2012-03-24 21:56:08 +01:00
tf_partial = 1 << 8, /* Doing initial explicit argument
substitution in fn_type_unification. */
Implement P0012R1, Make exception specifications part of the type system. gcc/cp/ * cp-tree.h (enum tsubst_flags): Add tf_fndecl_type. (flag_noexcept_type, ce_type): New. * call.c (build_conv): Add ck_fnptr. (enum conversion_kind): Change ck_tsafe to ck_fnptr. (convert_like_real): Likewise. (standard_conversion): Likewise. Allow function pointer conversions for pointers to member functions. (reference_compatible_p): Allow function pointer conversions. (direct_reference_binding): Likewise. (reference_binding): Reference-compatible is no longer a subset of reference-related. (is_subseq): Also strip ck_lvalue after next_conversion. * class.c (instantiate_type): Check fnptr_conv_p. (resolve_address_of_overloaded_function): Likewise. * cvt.c (can_convert_tx_safety): Now static. (noexcept_conv_p, fnptr_conv_p, strip_fnptr_conv): New. * decl.c (flag_noexcept_type): Define. (cxx_init_decl_processing): Set it. (bad_specifiers): Check it. (grokdeclarator) [cdk_function]: Add exception-spec to type here. * lambda.c (maybe_add_lambda_conv_op): Add exception-spec to returned pointer. * mangle.c (struct globals): Add need_cxx1z_warning. (mangle_decl): Check it. (write_exception_spec): New. (write_function_type): Call it. (canonicalize_for_substitution): Handle exception spec. (write_type): Likewise. (write_encoding): Set processing_template_decl across mangling of partially-instantiated type. * pt.c (determine_specialization): Pass tf_fndecl_type. (tsubst_decl, fn_type_unification): Likewise. (tsubst): Strip tf_fndecl_type, pass it to tsubst_exception_specification. (convert_nontype_argument_function): Handle function pointer conversion. (convert_nontype_argument): Likewise. (unify, for_each_template_parm_r): Walk into noexcept-specifier. * rtti.c (ptr_initializer): Encode noexcept. * tree.c (canonical_eh_spec): New. (build_exception_variant): Use it. * typeck.c (composite_pointer_type): Handle fnptr conversion. (comp_except_specs): Compare canonical EH specs. (structural_comptypes): Call it. gcc/c-family/ * c.opt (Wc++1z-compat): New. * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_noexcept_function_type. libstdc++-v3/ * include/bits/c++config (_GLIBCXX_NOEXCEPT_PARM) (_GLIBCXX_NOEXCEPT_QUAL): New. * include/std/type_traits (is_function): Use them. * libsubc++/new (launder): Likewise. * libsupc++/cxxabi.h (__pbase_type_info::__masks): Add __noexcept_mask. * libsupc++/pbase_type_info.cc (__do_catch): Handle function pointer conversion. libiberty/ * cp-demangle.c (is_fnqual_component_type): New. (d_encoding, d_print_comp_inner, d_print_mod_list): Use it. (FNQUAL_COMPONENT_CASE): New. (d_make_comp, has_return_type, d_print_comp_inner) (d_print_function_type): Use it. (next_is_type_qual): New. (d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec. include/ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC. From-SVN: r241944
2016-11-08 00:09:29 +01:00
tf_fndecl_type = 1 << 9, /* Substituting the type of a function
declaration. */
tf_no_cleanup = 1 << 10, /* Do not build a cleanup
(build_target_expr and friends) */
/* Convenient substitution flags combinations. */
tf_warning_or_error = tf_warning | tf_error
};
/* This type is used for parameters and variables which hold
combinations of the flags in enum tsubst_flags. */
typedef int tsubst_flags_t;
/* The kind of checking we can do looking in a class hierarchy. */
alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry. gcc/ChangeLog: * alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry. Change all uses. * except.c (struct call_site_record_d): Rename from struct call_site_record. Change all uses. * except.h (struct eh_region_d): Rename from struct eh_region. Change all uses. * gcse.c (struct hash_table_d): Rename from struct hash_table. Change all uses. * graphite.c (struct ivtype_map_elt_d): Rename fromstruct ivtype_map_elt. Change all uses. (struct rename_map_elt_d): Rename fromstruct rename_map_elt. Change all uses. (struct ifsese_d): Rename fromstruct ifsese. Change all uses. * graphite.h (struct name_tree_d): Rename from struct name_tree. Change all uses. (struct sese_d): Rename from struct sese. Change all uses. * omega.h (struct eqn_d): Rename from struct eqn. Change all uses. (struct omega_pb_d): Rename from struct omega_pb. Change all uses. * optabs.h (struct optab_d): Rename from struct optab. Change all uses. (struct convert_optab_d): Rename from struct convert_optab. Change all uses. * tree-pass.h (struct ipa_opt_pass_d): Rename fromstruct ipa_opt_pass. Change all uses. * tree-predcom.c (struct dref_d): Rename from struct dref. Change all uses. * c-decl.c (pushtag): If -Wc++-compat, warn if the tag is already defined as a typedef. (grokdeclarator): If -Wc++-compat, warn if a typedef is already defined as a tag. gcc/cp/ChangeLog: * cp-tree.h (enum cp_lvalue_kind_flags): Rename from cp_lvalue_kind. Change all uses. (enum base_access_flags): Rename from enum base_access. Change all uses. * parser.c (enum cp_parser_flags): Remove enum tag. gcc/testsuite/ChangeLog: * gcc.dg/Wcxx-compat-10.c: New testcase. libcpp/ChangeLog: * include/cpplib.h (enum cpp_builtin_type): Rename from enum builtin_type. Change all uses. From-SVN: r147605
2009-05-16 08:54:11 +02:00
enum base_access_flags {
ba_any = 0, /* Do not check access, allow an ambiguous base,
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
prefer a non-virtual base */
ba_unique = 1 << 0, /* Must be a unique base. */
ba_check_bit = 1 << 1, /* Check access. */
ba_check = ba_unique | ba_check_bit,
ba_ignore_scope = 1 << 2 /* Ignore access allowed by local scope. */
};
/* This type is used for parameters and variables which hold
alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry. gcc/ChangeLog: * alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry. Change all uses. * except.c (struct call_site_record_d): Rename from struct call_site_record. Change all uses. * except.h (struct eh_region_d): Rename from struct eh_region. Change all uses. * gcse.c (struct hash_table_d): Rename from struct hash_table. Change all uses. * graphite.c (struct ivtype_map_elt_d): Rename fromstruct ivtype_map_elt. Change all uses. (struct rename_map_elt_d): Rename fromstruct rename_map_elt. Change all uses. (struct ifsese_d): Rename fromstruct ifsese. Change all uses. * graphite.h (struct name_tree_d): Rename from struct name_tree. Change all uses. (struct sese_d): Rename from struct sese. Change all uses. * omega.h (struct eqn_d): Rename from struct eqn. Change all uses. (struct omega_pb_d): Rename from struct omega_pb. Change all uses. * optabs.h (struct optab_d): Rename from struct optab. Change all uses. (struct convert_optab_d): Rename from struct convert_optab. Change all uses. * tree-pass.h (struct ipa_opt_pass_d): Rename fromstruct ipa_opt_pass. Change all uses. * tree-predcom.c (struct dref_d): Rename from struct dref. Change all uses. * c-decl.c (pushtag): If -Wc++-compat, warn if the tag is already defined as a typedef. (grokdeclarator): If -Wc++-compat, warn if a typedef is already defined as a tag. gcc/cp/ChangeLog: * cp-tree.h (enum cp_lvalue_kind_flags): Rename from cp_lvalue_kind. Change all uses. (enum base_access_flags): Rename from enum base_access. Change all uses. * parser.c (enum cp_parser_flags): Remove enum tag. gcc/testsuite/ChangeLog: * gcc.dg/Wcxx-compat-10.c: New testcase. libcpp/ChangeLog: * include/cpplib.h (enum cpp_builtin_type): Rename from enum builtin_type. Change all uses. From-SVN: r147605
2009-05-16 08:54:11 +02:00
combinations of the flags in enum base_access_flags. */
typedef int base_access;
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
/* The various kinds of access check during parsing. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum deferring_kind {
dk_no_deferred = 0, /* Check access immediately */
dk_deferred = 1, /* Deferred check */
dk_no_check = 2 /* No access check */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
/* The kind of base we can find, looking in a class hierarchy.
Values <0 indicate we failed. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum base_kind {
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
bk_inaccessible = -3, /* The base is inaccessible */
bk_ambig = -2, /* The base is ambiguous */
bk_not_base = -1, /* It is not a base */
bk_same_type = 0, /* It is the same type */
bk_proper_base = 1, /* It is a proper base */
bk_via_virtual = 2 /* It is a proper base, but via a virtual
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
path. This might not be the canonical
binfo. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
/* Node for "pointer to (virtual) function".
1996-07-11 03:13:25 +02:00
This may be distinct from ptr_type_node so gdb can distinguish them. */
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
#define vfunc_ptr_type_node vtable_entry_type
1994-02-24 02:02:37 +01:00
/* For building calls to `delete'. */
extern GTY(()) tree integer_two_node;
1994-02-24 02:02:37 +01:00
/* The number of function bodies which we are currently processing.
(Zero if we are at namespace scope, one inside the body of a
function, two inside the body of a function in a local class, etc.) */
extern int function_depth;
/* Nonzero if we are inside eq_specializations, which affects comparison of
PARM_DECLs in cp_tree_equal. */
extern int comparing_specializations;
c-common.c (skip_evaluation): Don't define. ./: * c-common.c (skip_evaluation): Don't define. (c_inhibit_evaluation_warnings): Define global variable. (overflow_warning): Check c_inhibit_evaluation_warnings rather than skip_evaluation. (convert_and_check, warn_for_div_by_zero): Likewise. * c-common.h (skip_evaluation): Don't declare. (c_inhibit_evaluation_warnings): Declare. * c-parser.c (c_parser_typeof_specifier): Set c_inhibit_evaluation_warnings rather than skip_evaluation. (c_parser_conditional_expression): Likewise. (c_parser_binary_expression): Likewise. (c_parser_sizeof_expression): Likewise. (c_parser_alignof_expression): Likewise. * c-typeck.c (build_indirect_ref): Check c_inhibit_evaluation_warnings rather than skip_evaluation. (build_conditional_expr, build_binary_op): Likewise. cp/: * parser.c (cp_unevaluated_operand): Define global variable. (cp_parser_question_colon_clause): Increment c_inhibit_evaluation_warnings when evaluating an expression which will never be executed. (cp_parser_decltype): Increment cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. (cp_parser_sizeof_operand): Likewise. (cp_parser_enclosed_template_argument_list): Save cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. * cp-tree.h (struct saved_scope): Remove skip_evaluation field. Add unevaluated_operand and inhibit_evaluation_warnings fields. (cp_unevaluated_operand): Declare. * name-lookup.c (push_to_top_level): Save cp_unevaluated_operand and c_inhibit_evaluation_warnings rather than skip_evaluation. (pop_from_top_level): Restore cp_unevaluated_operand and c_inhibit_evaluation_warnings rather than skip_evaluation. * class.c (build_base_path): Check cp_unevaluated_operand rather than skip_evaluation. * typeck.c (build_class_member_access_expr): Likewise. (cp_build_binary_op): Don't warn about bad shift counts if c_inhibit_evaluation_warnings is non-zero. * pt.c (coerce_template_parms): Save state of cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. (tsubst_aggr_type): Likewise. (tsubst_pack_expansion): Check cp_unevaluated_operand rather than skip_evaluation. (tsubst_copy): Likewise. (tsubst): Set cp_unevaluated_operand and c_inhibit_evaluation_warnings, not skip_evaluation. (tsubst_copy_and_build): Likewise. * call.c (convert_arg_to_ellipsis): Check cp_unevaluated_operand rather than skip_evaluation. * decl2.c (mark_used): Likewise. * semantics.c (finish_non_static_data_member): Likewise. * cvt.c (cp_convert_and_check): Check c_inhibit_evaluation_warnings rather than skip_evaluation. * mangle.c (write_type): Set cp_unevaluated_operand rather than skip_evaluation. testsuite/: * g++.dg/warn/skip-1.C: New testcase. From-SVN: r148535
2009-06-16 16:24:40 +02:00
/* In parser.c. */
/* Nonzero if we are parsing an unevaluated operand: an operand to
sizeof, typeof, or alignof. This is a count since operands to
sizeof can be nested. */
extern int cp_unevaluated_operand;
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
/* RAII class used to inhibit the evaluation of operands during parsing
and template instantiation. Evaluation warnings are also inhibited. */
struct cp_unevaluated
{
cp_unevaluated ();
~cp_unevaluated ();
};
/* in pt.c */
/* These values are used for the `STRICT' parameter to type_unification and
call.c (add_template_candidate): Adjust for changes to fn_type_unification. * call.c (add_template_candidate): Adjust for changes to fn_type_unification. (add_template_candidate_real): Likewise. (add_template_conv_candidate): 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. * class.c (instantiate_type): Likewise. * cp-tree.h (unification_kind_t): New type. (fn_type_unification): Adjust prototype. (type_unificaiton): Likewise. * pt.c (UNIFY_ALLOW_NONE): New macro. (UNIFY_ALLOW_MORE_CV_QUAL): Likewise. (UNIFY_ALLOW_LESS_CV_QUAL): Likewise. (UNIFY_ALLOW_DERIVED): Likewise. (unify): Change prototype. (maybe_adjust_types_for_deduction): New function. (check_cv_quals_for_unify): Likewise. (determine_specialization): Adjust. (fn_type_unification): Likewise. (type_unification): Likewise. (type_unification_real): Likewise. Use maybe_adjust_types_for_deduction. Fix mishandling of back-unification of template functions passed as arguments. Pass appropriate combination of UNIFY_ALLOW_* to unify. (unify): Remove unused NTPARMS parameter. Use check_cv_quals_for_unify. Remove bogus code that allowed too-generous unification in order to adhere more closely to standard. (get_bindings_real): Adjust. (get_class_bindings): Likewise. * method.c (build_overload_identifier): Only use the innermost template arguments when mangling. * pt.c (tsubst_template_argument_vector): New function. (complete_template_args): Deal with the situation where the extra_args contain more than one level of arguments. (lookup_template_class): Deal with member template classes, which may have more than one level of arguments. (tsubst): Don't tsbust into the TREE_TYPE of an IDENTIFIER_NODE. Improve handling of member template classes. Use DECL_PRIMARY_TEMPLATE instead of inline expansion. Use tsubst_template_argument_vector where appropriate. (regenerate_decl_from_template): Break out from ... (instantiate_decl): Here. From-SVN: r19663
1998-05-11 09:25:25 +02:00
fn_type_unification. Their meanings are described with the
documentation for fn_type_unification. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum unification_kind_t {
call.c (add_template_candidate): Adjust for changes to fn_type_unification. * call.c (add_template_candidate): Adjust for changes to fn_type_unification. (add_template_candidate_real): Likewise. (add_template_conv_candidate): 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. * class.c (instantiate_type): Likewise. * cp-tree.h (unification_kind_t): New type. (fn_type_unification): Adjust prototype. (type_unificaiton): Likewise. * pt.c (UNIFY_ALLOW_NONE): New macro. (UNIFY_ALLOW_MORE_CV_QUAL): Likewise. (UNIFY_ALLOW_LESS_CV_QUAL): Likewise. (UNIFY_ALLOW_DERIVED): Likewise. (unify): Change prototype. (maybe_adjust_types_for_deduction): New function. (check_cv_quals_for_unify): Likewise. (determine_specialization): Adjust. (fn_type_unification): Likewise. (type_unification): Likewise. (type_unification_real): Likewise. Use maybe_adjust_types_for_deduction. Fix mishandling of back-unification of template functions passed as arguments. Pass appropriate combination of UNIFY_ALLOW_* to unify. (unify): Remove unused NTPARMS parameter. Use check_cv_quals_for_unify. Remove bogus code that allowed too-generous unification in order to adhere more closely to standard. (get_bindings_real): Adjust. (get_class_bindings): Likewise. * method.c (build_overload_identifier): Only use the innermost template arguments when mangling. * pt.c (tsubst_template_argument_vector): New function. (complete_template_args): Deal with the situation where the extra_args contain more than one level of arguments. (lookup_template_class): Deal with member template classes, which may have more than one level of arguments. (tsubst): Don't tsbust into the TREE_TYPE of an IDENTIFIER_NODE. Improve handling of member template classes. Use DECL_PRIMARY_TEMPLATE instead of inline expansion. Use tsubst_template_argument_vector where appropriate. (regenerate_decl_from_template): Break out from ... (instantiate_decl): Here. From-SVN: r19663
1998-05-11 09:25:25 +02:00
DEDUCE_CALL,
DEDUCE_CONV,
DEDUCE_EXACT
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
call.c (add_template_candidate): Adjust for changes to fn_type_unification. * call.c (add_template_candidate): Adjust for changes to fn_type_unification. (add_template_candidate_real): Likewise. (add_template_conv_candidate): 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. * class.c (instantiate_type): Likewise. * cp-tree.h (unification_kind_t): New type. (fn_type_unification): Adjust prototype. (type_unificaiton): Likewise. * pt.c (UNIFY_ALLOW_NONE): New macro. (UNIFY_ALLOW_MORE_CV_QUAL): Likewise. (UNIFY_ALLOW_LESS_CV_QUAL): Likewise. (UNIFY_ALLOW_DERIVED): Likewise. (unify): Change prototype. (maybe_adjust_types_for_deduction): New function. (check_cv_quals_for_unify): Likewise. (determine_specialization): Adjust. (fn_type_unification): Likewise. (type_unification): Likewise. (type_unification_real): Likewise. Use maybe_adjust_types_for_deduction. Fix mishandling of back-unification of template functions passed as arguments. Pass appropriate combination of UNIFY_ALLOW_* to unify. (unify): Remove unused NTPARMS parameter. Use check_cv_quals_for_unify. Remove bogus code that allowed too-generous unification in order to adhere more closely to standard. (get_bindings_real): Adjust. (get_class_bindings): Likewise. * method.c (build_overload_identifier): Only use the innermost template arguments when mangling. * pt.c (tsubst_template_argument_vector): New function. (complete_template_args): Deal with the situation where the extra_args contain more than one level of arguments. (lookup_template_class): Deal with member template classes, which may have more than one level of arguments. (tsubst): Don't tsbust into the TREE_TYPE of an IDENTIFIER_NODE. Improve handling of member template classes. Use DECL_PRIMARY_TEMPLATE instead of inline expansion. Use tsubst_template_argument_vector where appropriate. (regenerate_decl_from_template): Break out from ... (instantiate_decl): Here. From-SVN: r19663
1998-05-11 09:25:25 +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
// An RAII class used to create a new pointer map for local
// specializations. When the stack goes out of scope, the
// previous pointer map is restored.
struct local_specialization_stack
{
local_specialization_stack ();
~local_specialization_stack ();
hash_map<tree, tree> *saved;
};
/* in class.c */
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
extern int current_class_depth;
1994-02-24 02:02:37 +01:00
/* An array of all local classes present in this translation unit, in
declaration order. */
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
extern GTY(()) vec<tree, va_gc> *local_classes;
1994-02-24 02:02:37 +01:00
/* Here's where we control how name mangling takes place. */
/* Cannot use '$' up front, because this confuses gdb
(names beginning with '$' are gdb-local identifiers).
Note that all forms in which the '$' is significant are long enough
for direct indexing (meaning that if we know there is a '$'
at a particular location, we can index into the string at
any other location that provides distinguishing characters). */
/* Define NO_DOT_IN_LABEL in your favorite tm file if your assembler
doesn't allow '.' in symbol names. */
1994-02-24 02:02:37 +01:00
#ifndef NO_DOT_IN_LABEL
#define JOINER '.'
#define AUTO_TEMP_NAME "_.tmp_"
#define VFIELD_BASE ".vf"
#define VFIELD_NAME "_vptr."
#define VFIELD_NAME_FORMAT "_vptr.%s"
#else /* NO_DOT_IN_LABEL */
#ifndef NO_DOLLAR_IN_LABEL
#define JOINER '$'
#define AUTO_TEMP_NAME "_$tmp_"
#define VFIELD_BASE "$vf"
#define VFIELD_NAME "_vptr$"
#define VFIELD_NAME_FORMAT "_vptr$%s"
#else /* NO_DOLLAR_IN_LABEL */
1994-02-24 02:02:37 +01:00
#define AUTO_TEMP_NAME "__tmp_"
#define TEMP_NAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
sizeof (AUTO_TEMP_NAME) - 1))
#define VTABLE_NAME "__vt_"
#define VTABLE_NAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
sizeof (VTABLE_NAME) - 1))
#define VFIELD_BASE "__vfb"
#define VFIELD_NAME "__vptr_"
#define VFIELD_NAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
sizeof (VFIELD_NAME) - 1))
#define VFIELD_NAME_FORMAT "__vptr_%s"
1994-02-24 02:02:37 +01:00
#endif /* NO_DOLLAR_IN_LABEL */
#endif /* NO_DOT_IN_LABEL */
1994-02-24 02:02:37 +01:00
#define THIS_NAME "this"
#define IN_CHARGE_NAME "__in_chrg"
#define VTBL_PTR_TYPE "__vtbl_ptr_type"
#define VTABLE_DELTA_NAME "__delta"
#define VTABLE_PFN_NAME "__pfn"
#define LAMBDANAME_PREFIX "__lambda"
#define LAMBDANAME_FORMAT LAMBDANAME_PREFIX "%d"
#define UDLIT_OP_ANSI_PREFIX "operator\"\""
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
#define UDLIT_OP_ANSI_FORMAT UDLIT_OP_ANSI_PREFIX "%s"
#define UDLIT_OP_MANGLED_PREFIX "li"
#define UDLIT_OP_MANGLED_FORMAT UDLIT_OP_MANGLED_PREFIX "%s"
#define UDLIT_OPER_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), \
UDLIT_OP_ANSI_PREFIX, \
sizeof (UDLIT_OP_ANSI_PREFIX) - 1))
#define UDLIT_OP_SUFFIX(ID_NODE) \
(IDENTIFIER_POINTER (ID_NODE) + sizeof (UDLIT_OP_ANSI_PREFIX) - 1)
1994-02-24 02:02:37 +01:00
#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
#define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
&& IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
&& IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define TEMP_NAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
#define VFIELD_NAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
1994-02-24 02:02:37 +01:00
#endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
1994-02-24 02:02:37 +01:00
/* Nonzero if we're done parsing and into end-of-file activities.
Two if we're done with front-end processing. */
extern int at_eof;
/* True if note_mangling_alias should enqueue mangling aliases for
later generation, rather than emitting them right away. */
extern bool defer_mangling_aliases;
Implement P0012R1, Make exception specifications part of the type system. gcc/cp/ * cp-tree.h (enum tsubst_flags): Add tf_fndecl_type. (flag_noexcept_type, ce_type): New. * call.c (build_conv): Add ck_fnptr. (enum conversion_kind): Change ck_tsafe to ck_fnptr. (convert_like_real): Likewise. (standard_conversion): Likewise. Allow function pointer conversions for pointers to member functions. (reference_compatible_p): Allow function pointer conversions. (direct_reference_binding): Likewise. (reference_binding): Reference-compatible is no longer a subset of reference-related. (is_subseq): Also strip ck_lvalue after next_conversion. * class.c (instantiate_type): Check fnptr_conv_p. (resolve_address_of_overloaded_function): Likewise. * cvt.c (can_convert_tx_safety): Now static. (noexcept_conv_p, fnptr_conv_p, strip_fnptr_conv): New. * decl.c (flag_noexcept_type): Define. (cxx_init_decl_processing): Set it. (bad_specifiers): Check it. (grokdeclarator) [cdk_function]: Add exception-spec to type here. * lambda.c (maybe_add_lambda_conv_op): Add exception-spec to returned pointer. * mangle.c (struct globals): Add need_cxx1z_warning. (mangle_decl): Check it. (write_exception_spec): New. (write_function_type): Call it. (canonicalize_for_substitution): Handle exception spec. (write_type): Likewise. (write_encoding): Set processing_template_decl across mangling of partially-instantiated type. * pt.c (determine_specialization): Pass tf_fndecl_type. (tsubst_decl, fn_type_unification): Likewise. (tsubst): Strip tf_fndecl_type, pass it to tsubst_exception_specification. (convert_nontype_argument_function): Handle function pointer conversion. (convert_nontype_argument): Likewise. (unify, for_each_template_parm_r): Walk into noexcept-specifier. * rtti.c (ptr_initializer): Encode noexcept. * tree.c (canonical_eh_spec): New. (build_exception_variant): Use it. * typeck.c (composite_pointer_type): Handle fnptr conversion. (comp_except_specs): Compare canonical EH specs. (structural_comptypes): Call it. gcc/c-family/ * c.opt (Wc++1z-compat): New. * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_noexcept_function_type. libstdc++-v3/ * include/bits/c++config (_GLIBCXX_NOEXCEPT_PARM) (_GLIBCXX_NOEXCEPT_QUAL): New. * include/std/type_traits (is_function): Use them. * libsubc++/new (launder): Likewise. * libsupc++/cxxabi.h (__pbase_type_info::__masks): Add __noexcept_mask. * libsupc++/pbase_type_info.cc (__do_catch): Handle function pointer conversion. libiberty/ * cp-demangle.c (is_fnqual_component_type): New. (d_encoding, d_print_comp_inner, d_print_mod_list): Use it. (FNQUAL_COMPONENT_CASE): New. (d_make_comp, has_return_type, d_print_comp_inner) (d_print_function_type): Use it. (next_is_type_qual): New. (d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec. include/ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC. From-SVN: r241944
2016-11-08 00:09:29 +01:00
/* True if noexcept is part of the type (i.e. in C++17). */
extern bool flag_noexcept_type;
/* A list of namespace-scope objects which have constructors or
destructors which reside in the global scope. The decl is stored
in the TREE_VALUE slot and the initializer is stored in the
TREE_PURPOSE slot. */
extern GTY(()) tree static_aggregates;
/* Likewise, for thread local storage. */
extern GTY(()) tree tls_aggregates;
enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG };
1994-02-24 02:02:37 +01:00
/* These are uses as bits in flags passed to various functions to
control their behavior. Despite the LOOKUP_ prefix, many of these
do not control name lookup. ??? Functions using these flags should
probably be modified to accept explicit boolean flags for the
behaviors relevant to them. */
/* Check for access violations. */
#define LOOKUP_PROTECT (1 << 0)
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
#define LOOKUP_NORMAL (LOOKUP_PROTECT)
/* Even if the function found by lookup is a virtual function, it
should be called directly. */
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
#define LOOKUP_NONVIRTUAL (1 << 1)
Implement explicit conversions ops as specified in N2437. * decl.c (grokdeclarator): Handle explicit conversion ops. (check_initializer): Pass flags to store_init_value. * decl2.c (maybe_emit_vtables): Likewise. * init.c (expand_aggr_init_1): Likewise. * call.c (convert_class_to_reference): Take flags parm, check DECL_NONCONVERTING_P. (build_user_type_conversion_1): Check DECL_NONCONVERTING_P. (add_builtin_candidates): Simplify getting type of conversion. (build_object_call): Likewise. Check DECL_NONCONVERTING_P. (implicit_conversion): Pass through LOOKUP_ONLYCONVERTING. (reference_binding): Take flags parm. Direct-initialize copy parm. (add_function_candidate): Direct-initialize the copy parm. (add_conv_candidate): Use LOOKUP_IMPLICIT, not LOOKUP_NORMAL. (build_builtin_candidate): Add LOOKUP_ONLYCONVERTING. (conditional_conversion): Likewise. (convert_like_real): Only complain about DECL_NONCONVERTING_P constructors. (perform_implicit_conversion_flags): Add flags parm to perform_implicit_conversion. Improve diagnostics. * cp-tree.h (LOOKUP_IMPLICIT): New macro. (LOOKUP_COPY_PARM): New bit macro. * cvt.c (build_expr_type_conversion): Check DECL_NONCONVERTING_P. * typeck.c (convert_for_assignment): Take flags parm, pass it to perform_implicit_conversion_flags. (cp_build_modify_expr): Pass flags to convert_for_assignment. (convert_for_initialization): Likewise. * typeck2.c (store_init_value): Take flags parm, pass to digest_init_flags. (digest_init_flags): Add flags parm to digest_init. (digest_init_r): Take flags parm, pass to convert_for_initialization. (process_init_constructor_array): Pass it. (process_init_constructor_record): Likewise. (process_init_constructor_union): Likewise. From-SVN: r147677
2009-05-18 23:48:02 +02:00
/* Non-converting (i.e., "explicit") constructors are not tried. This flag
indicates that we are not performing direct-initialization. */
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
#define LOOKUP_ONLYCONVERTING (1 << 2)
Implement explicit conversions ops as specified in N2437. * decl.c (grokdeclarator): Handle explicit conversion ops. (check_initializer): Pass flags to store_init_value. * decl2.c (maybe_emit_vtables): Likewise. * init.c (expand_aggr_init_1): Likewise. * call.c (convert_class_to_reference): Take flags parm, check DECL_NONCONVERTING_P. (build_user_type_conversion_1): Check DECL_NONCONVERTING_P. (add_builtin_candidates): Simplify getting type of conversion. (build_object_call): Likewise. Check DECL_NONCONVERTING_P. (implicit_conversion): Pass through LOOKUP_ONLYCONVERTING. (reference_binding): Take flags parm. Direct-initialize copy parm. (add_function_candidate): Direct-initialize the copy parm. (add_conv_candidate): Use LOOKUP_IMPLICIT, not LOOKUP_NORMAL. (build_builtin_candidate): Add LOOKUP_ONLYCONVERTING. (conditional_conversion): Likewise. (convert_like_real): Only complain about DECL_NONCONVERTING_P constructors. (perform_implicit_conversion_flags): Add flags parm to perform_implicit_conversion. Improve diagnostics. * cp-tree.h (LOOKUP_IMPLICIT): New macro. (LOOKUP_COPY_PARM): New bit macro. * cvt.c (build_expr_type_conversion): Check DECL_NONCONVERTING_P. * typeck.c (convert_for_assignment): Take flags parm, pass it to perform_implicit_conversion_flags. (cp_build_modify_expr): Pass flags to convert_for_assignment. (convert_for_initialization): Likewise. * typeck2.c (store_init_value): Take flags parm, pass to digest_init_flags. (digest_init_flags): Add flags parm to digest_init. (digest_init_r): Take flags parm, pass to convert_for_initialization. (process_init_constructor_array): Pass it. (process_init_constructor_record): Likewise. (process_init_constructor_union): Likewise. From-SVN: r147677
2009-05-18 23:48:02 +02:00
#define LOOKUP_IMPLICIT (LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING)
/* If a temporary is created, it should be created so that it lives
as long as the current variable bindings; otherwise it only lives
until the end of the complete-expression. It also forces
direct-initialization in cases where other parts of the compiler
have already generated a temporary, such as reference
initialization and the catch parameter. */
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
#define DIRECT_BIND (1 << 3)
/* We're performing a user-defined conversion, so more user-defined
conversions are not permitted (only built-in conversions). */
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
#define LOOKUP_NO_CONVERSION (1 << 4)
/* The user has explicitly called a destructor. (Therefore, we do
not need to check that the object is non-NULL before calling the
destructor.) */
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
#define LOOKUP_DESTRUCTOR (1 << 5)
/* Do not permit references to bind to temporaries. */
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
#define LOOKUP_NO_TEMP_BIND (1 << 6)
/* Do not accept objects, and possibly namespaces. */
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
#define LOOKUP_PREFER_TYPES (1 << 7)
/* Do not accept objects, and possibly types. */
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
#define LOOKUP_PREFER_NAMESPACES (1 << 8)
/* Accept types or namespaces. */
#define LOOKUP_PREFER_BOTH (LOOKUP_PREFER_TYPES | LOOKUP_PREFER_NAMESPACES)
/* Return friend declarations and un-declared builtin functions.
(Normally, these entities are registered in the symbol table, but
not found by lookup.) */
#define LOOKUP_HIDDEN (LOOKUP_PREFER_NAMESPACES << 1)
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
/* Prefer that the lvalue be treated as an rvalue. */
#define LOOKUP_PREFER_RVALUE (LOOKUP_HIDDEN << 1)
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
/* We're inside an init-list, so narrowing conversions are ill-formed. */
#define LOOKUP_NO_NARROWING (LOOKUP_PREFER_RVALUE << 1)
/* We're looking up a constructor for list-initialization. */
#define LOOKUP_LIST_INIT_CTOR (LOOKUP_NO_NARROWING << 1)
Implement explicit conversions ops as specified in N2437. * decl.c (grokdeclarator): Handle explicit conversion ops. (check_initializer): Pass flags to store_init_value. * decl2.c (maybe_emit_vtables): Likewise. * init.c (expand_aggr_init_1): Likewise. * call.c (convert_class_to_reference): Take flags parm, check DECL_NONCONVERTING_P. (build_user_type_conversion_1): Check DECL_NONCONVERTING_P. (add_builtin_candidates): Simplify getting type of conversion. (build_object_call): Likewise. Check DECL_NONCONVERTING_P. (implicit_conversion): Pass through LOOKUP_ONLYCONVERTING. (reference_binding): Take flags parm. Direct-initialize copy parm. (add_function_candidate): Direct-initialize the copy parm. (add_conv_candidate): Use LOOKUP_IMPLICIT, not LOOKUP_NORMAL. (build_builtin_candidate): Add LOOKUP_ONLYCONVERTING. (conditional_conversion): Likewise. (convert_like_real): Only complain about DECL_NONCONVERTING_P constructors. (perform_implicit_conversion_flags): Add flags parm to perform_implicit_conversion. Improve diagnostics. * cp-tree.h (LOOKUP_IMPLICIT): New macro. (LOOKUP_COPY_PARM): New bit macro. * cvt.c (build_expr_type_conversion): Check DECL_NONCONVERTING_P. * typeck.c (convert_for_assignment): Take flags parm, pass it to perform_implicit_conversion_flags. (cp_build_modify_expr): Pass flags to convert_for_assignment. (convert_for_initialization): Likewise. * typeck2.c (store_init_value): Take flags parm, pass to digest_init_flags. (digest_init_flags): Add flags parm to digest_init. (digest_init_r): Take flags parm, pass to convert_for_initialization. (process_init_constructor_array): Pass it. (process_init_constructor_record): Likewise. (process_init_constructor_union): Likewise. From-SVN: r147677
2009-05-18 23:48:02 +02:00
/* This is the first parameter of a copy constructor. */
#define LOOKUP_COPY_PARM (LOOKUP_LIST_INIT_CTOR << 1)
/* We only want to consider list constructors. */
#define LOOKUP_LIST_ONLY (LOOKUP_COPY_PARM << 1)
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* Return after determining which function to call and checking access.
Used by sythesized_method_walk to determine which functions will
be called to initialize subobjects, in order to determine exception
specification and possible implicit delete.
This is kind of a hack, but exiting early avoids problems with trying
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
to perform argument conversions when the class isn't complete yet. */
#define LOOKUP_SPECULATIVE (LOOKUP_LIST_ONLY << 1)
/* Used by calls from defaulted functions to limit the overload set to avoid
cycles trying to declare them (core issue 1092). */
#define LOOKUP_DEFAULTED (LOOKUP_SPECULATIVE << 1)
call.c (null_ptr_cst_p): Use maybe_constant_value. * call.c (null_ptr_cst_p): Use maybe_constant_value. (set_up_extended_ref_temp): Support constant initialization. (initialize_reference): Adjust. * class.c (check_bitfield_decl): Use cxx_constant_value. * cvt.c (ocp_convert): Don't use integral_constant_value when converting to class type. * decl.c (finish_case_label): Use maybe_constant_value. (build_init_list_var_init): Support constant initialization. (check_initializer): Likewise. Reorganize. (cp_finish_decl): Likewise. (expand_static_init): Likewise. (compute_array_index_type): Use maybe_constant_value. Add complain parm. (create_array_type_for_decl, grokdeclarator): Pass it. (build_enumerator): Use cxx_constant_value. * decl2.c (grokfield): Use maybe_constant_init. * except.c (check_noexcept_r): Handle constexpr. (build_noexcept_spec): Use maybe_constant_value. * init.c (expand_default_init): Support constant initialization. (build_vec_init): Likewise. (constant_value_1): Adjust. (build_new_1): Adjust. * parser.c (cp_parser_constant_expression): Allow non-integral in C++0x mode. (cp_parser_direct_declarator): Don't fold yet in C++0x mode. (cp_parser_initializer_clause): Toss folded result if non-constant. * pt.c (fold_decl_constant_value): Remove. (convert_nontype_argument): Use maybe_constant_value. Give clearer error about overflow. (tsubst): Move array bounds handling into compute_array_index_type. (value_dependent_expression_p): Handle constant CALL_EXPR. * semantics.c (finish_static_assert): Use maybe_constant_value. (ensure_literal_type_for_constexpr_object): Make sure type is complete. (potential_constant_expression): Use maybe_constant_value. * tree.c (cast_valid_in_integral_constant_expression_p): Any cast is potentially valid in C++0x. * typeck2.c (store_init_value): Handle constant init. (check_narrowing): Use maybe_constant_value. (build_functional_cast): Set TREE_CONSTANT on literal T(). * cp-tree.h (DECL_INTEGRAL_CONSTANT_VAR_P): Remove. (LOOKUP_ALREADY_DIGESTED): New. (compute_array_index_type): Adjust prototype. From-SVN: r166167
2010-11-02 02:31:18 +01:00
/* Used in calls to store_init_value to suppress its usual call to
digest_init. */
#define LOOKUP_ALREADY_DIGESTED (LOOKUP_DEFAULTED << 1)
/* An instantiation with explicit template arguments. */
#define LOOKUP_EXPLICIT_TMPL_ARGS (LOOKUP_ALREADY_DIGESTED << 1)
/* Like LOOKUP_NO_TEMP_BIND, but also prevent binding to xvalues. */
#define LOOKUP_NO_RVAL_BIND (LOOKUP_EXPLICIT_TMPL_ARGS << 1)
/* Used by case_conversion to disregard non-integral conversions. */
#define LOOKUP_NO_NON_INTEGRAL (LOOKUP_NO_RVAL_BIND << 1)
/* Used for delegating constructors in order to diagnose self-delegation. */
#define LOOKUP_DELEGATING_CONS (LOOKUP_NO_NON_INTEGRAL << 1)
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define LOOKUP_NAMESPACES_ONLY(F) \
(((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
#define LOOKUP_TYPES_ONLY(F) \
(!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES))
#define LOOKUP_QUALIFIERS_ONLY(F) ((F) & LOOKUP_PREFER_BOTH)
1994-02-24 02:02:37 +01:00
/* These flags are used by the conversion code.
CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
CONV_STATIC : Perform the explicit conversions for static_cast.
CONV_CONST : Perform the explicit conversions for const_cast.
CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
CONV_PRIVATE : Perform upcasts to private bases.
CONV_FORCE_TEMP : Require a new temporary when converting to the same
aggregate type. */
#define CONV_IMPLICIT 1
#define CONV_STATIC 2
#define CONV_CONST 4
#define CONV_REINTERPRET 8
#define CONV_PRIVATE 16
/* #define CONV_NONCONVERTING 32 */
#define CONV_FORCE_TEMP 64
#define CONV_FOLD 128
#define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
| CONV_REINTERPRET)
#define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
| CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
#define CONV_BACKEND_CONVERT (CONV_OLD_CONVERT | CONV_FOLD)
/* Used by build_expr_type_conversion to indicate which types are
acceptable as arguments to the expression under consideration. */
#define WANT_INT 1 /* integer types, including bool */
#define WANT_FLOAT 2 /* floating point types */
#define WANT_ENUM 4 /* enumerated types */
#define WANT_POINTER 8 /* pointer types */
#define WANT_NULL 16 /* null pointer constant */
#define WANT_VECTOR_OR_COMPLEX 32 /* vector or complex types */
#define WANT_ARITH (WANT_INT | WANT_FLOAT | WANT_VECTOR_OR_COMPLEX)
/* Used with comptypes, and related functions, to guide type
cp-tree.h (COMPARE_STRICT): New macro. * cp-tree.h (COMPARE_STRICT): New macro. (COMPARE_BASE): Likewise. (COMPARE_RELAXED): Likewise. (COMPARE_REDECLARATION): Likewise. (same_type_p): Likewise. (same_or_base_type_p): Likewise. * call.c (standard_conversion): Use them, in place of comptypes with numeric arguments. (reference_binding): Likewise. (convert_like): Likewise. (build_over_call): Likewise. (is_subseq): Likewise. (is_properly_derived_from): Likewise. (compare_ics): Likewise. (joust): Likewise. * class.c (delete_duplicate_fields_1): Likewise. (resolves_to_fixed_type_p): Likewise. (instantiate_type): Likewise. Remove #if 0'd code. * decl.c (decls_match): Likewise. Use COMPARE_REDECLARATION here. (pushdecl): Likewise. (lookup_name_real): Likewise. (grokdeclarator): Likewise. Check for illegal array declarations. (grokparms): Likewise. (grok_op_properties): Likewise. * decl2.c (check_classfn): Likewise. * friend.c (is_friend): Likewise. (make_friend_class): Likewise. * init.c (expand_aggr_init): Likewise. (expand_vec_init): Likewise. * pt.c (is_member_template_class): Remove declaration. (is_specialization_of): Use COMPARE_* and new macros. (comp_template_parms): Likewise. (convert_nontype_argument): Likewise. (coerce_template_template_parms): Likewise. (template_args_equal): Likewise. (lookup_template_class): Likewise. (type_unification_real): Likewise. (unify): Likewise. (get_bindings_real): Likewise. * search.c (covariant_return_p): Likewise. (get_matching_virtual): Likewise. * sig.c (match_method_types): Likewise. * tree.c (vec_binfo_member): Likewise. (cp_tree_equal): Likewise. * typeck.c (common_type): Likewise. (comp_array_types): Likewise. Get issues involving unknown array bounds right. (comptypes): Update comments. Use new flags. (comp_target_types): Use new macros. (compparms): Likewise. (comp_target_parms): Likewise. (string_conv_p): Likewise. (build_component_ref): Likewise. (build_indirect_ref): Likewise. (build_conditional_expr): Likewise. (build_static_cast): Likewise. (build_reinterpret_cast): Likewise. (build_const_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (comp_ptr_ttypes_real): Likewise. (ptr_reasonably_similar): Likewise. (comp_ptr_ttypes_const): Likewise. From-SVN: r23490
1998-11-01 16:45:11 +01:00
comparison. */
#define COMPARE_STRICT 0 /* Just check if the types are the
cp-tree.h (COMPARE_STRICT): New macro. * cp-tree.h (COMPARE_STRICT): New macro. (COMPARE_BASE): Likewise. (COMPARE_RELAXED): Likewise. (COMPARE_REDECLARATION): Likewise. (same_type_p): Likewise. (same_or_base_type_p): Likewise. * call.c (standard_conversion): Use them, in place of comptypes with numeric arguments. (reference_binding): Likewise. (convert_like): Likewise. (build_over_call): Likewise. (is_subseq): Likewise. (is_properly_derived_from): Likewise. (compare_ics): Likewise. (joust): Likewise. * class.c (delete_duplicate_fields_1): Likewise. (resolves_to_fixed_type_p): Likewise. (instantiate_type): Likewise. Remove #if 0'd code. * decl.c (decls_match): Likewise. Use COMPARE_REDECLARATION here. (pushdecl): Likewise. (lookup_name_real): Likewise. (grokdeclarator): Likewise. Check for illegal array declarations. (grokparms): Likewise. (grok_op_properties): Likewise. * decl2.c (check_classfn): Likewise. * friend.c (is_friend): Likewise. (make_friend_class): Likewise. * init.c (expand_aggr_init): Likewise. (expand_vec_init): Likewise. * pt.c (is_member_template_class): Remove declaration. (is_specialization_of): Use COMPARE_* and new macros. (comp_template_parms): Likewise. (convert_nontype_argument): Likewise. (coerce_template_template_parms): Likewise. (template_args_equal): Likewise. (lookup_template_class): Likewise. (type_unification_real): Likewise. (unify): Likewise. (get_bindings_real): Likewise. * search.c (covariant_return_p): Likewise. (get_matching_virtual): Likewise. * sig.c (match_method_types): Likewise. * tree.c (vec_binfo_member): Likewise. (cp_tree_equal): Likewise. * typeck.c (common_type): Likewise. (comp_array_types): Likewise. Get issues involving unknown array bounds right. (comptypes): Update comments. Use new flags. (comp_target_types): Use new macros. (compparms): Likewise. (comp_target_parms): Likewise. (string_conv_p): Likewise. (build_component_ref): Likewise. (build_indirect_ref): Likewise. (build_conditional_expr): Likewise. (build_static_cast): Likewise. (build_reinterpret_cast): Likewise. (build_const_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (comp_ptr_ttypes_real): Likewise. (ptr_reasonably_similar): Likewise. (comp_ptr_ttypes_const): Likewise. From-SVN: r23490
1998-11-01 16:45:11 +01:00
same. */
#define COMPARE_BASE 1 /* Check to see if the second type is
derived from the first. */
#define COMPARE_DERIVED 2 /* Like COMPARE_BASE, but in
reverse. */
#define COMPARE_REDECLARATION 4 /* The comparison is being done when
cp-tree.h (COMPARE_STRICT): New macro. * cp-tree.h (COMPARE_STRICT): New macro. (COMPARE_BASE): Likewise. (COMPARE_RELAXED): Likewise. (COMPARE_REDECLARATION): Likewise. (same_type_p): Likewise. (same_or_base_type_p): Likewise. * call.c (standard_conversion): Use them, in place of comptypes with numeric arguments. (reference_binding): Likewise. (convert_like): Likewise. (build_over_call): Likewise. (is_subseq): Likewise. (is_properly_derived_from): Likewise. (compare_ics): Likewise. (joust): Likewise. * class.c (delete_duplicate_fields_1): Likewise. (resolves_to_fixed_type_p): Likewise. (instantiate_type): Likewise. Remove #if 0'd code. * decl.c (decls_match): Likewise. Use COMPARE_REDECLARATION here. (pushdecl): Likewise. (lookup_name_real): Likewise. (grokdeclarator): Likewise. Check for illegal array declarations. (grokparms): Likewise. (grok_op_properties): Likewise. * decl2.c (check_classfn): Likewise. * friend.c (is_friend): Likewise. (make_friend_class): Likewise. * init.c (expand_aggr_init): Likewise. (expand_vec_init): Likewise. * pt.c (is_member_template_class): Remove declaration. (is_specialization_of): Use COMPARE_* and new macros. (comp_template_parms): Likewise. (convert_nontype_argument): Likewise. (coerce_template_template_parms): Likewise. (template_args_equal): Likewise. (lookup_template_class): Likewise. (type_unification_real): Likewise. (unify): Likewise. (get_bindings_real): Likewise. * search.c (covariant_return_p): Likewise. (get_matching_virtual): Likewise. * sig.c (match_method_types): Likewise. * tree.c (vec_binfo_member): Likewise. (cp_tree_equal): Likewise. * typeck.c (common_type): Likewise. (comp_array_types): Likewise. Get issues involving unknown array bounds right. (comptypes): Update comments. Use new flags. (comp_target_types): Use new macros. (compparms): Likewise. (comp_target_parms): Likewise. (string_conv_p): Likewise. (build_component_ref): Likewise. (build_indirect_ref): Likewise. (build_conditional_expr): Likewise. (build_static_cast): Likewise. (build_reinterpret_cast): Likewise. (build_const_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (comp_ptr_ttypes_real): Likewise. (ptr_reasonably_similar): Likewise. (comp_ptr_ttypes_const): Likewise. From-SVN: r23490
1998-11-01 16:45:11 +01:00
another declaration of an existing
entity is seen. */
c-common.c (c_common_nodes_and_builtins): Since variants of void_type_node get built before it is given a name... 2007-01-02 Douglas Gregor <doug.gregor@gmail.com> * c-common.c(c_common_nodes_and_builtins): Since variants of void_type_node get built before it is given a name, we need to give those variants the name, too. (complete_array_type): We need to work with the canonical main type of the array, from which we will build the qualified version. * params.def (PARAM_VERIFY_CANONICAL_TYPES): New. * print-tree.c (print_node): Display canonical type information for each type. * stor-layout.c (layout_type): When we don't know the alignment of a type for which we're building an array, we end up guessing wrong, so make the type require structural equality. * tree.c (make_node_stat): When we build a new type, it is its own canonical type. (build_type_attribute_qual_variant): When building an attribute variant, its canonical type is the non-attribute variant. However, if the attributes are target-dependent and they differ, we need to use structural equality checks for this type. (build_qualified_type): A qualified type is not equivalent to its unqualified variant; set the canonical type appropriately. (build_distinct_type_copy): When building a distinct type from another type, the new type is its own canonical type. (build_variant_type_copy): When building a new type variant, we assume that it is equivalent to the original type. (build_pointer_type_for_mode): When building a pointer type, also build a canonical type pointer. (build_reference_type_for_mode): When building a reference type, also build a canonical type reference. (build_index_type): When we can't hash an index type (e.g., because its maximum value is negative), the index type requires structural equality tests. (build_array_type): Build the canonical form of an array type. (build_function_type): Function types require structural equality, because they contain default arguments, attributes, etc. (build_method_type_directly): Ditto for method types. (build_offset_type): Build the canonical offset type. (build_complex_type): Build the canonical vector type. (make_vector_type): Build the canonical vector type. * tree.h (TYPE_CANONICAL): New. (TYPE_STRUCTURAL_EQUALITY_P): New. (SET_TYPE_STRUCTURAL_EQUALITY): New. (struct tree_type): Added "canonical" field. * params.h (VERIFY_CANONICAL_TYPES): New. * doc/c-tree.texi (TYPE_CANONICAL): Document. (TYPE_STRUCTURAL_EQUALITY_P): Document. (SET_TYPE_STRUCTURAL_EQUALITY): Document. * doc/invoke.texi (verify-canonical-types): Document --param parameter for verifying canonical types. 2007-01-02 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (structural_comptypes): Renamed from "comptypes". (comptypes): Use canonical type information to perform fast type comparison. When VERIFY_CANONICAL_TYPES, verify that the canonical type comparison returns the same results as we would see from the current, structural check. Support COMPARE_STRUCTURAL when we need structural checks. * decl.c (typename_compare): Fix comment. (build_typename_type): TYPENAME_TYPE nodes require structural equality checks, because they resolve different based on the current class type. (make_unbound_class_template): UNBOUND_CLASS_TEMPLATE nodes require structural equality checks (for now). (build_ptrmemfunc_type): Build the canonical pointer to member function type. (compute_array_index_type): Whenever we build a new index type to represent the size of an array in a template, we need to mark this index type as requiring structural equality. This goes for arrays with value-dependent sizes with the current ABI, or all arrays with ABI-1. * tree.c (cplus_array_hash): New. (struct cplus_array_info): New. (cplus_array_compare): New. (cplus_array_htab): New. (build_cplus_array_type_1): Use a hash table to cache the array types we build. Build the canonical array type for each array type. (cp_build_qualified_type_real): When building a cv-qualified array type, use the hash table of array types and build canonical array types as necessary. (bind_template_template_parm): BOUND_TEMPLATE_TEMPLATE_PARM nodes use structural equality (for now). * cp-tree.h (COMPARE_STRUCTURAL): New. * pt.c (canonical_template_parms): New. (canonical_type_parameter): New. (process_template_parm): Find the canonical type parameter. (lookup_template_class): When we have named the primary template type, set the canonical type for our template class to the primary template type. If any of the template arguments need structural equality checks, the template class needs structural equality checks. (tsubst): When reducing the level of a template template parameter, we require structural equality tests for the resulting parameter because its template parameters have not had their types canonicalized. When reducing a template type parameter, find the canonical reduced type parameter. (any_template_arguments_need_structural_equality_p): New. 2007-01-02 Douglas Gregor <doug.gregor@gmail.com> * objc-act.c (objc_build_volatilized_type): Keep track of canonical types. (objc_get_protocol_qualified_type): Ditto. From-SVN: r120341
2007-01-02 15:23:26 +01:00
#define COMPARE_STRUCTURAL 8 /* The comparison is intended to be
structural. The actual comparison
will be identical to
COMPARE_STRICT. */
cp-tree.h (COMPARE_STRICT): New macro. * cp-tree.h (COMPARE_STRICT): New macro. (COMPARE_BASE): Likewise. (COMPARE_RELAXED): Likewise. (COMPARE_REDECLARATION): Likewise. (same_type_p): Likewise. (same_or_base_type_p): Likewise. * call.c (standard_conversion): Use them, in place of comptypes with numeric arguments. (reference_binding): Likewise. (convert_like): Likewise. (build_over_call): Likewise. (is_subseq): Likewise. (is_properly_derived_from): Likewise. (compare_ics): Likewise. (joust): Likewise. * class.c (delete_duplicate_fields_1): Likewise. (resolves_to_fixed_type_p): Likewise. (instantiate_type): Likewise. Remove #if 0'd code. * decl.c (decls_match): Likewise. Use COMPARE_REDECLARATION here. (pushdecl): Likewise. (lookup_name_real): Likewise. (grokdeclarator): Likewise. Check for illegal array declarations. (grokparms): Likewise. (grok_op_properties): Likewise. * decl2.c (check_classfn): Likewise. * friend.c (is_friend): Likewise. (make_friend_class): Likewise. * init.c (expand_aggr_init): Likewise. (expand_vec_init): Likewise. * pt.c (is_member_template_class): Remove declaration. (is_specialization_of): Use COMPARE_* and new macros. (comp_template_parms): Likewise. (convert_nontype_argument): Likewise. (coerce_template_template_parms): Likewise. (template_args_equal): Likewise. (lookup_template_class): Likewise. (type_unification_real): Likewise. (unify): Likewise. (get_bindings_real): Likewise. * search.c (covariant_return_p): Likewise. (get_matching_virtual): Likewise. * sig.c (match_method_types): Likewise. * tree.c (vec_binfo_member): Likewise. (cp_tree_equal): Likewise. * typeck.c (common_type): Likewise. (comp_array_types): Likewise. Get issues involving unknown array bounds right. (comptypes): Update comments. Use new flags. (comp_target_types): Use new macros. (compparms): Likewise. (comp_target_parms): Likewise. (string_conv_p): Likewise. (build_component_ref): Likewise. (build_indirect_ref): Likewise. (build_conditional_expr): Likewise. (build_static_cast): Likewise. (build_reinterpret_cast): Likewise. (build_const_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (comp_ptr_ttypes_real): Likewise. (ptr_reasonably_similar): Likewise. (comp_ptr_ttypes_const): Likewise. From-SVN: r23490
1998-11-01 16:45:11 +01:00
/* Used with push_overloaded_decl. */
#define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
regardless of the current scope. */
#define PUSH_LOCAL 1 /* Push the DECL into the current
scope. */
#define PUSH_USING 2 /* We are pushing this DECL as the
result of a using declaration. */
Reorganize per-function data. * cp-tree.h (saved_scope): Add function_decl, bindings. (language_function): Rename binding_level to bindings. (cp_function_chain): Use the current_function, not the outer_function_chain. (current_class_ptr): Make it work, even when there's no current function. (current_class_ref): Likewise. (SF_DEFAULT, SF_PRE_PARSED, SF_INCLASS_INLINE, SF_EXPAND): New macros. (clear_temp_name): Remove. * decl.c (check_function_type): New function, broken out from start_function. (current_binding_level): Adjust definition. (pushlevel): Simplify. (poplevel): Don't use named_label_uses when we're outside a function scope. (mark_saved_scope): Mark function_decl and bindings. (maybe_push_to_top_level): Don't unconditionally push a new function context. Save bindings and the current_function_decl. Don't clear named_labels. (pop_from_top_level): Pop function context if appropriate. (init_decl_processing): Set init_lang_status and free_lang_status, rather than save_lang_status and restore_lang_status. (start_function): Take SF_* flags. Don't clear per-function data. Reorder and simplify to use new per-function data code. Add asserts. (store_parm_decls): Don't call init_function_start here. (finish_function): Adjust for new handling of per-function data. (push_cp_function_context): Simplify. (mark_cp_function_context): Change binding_level to bindings. * decl2.c (clear_temp_name): Remove. (start_objects): Use SF flags to start_function. (start_static_storage_duration_function): Likewise. * except.c (start_anon_func): Remove redundant calls to push_function_context_to. Use SF flags to start function. (end_anon_func): Remove redundant call to pop_function_context from. * lex.c (reinit_parse_for_function): Don't initialize per-function data. * method.c (emit_thunk): Clear current_function after calling assemble_end_function. Use SF flags for start_function. (synthesize_method): Use SF flags for start_function. * parse.c: Regenerated. * parse.y (fn.defpen): Likewise. (pending_inline): Clear current_function, even if something goes wrong. * pt.c (instantiate_decl): Use SF flags to start_function. Don't save and restore expanding_p. (add_tree): Handle the case where we are outside any function. (end_tree): Likewise. * rtti.c (sythesize_tinfo_fn): Use SF flags to start_function. * semantics.c (begin_function_definition): Likewise. (expand_body): Likewise. From-SVN: r29240
1999-09-09 21:02:39 +02:00
/* Used with start function. */
#define SF_DEFAULT 0 /* No flags. */
#define SF_PRE_PARSED 1 /* The function declaration has
Reorganize per-function data. * cp-tree.h (saved_scope): Add function_decl, bindings. (language_function): Rename binding_level to bindings. (cp_function_chain): Use the current_function, not the outer_function_chain. (current_class_ptr): Make it work, even when there's no current function. (current_class_ref): Likewise. (SF_DEFAULT, SF_PRE_PARSED, SF_INCLASS_INLINE, SF_EXPAND): New macros. (clear_temp_name): Remove. * decl.c (check_function_type): New function, broken out from start_function. (current_binding_level): Adjust definition. (pushlevel): Simplify. (poplevel): Don't use named_label_uses when we're outside a function scope. (mark_saved_scope): Mark function_decl and bindings. (maybe_push_to_top_level): Don't unconditionally push a new function context. Save bindings and the current_function_decl. Don't clear named_labels. (pop_from_top_level): Pop function context if appropriate. (init_decl_processing): Set init_lang_status and free_lang_status, rather than save_lang_status and restore_lang_status. (start_function): Take SF_* flags. Don't clear per-function data. Reorder and simplify to use new per-function data code. Add asserts. (store_parm_decls): Don't call init_function_start here. (finish_function): Adjust for new handling of per-function data. (push_cp_function_context): Simplify. (mark_cp_function_context): Change binding_level to bindings. * decl2.c (clear_temp_name): Remove. (start_objects): Use SF flags to start_function. (start_static_storage_duration_function): Likewise. * except.c (start_anon_func): Remove redundant calls to push_function_context_to. Use SF flags to start function. (end_anon_func): Remove redundant call to pop_function_context from. * lex.c (reinit_parse_for_function): Don't initialize per-function data. * method.c (emit_thunk): Clear current_function after calling assemble_end_function. Use SF flags for start_function. (synthesize_method): Use SF flags for start_function. * parse.c: Regenerated. * parse.y (fn.defpen): Likewise. (pending_inline): Clear current_function, even if something goes wrong. * pt.c (instantiate_decl): Use SF flags to start_function. Don't save and restore expanding_p. (add_tree): Handle the case where we are outside any function. (end_tree): Likewise. * rtti.c (sythesize_tinfo_fn): Use SF flags to start_function. * semantics.c (begin_function_definition): Likewise. (expand_body): Likewise. From-SVN: r29240
1999-09-09 21:02:39 +02:00
already been parsed. */
#define SF_INCLASS_INLINE 2 /* The function is an inline, defined
in the class body. */
/* Used with start_decl's initialized parameter. */
#define SD_UNINITIALIZED 0
#define SD_INITIALIZED 1
#define SD_DEFAULTED 2
#define SD_DELETED 3
cp-tree.h (COMPARE_STRICT): New macro. * cp-tree.h (COMPARE_STRICT): New macro. (COMPARE_BASE): Likewise. (COMPARE_RELAXED): Likewise. (COMPARE_REDECLARATION): Likewise. (same_type_p): Likewise. (same_or_base_type_p): Likewise. * call.c (standard_conversion): Use them, in place of comptypes with numeric arguments. (reference_binding): Likewise. (convert_like): Likewise. (build_over_call): Likewise. (is_subseq): Likewise. (is_properly_derived_from): Likewise. (compare_ics): Likewise. (joust): Likewise. * class.c (delete_duplicate_fields_1): Likewise. (resolves_to_fixed_type_p): Likewise. (instantiate_type): Likewise. Remove #if 0'd code. * decl.c (decls_match): Likewise. Use COMPARE_REDECLARATION here. (pushdecl): Likewise. (lookup_name_real): Likewise. (grokdeclarator): Likewise. Check for illegal array declarations. (grokparms): Likewise. (grok_op_properties): Likewise. * decl2.c (check_classfn): Likewise. * friend.c (is_friend): Likewise. (make_friend_class): Likewise. * init.c (expand_aggr_init): Likewise. (expand_vec_init): Likewise. * pt.c (is_member_template_class): Remove declaration. (is_specialization_of): Use COMPARE_* and new macros. (comp_template_parms): Likewise. (convert_nontype_argument): Likewise. (coerce_template_template_parms): Likewise. (template_args_equal): Likewise. (lookup_template_class): Likewise. (type_unification_real): Likewise. (unify): Likewise. (get_bindings_real): Likewise. * search.c (covariant_return_p): Likewise. (get_matching_virtual): Likewise. * sig.c (match_method_types): Likewise. * tree.c (vec_binfo_member): Likewise. (cp_tree_equal): Likewise. * typeck.c (common_type): Likewise. (comp_array_types): Likewise. Get issues involving unknown array bounds right. (comptypes): Update comments. Use new flags. (comp_target_types): Use new macros. (compparms): Likewise. (comp_target_parms): Likewise. (string_conv_p): Likewise. (build_component_ref): Likewise. (build_indirect_ref): Likewise. (build_conditional_expr): Likewise. (build_static_cast): Likewise. (build_reinterpret_cast): Likewise. (build_const_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (comp_ptr_ttypes_real): Likewise. (ptr_reasonably_similar): Likewise. (comp_ptr_ttypes_const): Likewise. From-SVN: r23490
1998-11-01 16:45:11 +01:00
/* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
class derived from the type pointed to (referred to) by TYPE1. */
cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis. (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise. (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise. (RECORD_OR_UNION_TYPE_CHECK): Likewise. (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise. (C_IS_RESERVED_WORD): Uppercase macro parameter. (C_RID_YYCODE) Likewise. (ptrmem_cst): Use rtx. (LOCAL_BINDING_P): Add whitespace. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Wrap long line. (BINDING_HAS_LEVEL_P): Remove parenthesis. (BINDING_VALUE): Wrap long line. (BINDING_TYPE): Whitespace. (IDENTIFIER_GLOBAL_VALUE): Add parenthesis. (SET_IDENTIFIER_GLOBAL_VALUE): Likewise. (IDENTIFIER_NAMESPACE_VALUE): Likewise. (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise. (same_type_p): Uppercase macro parameters. (same_type_ignoring_top_level_qualifiers_p): Likewise. (OVL_FUNCTION): Wrap long line. (OVL_CHAIN): Whitespace. (OVL_CURRENT): Add paranthesis and whitespace. (OVL_NEXT): Whitespace. (OVL_USED): Likewise. (IDENTIFIER_TYPE_VALUE): Likewise. (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis. (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace. (LANG_ID_FIELD): Whitespace. (SET_LANG_ID(NODE,VALUE,NAME): Likewise. (IDENTIFIER_LABEL_VALUE): Whitespace and wrap. (SET_IDENTIFIER_LABEL_VALUE): Whitespace. (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap. (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace. (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap. (SET_IDENTIFIER_ERROR_LOCUS); Whitespace. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_OPNAME_P): Likewise. (IDENTIFIER_TYPENAME_P): Remove parenthesis. (C_TYPE_FIELDS_READONLY): Uppercase macro parameters. (C_SET_EXP_ORIGINAL_CODE): Likewise. (TYPE_ASSEMBLER_NAME_STRING): Wrap long line. (TYPE_ASSEMBLER_NAME_LENGTH): Likewise. (IS_AGGR_TYPE): Uppercase macro parameter. (CLASS_TYPE_P): Likewise. (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis. (IS_AGGR_TYPE_2): Whitespace. (TAGGED_TYPE_P): Uppercase macro parameter. (TYPE_BUILT_IN): Whitespace. (TYPE_FOR_JAVA): Likewise. (FUNCTION_ARG_CHAIN): Remove parenthesis. (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis. (FUNCTION_FIRST_USER_PARAM): Likewise. (PROMOTES_TO_AGGR_TYPE): Whitespace. (DERIVED_FROM_P): Add parenthesis and wrap. (UNIQUELY_DERIVED_FROM_P): Likewise. (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise. (PUBLICLY_UNIQUELY_DERIVED_P): Likewise. (CLASSTYPE_USE_TEMPLATE): Whitespace. (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis. (TYPE_GETS_DELETE): Add parenthesis. (TYPE_HAS_CONVERSION): Add parenthesis and wrap. (TYPE_HAS_ASSIGN_REF): Likewise, (TYPE_HAS_CONST_ASSIGN_REF): Likewise. (TYPE_HAS_INIT_REF): Likewise. (TYPE_HAS_CONST_INIT_REF): Likewise. (TYPE_BEING_DEFINED): Likewise. (TYPE_LANG_SPECIFIC): Likewise. (CLASSTYPE_RTTI): Likewise. (TYPE_OVERLOADS_CALL_EXPR): Likewise. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (TYPE_USES_MULTIPLE_INHERITANCE): Likewise. (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis. (CLASSTYPE_METHOD_VEC): Likewise. (CLASSTYPE_MARKED_N): Likewise. (CLASSTYPE_MARKED): Likewise. (CLASSTYPE_MARKED2): Likewise. (CLASSTYPE_MARKED3): Likewise. (CLASSTYPE_MARKED4): Likewise. (CLASSTYPE_MARKED5): Likewise. (CLASSTYPE_MARKED6): Likewise. (SET_CLASSTYPE_MARKED): Whitespace. (CLEAR_CLASSTYPE_MARKED): Likewise. (SET_CLASSTYPE_MARKED2): Likewise. (CLEAR_CLASSTYPE_MARKED2): Likewise. (SET_CLASSTYPE_MARKED3): Likewise. (CLEAR_CLASSTYPE_MARKED3): Likewise. (SET_CLASSTYPE_MARKED4): Likewise. (CLEAR_CLASSTYPE_MARKED4): Likewise. (SET_CLASSTYPE_MARKED5): Likewise. (CLEAR_CLASSTYPE_MARKED5): Likewise. (SET_CLASSTYPE_MARKED6): Likewise. (CLEAR_CLASSTYPE_MARKED6): Likewise. (CLASSTYPE_TAGS): Likewise. (CLASSTYPE_VSIZE): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CANONICAL_BINFO): Add parenthesis. (CLASSTYPE_SIZE(NODE): Likewise. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN(NODE): Likewise. (CLASSTYPE_USER_ALIGN): Likewise. (TYPE_JAVA_INTERFACE): Likewise. (CLASSTYPE_PURE_VIRTUALS): Likewise. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_HAS_MUTABLE): Likewise. (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise. (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap. (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap. (BINFO_UNSHARED_MARKED): Whitespace. (BINFO_MARKED): Whitespace and wrap. (SET_BINFO_MARKED): Likewise. (CLEAR_BINFO_MARKED): Likewise. (BINFO_VTABLE_PATH_MARKED): Likewise. (SET_BINFO_VTABLE_PATH_MARKED): Likewise. (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise. (BINFO_SUBVTT_INDEX): Remove parenthesis. (BINFO_VPTR_INDEX): Likewise. (BINFO_PRIMARY_BASE_OF): Likewise, (CLASSTYPE_VFIELDS): Whitespace. (VF_DERIVED_VALUE): Wrap long line. (NAMESPACE_LEVEL): Whitespace. (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis. (DEFARG_POINTER): Whitespace. (DECL_NEEDED_P): Remove parenthesis. (DECL_LANGUAGE): Whitespace. (SET_DECL_LANGUAGE): Add parenthesis. (DECL_CONSTRUCTOR_P): Whitespace and wrap. (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis. (DECL_IN_AGGR_P): Whitespace. (DECL_FRIEND_P): Likewise. (DECL_BEFRIENDING_CLASSES): Likewise. (DECL_STATIC_FUNCTION_P): Whitespace and wrap. (DECL_NONCONVERTING_P): Whitespace. (DECL_PURE_VIRTUAL_P): Likewise. (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise. (DECL_PENDING_INLINE_INFO): Whitespace. (DECL_SORTED_FIELDS): Likewise. (DECL_DEFERRED_FN): Likewise. (DECL_TEMPLATE_INFO): Likewise. (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise. (SET_TYPE_TEMPLATE_INFO): Add parenthesis. (TMPL_ARGS_LEVEL): Likewise. (SET_TMPL_ARGS_LEVEL): Likewise. (INNERMOST_TEMPLATE_PARMS): Whitespace. (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter. (INTEGRAL_CODE_P(CODE): Add parenthesis. (CP_INTEGRAL_TYPE_P): Remove parenthesis. (TYPE_HAS_CONSTRUCTOR): Whitespace. (TREE_HAS_CONSTRUCTOR): Likewise. (TYPE_HAS_DESTRUCTOR): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (TYPE_HAS_COMPLEX_INIT_REF): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_PTRMEMFUNC_P): Likewise. (TYPE_PTRMEMFUNC_FLAG): Likewise. (TYPE_GET_PTRMEMFUNC_TYPE): Likewise. (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. (TYPE_PTRMEM_CLASS_TYPE): Remove paranthesis. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (DECL_ACCESS): Whitespace. (DECL_GLOBAL_CTOR_P): Remove paranthesis. (DECL_GLOBAL_DTOR_P): Likewise. (GLOBAL_INIT_PRIORITY): Likewise. (DECL_TEMPLATE_PARMS): Likewise. (DECL_TEMPLATE_RESULT): Likewise. (DECL_TEMPLATE_INSTANTIATIONS): Likewise. (DECL_TEMPLATE_SPECIALIZATIONS): Likewise. (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (PRIMARY_TEMPLATE_P): Add parenthesis. (DECL_USE_TEMPLATE): Whitespace. (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise. (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise. (CALL_DECLARATOR_PARMS): Remove parenthesis. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (TEMP_NAME_P): Wrap. (VFIELD_NAME_P): Likewise. (B_SET): Uppercase macro parameters and add parenthesis. (B_CLR): Likewise. (B_TST): Likewise. (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters. (LOOKUP_TYPES_ONLY): Uppercase macro parameters. (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters. (same_or_base_type_p): Likewise. (cp_deprecated): Likewise. From-SVN: r48573
2002-01-06 06:24:03 +01:00
#define same_or_base_type_p(TYPE1, TYPE2) \
comptypes ((TYPE1), (TYPE2), COMPARE_BASE)
cp-tree.h (COMPARE_STRICT): New macro. * cp-tree.h (COMPARE_STRICT): New macro. (COMPARE_BASE): Likewise. (COMPARE_RELAXED): Likewise. (COMPARE_REDECLARATION): Likewise. (same_type_p): Likewise. (same_or_base_type_p): Likewise. * call.c (standard_conversion): Use them, in place of comptypes with numeric arguments. (reference_binding): Likewise. (convert_like): Likewise. (build_over_call): Likewise. (is_subseq): Likewise. (is_properly_derived_from): Likewise. (compare_ics): Likewise. (joust): Likewise. * class.c (delete_duplicate_fields_1): Likewise. (resolves_to_fixed_type_p): Likewise. (instantiate_type): Likewise. Remove #if 0'd code. * decl.c (decls_match): Likewise. Use COMPARE_REDECLARATION here. (pushdecl): Likewise. (lookup_name_real): Likewise. (grokdeclarator): Likewise. Check for illegal array declarations. (grokparms): Likewise. (grok_op_properties): Likewise. * decl2.c (check_classfn): Likewise. * friend.c (is_friend): Likewise. (make_friend_class): Likewise. * init.c (expand_aggr_init): Likewise. (expand_vec_init): Likewise. * pt.c (is_member_template_class): Remove declaration. (is_specialization_of): Use COMPARE_* and new macros. (comp_template_parms): Likewise. (convert_nontype_argument): Likewise. (coerce_template_template_parms): Likewise. (template_args_equal): Likewise. (lookup_template_class): Likewise. (type_unification_real): Likewise. (unify): Likewise. (get_bindings_real): Likewise. * search.c (covariant_return_p): Likewise. (get_matching_virtual): Likewise. * sig.c (match_method_types): Likewise. * tree.c (vec_binfo_member): Likewise. (cp_tree_equal): Likewise. * typeck.c (common_type): Likewise. (comp_array_types): Likewise. Get issues involving unknown array bounds right. (comptypes): Update comments. Use new flags. (comp_target_types): Use new macros. (compparms): Likewise. (comp_target_parms): Likewise. (string_conv_p): Likewise. (build_component_ref): Likewise. (build_indirect_ref): Likewise. (build_conditional_expr): Likewise. (build_static_cast): Likewise. (build_reinterpret_cast): Likewise. (build_const_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (comp_ptr_ttypes_real): Likewise. (ptr_reasonably_similar): Likewise. (comp_ptr_ttypes_const): Likewise. From-SVN: r23490
1998-11-01 16:45:11 +01:00
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
/* These macros are used to access a TEMPLATE_PARM_INDEX. */
#define TEMPLATE_PARM_INDEX_CAST(NODE) \
((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE))
#define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index)
#define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level)
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
#define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
#define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
#define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
#define TEMPLATE_PARM_PARAMETER_PACK(NODE) \
(TREE_LANG_FLAG_0 (TEMPLATE_PARM_INDEX_CHECK (NODE)))
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
/* These macros are for accessing the fields of TEMPLATE_TYPE_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
TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes. */
split tree_type split tree_type gcc/ada/ * gcc-interface/ada-tree.h (TYPE_OBJECT_RECORD_TYPE): Use TYPE_MINVAL. (TYPE_GCC_MIN_VALUE): Use TYPE_MINVAL. (TYPE_GCC_MAX_VALUE): Use TYPE_MAXVAL. gcc/cp/ * cp-tree.h (TYPENAME_TYPE_FULLNAME, TYPEOF_TYPE_EXPR): Use TYPE_VALUES_RAW. (UNDERLYING_TYPE_TYPE, DECLTYPE_TYPE_EXPR): Likewise. (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. gcc/ * ggc-page.c (extra_order_size_table): Use struct tree_type_non_common. * lto-streamer-in.c (unpack_ts_type_value_fields): Rename to... (unpack_ts_type_common_value_fields): ...this. Update comment. (unpack_value_fields): Adjust for renaming. (lto_input_ts_type_tree_pointers): Split into... (lto_input_ts_type_common_tree_pointer): ...this and... (lto_input_ts_type_non_common_tree_pointers): ...this. (lto_input_tree_pointers): Adjust for above split. * lto-streamer-out.c (pack_ts_type_value_fields): Rename to... (pack_ts_type_common_value_fields): ...this. Update comment. (lto_output_ts_type_tree_pointers): Split into... (lto_output_ts_type_common_tree_pointers): ...this and... (lto_output_ts_type_non_common_tree_pointers): ...this. (lto_output_tree_pointers): Adjust for above split. * lto-streamer.c (check_handled_ts_structures): Mark TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, and TS_TYPE_NON_COMMON as handled. * stor-layout.c (vector_type_mode): Adjust location of mode field. * tree.h (MARK_TS_TYPE_COMMON, MARK_TS_TYPE_WITH_LANG_SPECIFIC): Define. (struct tree_type): Split into... (struct tree_type_common: ...this and... (struct tree_type_with_lang_specific): ...this and... (struct tree_type_non_common): ...this. Adjust accessor macros accordingly. (TYPE_VALUES_RAW): Define. (union tree_node): Update for above changes. * tree.c (tree_node_structure_for_code) [tcc_type]: Return TS_TYPE_NON_COMMON. (initialize_tree_contains_struct) [TS_TYPE]: Use TS_TYPE_COMMON. Add TS_TYPE_WITH_LANG_SPECIFIC and TS_TYPE_NON_COMMON. (tree_code_size) [tcc_type]: Use struct tree_type_non_common. * treestructu.def (TS_TYPE): Remove. (TS_TYPE_COMMON, TS_TYPE_WITH_LANG_SPECIFIC, TS_TYPE_NON_COMMON): Define. gcc/java/ * java-tree.h (TYPE_ARGUMENT_SIGNATURE): Use TYPE_MINVAL. gcc/lto/ * lto.c (lto_ft_type): Use TYPE_MINVAL and TYPE_MAXVAL. Adjust location of binfo field. (lto_fixup_prevailing_decls): Likewise. gcc/objc/ * objc-act.h (CLASS_NAME, CLASS_SUPER_NAME): Use proper accessors. (CLASS_NST_METHODS, CLASS_CLS_METHODS): Likewise. (PROTOCOL_NAME, PROTOCOL_NST_METHODS, PROTOCOL_CLS_METHODS): Likewise. From-SVN: r173658
2011-05-11 15:48:55 +02:00
#define TEMPLATE_TYPE_PARM_INDEX(NODE) \
(TYPE_VALUES_RAW (TREE_CHECK3 ((NODE), TEMPLATE_TYPE_PARM, \
TEMPLATE_TEMPLATE_PARM, \
BOUND_TEMPLATE_TEMPLATE_PARM)))
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
#define TEMPLATE_TYPE_IDX(NODE) \
(TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
#define TEMPLATE_TYPE_LEVEL(NODE) \
(TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
#define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
(TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
#define TEMPLATE_TYPE_DECL(NODE) \
(TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
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
#define TEMPLATE_TYPE_PARAMETER_PACK(NODE) \
(TEMPLATE_PARM_PARAMETER_PACK (TEMPLATE_TYPE_PARM_INDEX (NODE)))
1994-02-24 02:02:37 +01:00
/* For a C++17 class deduction placeholder, the template it represents. */
#define CLASS_PLACEHOLDER_TEMPLATE(NODE) \
(DECL_INITIAL (TYPE_NAME (TEMPLATE_TYPE_PARM_CHECK (NODE))))
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
/* Contexts in which auto deduction occurs. These flags are
used to control diagnostics in do_auto_deduction. */
enum auto_deduction_context
{
adc_unspecified, /* Not given */
adc_variable_type, /* Variable initializer deduction */
adc_return_type, /* Return type deduction */
adc_unify, /* Template argument deduction */
Implement P0217R3 - C++17 structured bindings gcc/ * match.pd: Don't try to compare addresses of variables with DECL_VALUE_EXPR. gcc/cp/ * cp-tree.h (struct lang_decl_base): Add decomposition_p. (DECL_DECOMPOSITION_P): New (enum auto_deduction_context): Add adc_decomp_type. (enum cp_declarator_kind): Add cdk_decomp. * constexpr.c (cxx_eval_constant_expression): Look through DECL_VALUE_EXPR. (potential_constant_expression_1): Likewise. * decl.c (reshape_init): Preserve CONSTRUCTOR_IS_DIRECT_INIT. (check_initializer): Use build_aggr_init for DECL_DECOMPOSITION_P. (cp_finish_decl): Pass adc_decomp_type for decomposition. (find_decomp_class_base, get_tuple_size, get_tuple_element_type) (get_tuple_decomp_init, cp_finish_decomp): New. (grokdeclarator): Handle decomposition. * init.c (build_aggr_init): Handle decomposition array. (build_vec_init): Handle initialization from { array }. * name-lookup.c (add_function): Always wrap TEMPLATE_DECL in OVERLOAD. * parser.c (declarator_can_be_parameter_pack): Handle cdk_decomp. (function_declarator_p, strip_declarator_types) (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_range_for, cp_convert_range_for): Handle decomposition. (cp_parser_simple_declaration): Parse decomposition. (cp_parser_decomposition_declaration): New. * pt.c (tsubst_decomp_names): New. (subst_expr) [DECL_EXPR, RANGE_FOR_STMT]: Handle decomposition. (do_auto_deduction): Handle adc_decomp_type. * semantics.c (finish_decltype_type): Look through DECL_VALUE_EXPR. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. * tree.c (lvalue_kind): Likewise. (cp_build_reference_type): Handle reference collapsing. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r242377
2016-11-14 06:02:58 +01:00
adc_requirement, /* Argument deduction constraint */
adc_decomp_type /* Decomposition declaration initializer deduction */
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
};
/* True if this type-parameter belongs to a class template, used by C++17
class template argument deduction. */
#define TEMPLATE_TYPE_PARM_FOR_CLASS(NODE) \
(TREE_LANG_FLAG_0 (TEMPLATE_TYPE_PARM_CHECK (NODE)))
/* True iff this TEMPLATE_TYPE_PARM represents decltype(auto). */
#define AUTO_IS_DECLTYPE(NODE) \
(TYPE_LANG_FLAG_5 (TEMPLATE_TYPE_PARM_CHECK (NODE)))
/* These constants can used as bit flags in the process of tree formatting.
TFF_PLAIN_IDENTIFIER: unqualified part of a name.
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
TFF_SCOPE: include the class and namespace scope of the name.
TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name.
TFF_DECL_SPECIFIERS: print decl-specifiers.
TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with
a class-key (resp. `enum').
TFF_RETURN_TYPE: include function return type.
TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values.
TFF_EXCEPTION_SPECIFICATION: show function exception specification.
TFF_TEMPLATE_HEADER: show the template<...> header in a
template-declaration.
TFF_TEMPLATE_NAME: show only template-name.
TFF_EXPR_IN_PARENS: parenthesize expressions.
TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments.
TFF_UNQUALIFIED_NAME: do not print the qualifying scope of the
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
top-level entity.
TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS: do not omit template arguments
identical to their defaults.
TFF_NO_TEMPLATE_BINDINGS: do not print information about the template
arguments for a function template specialization.
TFF_POINTER: we are printing a pointer type. */
#define TFF_PLAIN_IDENTIFIER (0)
#define TFF_SCOPE (1)
#define TFF_CHASE_TYPEDEF (1 << 1)
#define TFF_DECL_SPECIFIERS (1 << 2)
#define TFF_CLASS_KEY_OR_ENUM (1 << 3)
#define TFF_RETURN_TYPE (1 << 4)
#define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5)
#define TFF_EXCEPTION_SPECIFICATION (1 << 6)
#define TFF_TEMPLATE_HEADER (1 << 7)
#define TFF_TEMPLATE_NAME (1 << 8)
#define TFF_EXPR_IN_PARENS (1 << 9)
#define TFF_NO_FUNCTION_ARGUMENTS (1 << 10)
#define TFF_UNQUALIFIED_NAME (1 << 11)
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
#define TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS (1 << 12)
#define TFF_NO_TEMPLATE_BINDINGS (1 << 13)
#define TFF_POINTER (1 << 14)
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
/* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
node. */
#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \
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
((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \
? TYPE_TI_TEMPLATE (NODE) \
: TYPE_NAME (NODE))
/* in lex.c */
c-common.c: Include c-lex.h. * c-common.c: Include c-lex.h. (c_common_lang_init): Change prototype. Call init_c_lex and init_pragma from here. * c-common.h (c_common_lang_init): Change prototype. * c-decl.c (init_decl_processing): Rename. Call c_parse_init. * c-lang.c (c_init): Change prototype. Update. (c_init_options): Update. * c-lex.c (cpp_filename): Remove. (init_c_lex): Update. Read the main file, and get the original file name. (yyparse): Finish the command line options. * c-parse.in (c_parse_init): Call init_reswords here. (init_parse): Remove. * c-tree.h (c_init_decl_processing): New. * cpphash.c (_cpp_init_hashtable): After initializing the hash table, populate it. * cppinit.c (read_original_filename, cpp_finish_options): New. (cpp_create_reader): New prototype. Defer hash table initialization. (cpp_start_read): Rename cpp_read_main_file. Initialize the hash table. Get the original filename. * cpplib.h (cpp_create_reader): Update. (cpp_start_read): Remove. (cpp_read_main_file, cpp_finish_options): New. * cppmain.c (main, do_preprocessing): Update. * langhooks.h (struct langhooks): Update init prototype. * toplev.c (general_init, parse_options_and_default_flags, process_options, lang_indpendent_init, lang_dependent_init, init_asm_output): New; perform the bulk of initialization. (compile_file): Move most of initialization to above functions. (debug_hooks): Initialize statically. (set_Wunused): Relocate. (toplev_main): Move most of initialization to other init functions. Have a clear logic flow. * tree.h (init_parse, init_decl_processing): Remove. ada: * misc.c (gnat_init): Change prototype. Include the functionality of the old init_parse and init_decl_processing. (gnat_init_decl_processing): New prototype. (init_parse): Remove. * utils.c (init_decl_processing): Rename gnat_init_decl_processing. cp: * cp-tree.h (init_reswords, cxx_init_decl_processing): New. (cxx_init): Update prototype. * decl.c (init_decl_processing): Rename. Move null node init to its creation time. * lex.c (cxx_init_options): Update. (cxx_init): Combine with old init_parse; also call cxx_init_decl_processing. f: * com.c (ffecom_init_decl_processing): Renamed from init_decl_processing. (init_parse): Move contents to ffe_init. (ffe_init): Update prototype. java: * decl.c (init_decl_processing): Rename java_init_decl_processing. * java-tree.h: New prototype. * lang.c (java_init): Update prototype. Combine with old init_parse. objc: * objc-act.c (objc_init): Update prototype, combine with old init_parse. (objc_init_options): Update. From-SVN: r47046
2001-11-15 11:01:10 +01:00
extern void init_reswords (void);
c-common.c: Include c-lex.h. * c-common.c: Include c-lex.h. (c_common_lang_init): Change prototype. Call init_c_lex and init_pragma from here. * c-common.h (c_common_lang_init): Change prototype. * c-decl.c (init_decl_processing): Rename. Call c_parse_init. * c-lang.c (c_init): Change prototype. Update. (c_init_options): Update. * c-lex.c (cpp_filename): Remove. (init_c_lex): Update. Read the main file, and get the original file name. (yyparse): Finish the command line options. * c-parse.in (c_parse_init): Call init_reswords here. (init_parse): Remove. * c-tree.h (c_init_decl_processing): New. * cpphash.c (_cpp_init_hashtable): After initializing the hash table, populate it. * cppinit.c (read_original_filename, cpp_finish_options): New. (cpp_create_reader): New prototype. Defer hash table initialization. (cpp_start_read): Rename cpp_read_main_file. Initialize the hash table. Get the original filename. * cpplib.h (cpp_create_reader): Update. (cpp_start_read): Remove. (cpp_read_main_file, cpp_finish_options): New. * cppmain.c (main, do_preprocessing): Update. * langhooks.h (struct langhooks): Update init prototype. * toplev.c (general_init, parse_options_and_default_flags, process_options, lang_indpendent_init, lang_dependent_init, init_asm_output): New; perform the bulk of initialization. (compile_file): Move most of initialization to above functions. (debug_hooks): Initialize statically. (set_Wunused): Relocate. (toplev_main): Move most of initialization to other init functions. Have a clear logic flow. * tree.h (init_parse, init_decl_processing): Remove. ada: * misc.c (gnat_init): Change prototype. Include the functionality of the old init_parse and init_decl_processing. (gnat_init_decl_processing): New prototype. (init_parse): Remove. * utils.c (init_decl_processing): Rename gnat_init_decl_processing. cp: * cp-tree.h (init_reswords, cxx_init_decl_processing): New. (cxx_init): Update prototype. * decl.c (init_decl_processing): Rename. Move null node init to its creation time. * lex.c (cxx_init_options): Update. (cxx_init): Combine with old init_parse; also call cxx_init_decl_processing. f: * com.c (ffecom_init_decl_processing): Renamed from init_decl_processing. (init_parse): Move contents to ffe_init. (ffe_init): Update prototype. java: * decl.c (init_decl_processing): Rename java_init_decl_processing. * java-tree.h: New prototype. * lang.c (java_init): Update prototype. Combine with old init_parse. objc: * objc-act.c (objc_init): Update prototype, combine with old init_parse. (objc_init_options): Update. From-SVN: r47046
2001-11-15 11:01:10 +01:00
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
typedef struct GTY(()) operator_name_info_t {
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
/* The IDENTIFIER_NODE for the operator. */
tree identifier;
/* The name of the operator. */
const char *name;
/* The mangled name of the operator. */
const char *mangled_name;
/* The arity of the operator. */
int arity;
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
} operator_name_info_t;
/* A mapping from tree codes to operator name information. */
extern GTY(()) operator_name_info_t operator_name_info
tree.h (enum tree_code): Include all-tree.def, not tree.def. * tree.h (enum tree_code): Include all-tree.def, not tree.def. Define END_OF_BASE_TREE_CODES around inclusion. * tree.c (tree_code_type): New global array. (tree_code_length, tree_code_name): Likewise. * Makefile.in (TREE_H): Add all-tree.def, c-common.def, and $(lang_tree_files). (all-tree.def, s-alltree): New targets. (gencheck.h, s-gencheck): Remove. (tree.o): Depend upon all-tree.def. (build/gencheck.o): Remove gencheck.h dependency. (mostlyclean): Don't remove gencheck.h. * c-common.h (enum c_tree_code): Remove. * c-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * gencheck.c (tree_codes): Include all-tree.def, rather than tree.def, c-common.def, and gencheck.h. Undefined DEFTREECODE after it is used. * tree-browser.c (tb_tree_codes): Include all-tree.def, rather than tree.def. * cp/cp-tree.h (enum cplus_tree_code): Remove. (operator_name_info): Size to MAX_TREE_CODES. (assignment_operator_name_info): Likewise. * cp/cp-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * cp/lex.c (operator_name_info): Size to MAX_TREE_CODES. (assignment_operator_name_info): Likewise. * cp/decl.c (grok_op_properties): Change LAST_CPLUS_TREE_CODE to MAX_TREE_CODES. * cp/mangle.c (write_expression): Likewise. * cp/Make-lang.in (CXX_TREE_H): Remove cp/cp-tree.def. * fortran/f95-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * java/java-tree.h (enum java_tree_code): Remove. * java/lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * java/Make-lang.in (JAVA_TREE_H): Remove java/java-tree.def. * objc/objc-act.h (enum objc_tree_code): Remove. * objc/objc-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * objcp/objcp-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * ada/ada-tree.h (enum gnat_tree_code): Remove. * ada/Make-lang.in (ADA_TREE_H): Remove ada/ada-tre.def. * ada/misc.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. From-SVN: r137006
2008-06-21 23:17:40 +02:00
[(int) MAX_TREE_CODES];
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
/* Similar, but for assignment operators. */
extern GTY(()) operator_name_info_t assignment_operator_name_info
tree.h (enum tree_code): Include all-tree.def, not tree.def. * tree.h (enum tree_code): Include all-tree.def, not tree.def. Define END_OF_BASE_TREE_CODES around inclusion. * tree.c (tree_code_type): New global array. (tree_code_length, tree_code_name): Likewise. * Makefile.in (TREE_H): Add all-tree.def, c-common.def, and $(lang_tree_files). (all-tree.def, s-alltree): New targets. (gencheck.h, s-gencheck): Remove. (tree.o): Depend upon all-tree.def. (build/gencheck.o): Remove gencheck.h dependency. (mostlyclean): Don't remove gencheck.h. * c-common.h (enum c_tree_code): Remove. * c-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * gencheck.c (tree_codes): Include all-tree.def, rather than tree.def, c-common.def, and gencheck.h. Undefined DEFTREECODE after it is used. * tree-browser.c (tb_tree_codes): Include all-tree.def, rather than tree.def. * cp/cp-tree.h (enum cplus_tree_code): Remove. (operator_name_info): Size to MAX_TREE_CODES. (assignment_operator_name_info): Likewise. * cp/cp-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * cp/lex.c (operator_name_info): Size to MAX_TREE_CODES. (assignment_operator_name_info): Likewise. * cp/decl.c (grok_op_properties): Change LAST_CPLUS_TREE_CODE to MAX_TREE_CODES. * cp/mangle.c (write_expression): Likewise. * cp/Make-lang.in (CXX_TREE_H): Remove cp/cp-tree.def. * fortran/f95-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * java/java-tree.h (enum java_tree_code): Remove. * java/lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * java/Make-lang.in (JAVA_TREE_H): Remove java/java-tree.def. * objc/objc-act.h (enum objc_tree_code): Remove. * objc/objc-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * objcp/objcp-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * ada/ada-tree.h (enum gnat_tree_code): Remove. * ada/Make-lang.in (ADA_TREE_H): Remove ada/ada-tre.def. * ada/misc.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. From-SVN: r137006
2008-06-21 23:17:40 +02:00
[(int) MAX_TREE_CODES];
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
/* A type-qualifier, or bitmask therefore, using the TYPE_QUAL
constants. */
typedef int cp_cv_quals;
/* Non-static member functions have an optional virt-specifier-seq.
There is a VIRT_SPEC value for each virt-specifier.
They can be combined by bitwise-or to form the complete set of
virt-specifiers for a member function. */
enum virt_specifier
{
VIRT_SPEC_UNSPECIFIED = 0x0,
VIRT_SPEC_FINAL = 0x1,
VIRT_SPEC_OVERRIDE = 0x2
};
/* A type-qualifier, or bitmask therefore, using the VIRT_SPEC
constants. */
typedef int cp_virt_specifiers;
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
/* Wherever there is a function-cv-qual, there could also be a ref-qualifier:
[dcl.fct]
The return type, the parameter-type-list, the ref-qualifier, and
the cv-qualifier-seq, but not the default arguments or the exception
specification, are part of the function type.
REF_QUAL_NONE Ordinary member function with no ref-qualifier
REF_QUAL_LVALUE Member function with the &-ref-qualifier
REF_QUAL_RVALUE Member function with the &&-ref-qualifier */
enum cp_ref_qualifier {
REF_QUAL_NONE = 0,
REF_QUAL_LVALUE = 1,
REF_QUAL_RVALUE = 2
};
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
/* A storage class. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum cp_storage_class {
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
/* sc_none must be zero so that zeroing a cp_decl_specifier_seq
sets the storage_class field to sc_none. */
sc_none = 0,
sc_auto,
sc_register,
sc_static,
sc_extern,
sc_mutable
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokens Now that we track token locations accross macro expansions, it would be cool to be able to fix PR preprocessor/7263 for real. That is, consider this example where we have a system header named header.h like this: #define _Complex __complex__ #define _Complex_I 1.0iF and then a normal C file like this: #include "header.h" static _Complex float c = _Complex_I; If we compile the file with -pedantic, the usages of _Complex or _Complex_I should not trigger any warning, even though __complex__ and the complex literal are extensions to the standard C. They shouldn't trigger any warning because _Complex and _Complex_I are defined in a system header (and expanded in normal user code). To be able to handle this, we must address two separate concerns. First, warnings about non-standard usage of numerical literals are emitted directly from within libcpp. So we must teach libcpp's parser for numerical literals to use virtual locations, instead of the spelling location it uses today. Once we have that, as the diagnostics machinery already knows how to avoid emitting errors happening on tokens that come from system headers, we win. Second, there is the issue of tracking locations for declaration specifiers, like the "_Complex" in the declaration: static _Complex float c; For that, we need to arrange for each possible declaration specifier to have its own location, because otherwise, we'd warn on e.g, on: _Complex float c; but not on: static _Complex float c; So this patch addresses the two concerns above. It's actually a follow-up on an earlier patch[1] I wrote as part of my initial work on virtual locations. We then agreed[2] that the second concern was important to address before the patch could get a chance to go in. [1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html [2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. libcpp/ PR preprocessor/7263 * include/cpplib.h (cpp_classify_number): Take a location parameter. * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic macros that take a location parameter. (cpp_classify_number): Take a (virtual) location parameter. Use it for diagnostics. Adjust comments. (eval_token): Take a location parameter. Pass it to cpp_classify_number and to diagnostic routines. (_cpp_parse_expr): Use virtual locations of tokens when parsing expressions. Pass a virtual location to eval_token and to diagnostic routines. gcc/c-family/ PR preprocessor/7263 * c-lex.c (c_lex_with_flags): Pass a virtual location to the call to cpp_classify_number. For diagnostics, use the precise location instead of the global input_location. gcc/ PR preprocessor/7263 * c-tree.h (enum c_declspec_word): Declare new enum. (struct c_declspecs::locations): New member. (declspecs_add_qual, declspecs_add_scspec) (declspecs_add_addrspace, declspecs_add_alignas): Take a new location parameter. * c-decl.c (build_null_declspecs): Initialize the new struct c_declspecs::locations member. (declspecs_add_addrspace): Take a location parameter for the address space. Store it onto declaration specifiers. (declspecs_add_qual): Likewise, take a location parameter for the qualifier. (declspecs_add_type): Likewise, take a location parameter for the type specifier. (declspecs_add_scspec): Likewise, take a location parameter for the storage class specifier. (declspecs_add_attrs): Likewise, take a location parameter for the first attribute. (declspecs_add_alignas): Likewise, take a location parameter for the alignas token. (finish_declspecs): For diagnostics, use the location of the relevant declspec, instead of the global input_location. * c-parser.c (c_parser_parameter_declaration): Pass the precise virtual location of the declspec to the declspecs-setters. (c_parser_declspecs): Likewise. Avoid calling c_parser_peek_token repeatedly. gcc/cp/ PR preprocessor/7263 * cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all the possible declarator specifiers so far. (struct cp_decl_specifier_seq::locations): Declare new member. (cp_decl_specifier_seq::{specs, type_location}): Remove. (decl_spec_seq_has_spec_p): Declare new function. * parser.c (cp_parser_check_decl_spec): Remove. (set_and_check_decl_spec_loc): Define new static function. (decl_spec_seq_has_spec_p): Define new public function. (cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt) (cp_parser_type_specifier, cp_parser_simple_type_specifier) (cp_parser_set_storage_class, cp_parser_set_decl_spec_type) (cp_parser_alias_declaration): Set the locations for each declspec, using set_and_check_decl_spec_loc. (cp_parser_explicit_instantiation, cp_parser_init_declarator) (cp_parser_member_declaration, cp_parser_init_declarator): Use the new declspec location for specifiers. Use the new decl_spec_seq_has_spec_p. (cp_parser_type_specifier_seq): Use the new set_and_check_decl_spec_loc. Stop using cp_parser_check_decl_spec. Use the new decl_spec_seq_has_spec_p. (, cp_parser_init_declarator): Use the new set_and_check_decl_spec_loc. (cp_parser_single_declaration, cp_parser_friend_p) (cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration): Use the new decl_spec_seq_has_spec_p. * decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p. Use the more precise ds_redefined_builtin_type_spec location for diagnostics about re-declaring C++ built-in types. (start_decl, grokvardecl, grokdeclarator): Use the new decl_spec_seq_has_spec_p. gcc/testsuite/ PR preprocessor/7263 * gcc.dg/binary-constants-2.c: Run without tracking locations accross macro expansion. * gcc.dg/binary-constants-3.c: Likewise. * gcc.dg/cpp/sysmac2.c: Likewise. * testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise location. * gcc.dg/cpp/syshdr3.c: New test. * gcc.dg/cpp/syshdr3.h: New header for the new test above. * gcc.dg/system-binary-constants-1.c: New test. * gcc.dg/system-binary-constants-1.h: New header for the new test above. * g++.dg/cpp/syshdr3.C: New test. * g++.dg/cpp/syshdr3.h: New header the new test above. * g++.dg/system-binary-constants-1.C: New test. * g++.dg/system-binary-constants-1.h: New header the new test above. From-SVN: r187587
2012-05-16 12:51:15 +02:00
/* An individual decl-specifier. This is used to index the array of
locations for the declspecs in struct cp_decl_specifier_seq
below. */
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum cp_decl_spec {
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
ds_first,
ds_signed = ds_first,
ds_unsigned,
ds_short,
ds_long,
ds_const,
ds_volatile,
ds_restrict,
ds_inline,
ds_virtual,
ds_explicit,
ds_friend,
ds_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
ds_alias,
ds_constexpr,
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
ds_complex,
ds_thread,
PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokens Now that we track token locations accross macro expansions, it would be cool to be able to fix PR preprocessor/7263 for real. That is, consider this example where we have a system header named header.h like this: #define _Complex __complex__ #define _Complex_I 1.0iF and then a normal C file like this: #include "header.h" static _Complex float c = _Complex_I; If we compile the file with -pedantic, the usages of _Complex or _Complex_I should not trigger any warning, even though __complex__ and the complex literal are extensions to the standard C. They shouldn't trigger any warning because _Complex and _Complex_I are defined in a system header (and expanded in normal user code). To be able to handle this, we must address two separate concerns. First, warnings about non-standard usage of numerical literals are emitted directly from within libcpp. So we must teach libcpp's parser for numerical literals to use virtual locations, instead of the spelling location it uses today. Once we have that, as the diagnostics machinery already knows how to avoid emitting errors happening on tokens that come from system headers, we win. Second, there is the issue of tracking locations for declaration specifiers, like the "_Complex" in the declaration: static _Complex float c; For that, we need to arrange for each possible declaration specifier to have its own location, because otherwise, we'd warn on e.g, on: _Complex float c; but not on: static _Complex float c; So this patch addresses the two concerns above. It's actually a follow-up on an earlier patch[1] I wrote as part of my initial work on virtual locations. We then agreed[2] that the second concern was important to address before the patch could get a chance to go in. [1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html [2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. libcpp/ PR preprocessor/7263 * include/cpplib.h (cpp_classify_number): Take a location parameter. * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic macros that take a location parameter. (cpp_classify_number): Take a (virtual) location parameter. Use it for diagnostics. Adjust comments. (eval_token): Take a location parameter. Pass it to cpp_classify_number and to diagnostic routines. (_cpp_parse_expr): Use virtual locations of tokens when parsing expressions. Pass a virtual location to eval_token and to diagnostic routines. gcc/c-family/ PR preprocessor/7263 * c-lex.c (c_lex_with_flags): Pass a virtual location to the call to cpp_classify_number. For diagnostics, use the precise location instead of the global input_location. gcc/ PR preprocessor/7263 * c-tree.h (enum c_declspec_word): Declare new enum. (struct c_declspecs::locations): New member. (declspecs_add_qual, declspecs_add_scspec) (declspecs_add_addrspace, declspecs_add_alignas): Take a new location parameter. * c-decl.c (build_null_declspecs): Initialize the new struct c_declspecs::locations member. (declspecs_add_addrspace): Take a location parameter for the address space. Store it onto declaration specifiers. (declspecs_add_qual): Likewise, take a location parameter for the qualifier. (declspecs_add_type): Likewise, take a location parameter for the type specifier. (declspecs_add_scspec): Likewise, take a location parameter for the storage class specifier. (declspecs_add_attrs): Likewise, take a location parameter for the first attribute. (declspecs_add_alignas): Likewise, take a location parameter for the alignas token. (finish_declspecs): For diagnostics, use the location of the relevant declspec, instead of the global input_location. * c-parser.c (c_parser_parameter_declaration): Pass the precise virtual location of the declspec to the declspecs-setters. (c_parser_declspecs): Likewise. Avoid calling c_parser_peek_token repeatedly. gcc/cp/ PR preprocessor/7263 * cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all the possible declarator specifiers so far. (struct cp_decl_specifier_seq::locations): Declare new member. (cp_decl_specifier_seq::{specs, type_location}): Remove. (decl_spec_seq_has_spec_p): Declare new function. * parser.c (cp_parser_check_decl_spec): Remove. (set_and_check_decl_spec_loc): Define new static function. (decl_spec_seq_has_spec_p): Define new public function. (cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt) (cp_parser_type_specifier, cp_parser_simple_type_specifier) (cp_parser_set_storage_class, cp_parser_set_decl_spec_type) (cp_parser_alias_declaration): Set the locations for each declspec, using set_and_check_decl_spec_loc. (cp_parser_explicit_instantiation, cp_parser_init_declarator) (cp_parser_member_declaration, cp_parser_init_declarator): Use the new declspec location for specifiers. Use the new decl_spec_seq_has_spec_p. (cp_parser_type_specifier_seq): Use the new set_and_check_decl_spec_loc. Stop using cp_parser_check_decl_spec. Use the new decl_spec_seq_has_spec_p. (, cp_parser_init_declarator): Use the new set_and_check_decl_spec_loc. (cp_parser_single_declaration, cp_parser_friend_p) (cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration): Use the new decl_spec_seq_has_spec_p. * decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p. Use the more precise ds_redefined_builtin_type_spec location for diagnostics about re-declaring C++ built-in types. (start_decl, grokvardecl, grokdeclarator): Use the new decl_spec_seq_has_spec_p. gcc/testsuite/ PR preprocessor/7263 * gcc.dg/binary-constants-2.c: Run without tracking locations accross macro expansion. * gcc.dg/binary-constants-3.c: Likewise. * gcc.dg/cpp/sysmac2.c: Likewise. * testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise location. * gcc.dg/cpp/syshdr3.c: New test. * gcc.dg/cpp/syshdr3.h: New header for the new test above. * gcc.dg/system-binary-constants-1.c: New test. * gcc.dg/system-binary-constants-1.h: New header for the new test above. * g++.dg/cpp/syshdr3.C: New test. * g++.dg/cpp/syshdr3.h: New header the new test above. * g++.dg/system-binary-constants-1.C: New test. * g++.dg/system-binary-constants-1.h: New header the new test above. From-SVN: r187587
2012-05-16 12:51:15 +02:00
ds_type_spec,
ds_redefined_builtin_type_spec,
ds_attribute,
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
ds_std_attribute,
PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokens Now that we track token locations accross macro expansions, it would be cool to be able to fix PR preprocessor/7263 for real. That is, consider this example where we have a system header named header.h like this: #define _Complex __complex__ #define _Complex_I 1.0iF and then a normal C file like this: #include "header.h" static _Complex float c = _Complex_I; If we compile the file with -pedantic, the usages of _Complex or _Complex_I should not trigger any warning, even though __complex__ and the complex literal are extensions to the standard C. They shouldn't trigger any warning because _Complex and _Complex_I are defined in a system header (and expanded in normal user code). To be able to handle this, we must address two separate concerns. First, warnings about non-standard usage of numerical literals are emitted directly from within libcpp. So we must teach libcpp's parser for numerical literals to use virtual locations, instead of the spelling location it uses today. Once we have that, as the diagnostics machinery already knows how to avoid emitting errors happening on tokens that come from system headers, we win. Second, there is the issue of tracking locations for declaration specifiers, like the "_Complex" in the declaration: static _Complex float c; For that, we need to arrange for each possible declaration specifier to have its own location, because otherwise, we'd warn on e.g, on: _Complex float c; but not on: static _Complex float c; So this patch addresses the two concerns above. It's actually a follow-up on an earlier patch[1] I wrote as part of my initial work on virtual locations. We then agreed[2] that the second concern was important to address before the patch could get a chance to go in. [1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html [2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. libcpp/ PR preprocessor/7263 * include/cpplib.h (cpp_classify_number): Take a location parameter. * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic macros that take a location parameter. (cpp_classify_number): Take a (virtual) location parameter. Use it for diagnostics. Adjust comments. (eval_token): Take a location parameter. Pass it to cpp_classify_number and to diagnostic routines. (_cpp_parse_expr): Use virtual locations of tokens when parsing expressions. Pass a virtual location to eval_token and to diagnostic routines. gcc/c-family/ PR preprocessor/7263 * c-lex.c (c_lex_with_flags): Pass a virtual location to the call to cpp_classify_number. For diagnostics, use the precise location instead of the global input_location. gcc/ PR preprocessor/7263 * c-tree.h (enum c_declspec_word): Declare new enum. (struct c_declspecs::locations): New member. (declspecs_add_qual, declspecs_add_scspec) (declspecs_add_addrspace, declspecs_add_alignas): Take a new location parameter. * c-decl.c (build_null_declspecs): Initialize the new struct c_declspecs::locations member. (declspecs_add_addrspace): Take a location parameter for the address space. Store it onto declaration specifiers. (declspecs_add_qual): Likewise, take a location parameter for the qualifier. (declspecs_add_type): Likewise, take a location parameter for the type specifier. (declspecs_add_scspec): Likewise, take a location parameter for the storage class specifier. (declspecs_add_attrs): Likewise, take a location parameter for the first attribute. (declspecs_add_alignas): Likewise, take a location parameter for the alignas token. (finish_declspecs): For diagnostics, use the location of the relevant declspec, instead of the global input_location. * c-parser.c (c_parser_parameter_declaration): Pass the precise virtual location of the declspec to the declspecs-setters. (c_parser_declspecs): Likewise. Avoid calling c_parser_peek_token repeatedly. gcc/cp/ PR preprocessor/7263 * cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all the possible declarator specifiers so far. (struct cp_decl_specifier_seq::locations): Declare new member. (cp_decl_specifier_seq::{specs, type_location}): Remove. (decl_spec_seq_has_spec_p): Declare new function. * parser.c (cp_parser_check_decl_spec): Remove. (set_and_check_decl_spec_loc): Define new static function. (decl_spec_seq_has_spec_p): Define new public function. (cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt) (cp_parser_type_specifier, cp_parser_simple_type_specifier) (cp_parser_set_storage_class, cp_parser_set_decl_spec_type) (cp_parser_alias_declaration): Set the locations for each declspec, using set_and_check_decl_spec_loc. (cp_parser_explicit_instantiation, cp_parser_init_declarator) (cp_parser_member_declaration, cp_parser_init_declarator): Use the new declspec location for specifiers. Use the new decl_spec_seq_has_spec_p. (cp_parser_type_specifier_seq): Use the new set_and_check_decl_spec_loc. Stop using cp_parser_check_decl_spec. Use the new decl_spec_seq_has_spec_p. (, cp_parser_init_declarator): Use the new set_and_check_decl_spec_loc. (cp_parser_single_declaration, cp_parser_friend_p) (cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration): Use the new decl_spec_seq_has_spec_p. * decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p. Use the more precise ds_redefined_builtin_type_spec location for diagnostics about re-declaring C++ built-in types. (start_decl, grokvardecl, grokdeclarator): Use the new decl_spec_seq_has_spec_p. gcc/testsuite/ PR preprocessor/7263 * gcc.dg/binary-constants-2.c: Run without tracking locations accross macro expansion. * gcc.dg/binary-constants-3.c: Likewise. * gcc.dg/cpp/sysmac2.c: Likewise. * testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise location. * gcc.dg/cpp/syshdr3.c: New test. * gcc.dg/cpp/syshdr3.h: New header for the new test above. * gcc.dg/system-binary-constants-1.c: New test. * gcc.dg/system-binary-constants-1.h: New header for the new test above. * g++.dg/cpp/syshdr3.C: New test. * g++.dg/cpp/syshdr3.h: New header the new test above. * g++.dg/system-binary-constants-1.C: New test. * g++.dg/system-binary-constants-1.h: New header the new test above. From-SVN: r187587
2012-05-16 12:51:15 +02:00
ds_storage_class,
ds_long_long,
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
ds_concept,
PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokens Now that we track token locations accross macro expansions, it would be cool to be able to fix PR preprocessor/7263 for real. That is, consider this example where we have a system header named header.h like this: #define _Complex __complex__ #define _Complex_I 1.0iF and then a normal C file like this: #include "header.h" static _Complex float c = _Complex_I; If we compile the file with -pedantic, the usages of _Complex or _Complex_I should not trigger any warning, even though __complex__ and the complex literal are extensions to the standard C. They shouldn't trigger any warning because _Complex and _Complex_I are defined in a system header (and expanded in normal user code). To be able to handle this, we must address two separate concerns. First, warnings about non-standard usage of numerical literals are emitted directly from within libcpp. So we must teach libcpp's parser for numerical literals to use virtual locations, instead of the spelling location it uses today. Once we have that, as the diagnostics machinery already knows how to avoid emitting errors happening on tokens that come from system headers, we win. Second, there is the issue of tracking locations for declaration specifiers, like the "_Complex" in the declaration: static _Complex float c; For that, we need to arrange for each possible declaration specifier to have its own location, because otherwise, we'd warn on e.g, on: _Complex float c; but not on: static _Complex float c; So this patch addresses the two concerns above. It's actually a follow-up on an earlier patch[1] I wrote as part of my initial work on virtual locations. We then agreed[2] that the second concern was important to address before the patch could get a chance to go in. [1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html [2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. libcpp/ PR preprocessor/7263 * include/cpplib.h (cpp_classify_number): Take a location parameter. * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic macros that take a location parameter. (cpp_classify_number): Take a (virtual) location parameter. Use it for diagnostics. Adjust comments. (eval_token): Take a location parameter. Pass it to cpp_classify_number and to diagnostic routines. (_cpp_parse_expr): Use virtual locations of tokens when parsing expressions. Pass a virtual location to eval_token and to diagnostic routines. gcc/c-family/ PR preprocessor/7263 * c-lex.c (c_lex_with_flags): Pass a virtual location to the call to cpp_classify_number. For diagnostics, use the precise location instead of the global input_location. gcc/ PR preprocessor/7263 * c-tree.h (enum c_declspec_word): Declare new enum. (struct c_declspecs::locations): New member. (declspecs_add_qual, declspecs_add_scspec) (declspecs_add_addrspace, declspecs_add_alignas): Take a new location parameter. * c-decl.c (build_null_declspecs): Initialize the new struct c_declspecs::locations member. (declspecs_add_addrspace): Take a location parameter for the address space. Store it onto declaration specifiers. (declspecs_add_qual): Likewise, take a location parameter for the qualifier. (declspecs_add_type): Likewise, take a location parameter for the type specifier. (declspecs_add_scspec): Likewise, take a location parameter for the storage class specifier. (declspecs_add_attrs): Likewise, take a location parameter for the first attribute. (declspecs_add_alignas): Likewise, take a location parameter for the alignas token. (finish_declspecs): For diagnostics, use the location of the relevant declspec, instead of the global input_location. * c-parser.c (c_parser_parameter_declaration): Pass the precise virtual location of the declspec to the declspecs-setters. (c_parser_declspecs): Likewise. Avoid calling c_parser_peek_token repeatedly. gcc/cp/ PR preprocessor/7263 * cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all the possible declarator specifiers so far. (struct cp_decl_specifier_seq::locations): Declare new member. (cp_decl_specifier_seq::{specs, type_location}): Remove. (decl_spec_seq_has_spec_p): Declare new function. * parser.c (cp_parser_check_decl_spec): Remove. (set_and_check_decl_spec_loc): Define new static function. (decl_spec_seq_has_spec_p): Define new public function. (cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt) (cp_parser_type_specifier, cp_parser_simple_type_specifier) (cp_parser_set_storage_class, cp_parser_set_decl_spec_type) (cp_parser_alias_declaration): Set the locations for each declspec, using set_and_check_decl_spec_loc. (cp_parser_explicit_instantiation, cp_parser_init_declarator) (cp_parser_member_declaration, cp_parser_init_declarator): Use the new declspec location for specifiers. Use the new decl_spec_seq_has_spec_p. (cp_parser_type_specifier_seq): Use the new set_and_check_decl_spec_loc. Stop using cp_parser_check_decl_spec. Use the new decl_spec_seq_has_spec_p. (, cp_parser_init_declarator): Use the new set_and_check_decl_spec_loc. (cp_parser_single_declaration, cp_parser_friend_p) (cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration): Use the new decl_spec_seq_has_spec_p. * decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p. Use the more precise ds_redefined_builtin_type_spec location for diagnostics about re-declaring C++ built-in types. (start_decl, grokvardecl, grokdeclarator): Use the new decl_spec_seq_has_spec_p. gcc/testsuite/ PR preprocessor/7263 * gcc.dg/binary-constants-2.c: Run without tracking locations accross macro expansion. * gcc.dg/binary-constants-3.c: Likewise. * gcc.dg/cpp/sysmac2.c: Likewise. * testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise location. * gcc.dg/cpp/syshdr3.c: New test. * gcc.dg/cpp/syshdr3.h: New header for the new test above. * gcc.dg/system-binary-constants-1.c: New test. * gcc.dg/system-binary-constants-1.h: New header for the new test above. * g++.dg/cpp/syshdr3.C: New test. * g++.dg/cpp/syshdr3.h: New header the new test above. * g++.dg/system-binary-constants-1.C: New test. * g++.dg/system-binary-constants-1.h: New header the new test above. From-SVN: r187587
2012-05-16 12:51:15 +02:00
ds_last /* This enumerator must always be the last one. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
/* A decl-specifier-seq. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
struct cp_decl_specifier_seq {
PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokens Now that we track token locations accross macro expansions, it would be cool to be able to fix PR preprocessor/7263 for real. That is, consider this example where we have a system header named header.h like this: #define _Complex __complex__ #define _Complex_I 1.0iF and then a normal C file like this: #include "header.h" static _Complex float c = _Complex_I; If we compile the file with -pedantic, the usages of _Complex or _Complex_I should not trigger any warning, even though __complex__ and the complex literal are extensions to the standard C. They shouldn't trigger any warning because _Complex and _Complex_I are defined in a system header (and expanded in normal user code). To be able to handle this, we must address two separate concerns. First, warnings about non-standard usage of numerical literals are emitted directly from within libcpp. So we must teach libcpp's parser for numerical literals to use virtual locations, instead of the spelling location it uses today. Once we have that, as the diagnostics machinery already knows how to avoid emitting errors happening on tokens that come from system headers, we win. Second, there is the issue of tracking locations for declaration specifiers, like the "_Complex" in the declaration: static _Complex float c; For that, we need to arrange for each possible declaration specifier to have its own location, because otherwise, we'd warn on e.g, on: _Complex float c; but not on: static _Complex float c; So this patch addresses the two concerns above. It's actually a follow-up on an earlier patch[1] I wrote as part of my initial work on virtual locations. We then agreed[2] that the second concern was important to address before the patch could get a chance to go in. [1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html [2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. libcpp/ PR preprocessor/7263 * include/cpplib.h (cpp_classify_number): Take a location parameter. * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic macros that take a location parameter. (cpp_classify_number): Take a (virtual) location parameter. Use it for diagnostics. Adjust comments. (eval_token): Take a location parameter. Pass it to cpp_classify_number and to diagnostic routines. (_cpp_parse_expr): Use virtual locations of tokens when parsing expressions. Pass a virtual location to eval_token and to diagnostic routines. gcc/c-family/ PR preprocessor/7263 * c-lex.c (c_lex_with_flags): Pass a virtual location to the call to cpp_classify_number. For diagnostics, use the precise location instead of the global input_location. gcc/ PR preprocessor/7263 * c-tree.h (enum c_declspec_word): Declare new enum. (struct c_declspecs::locations): New member. (declspecs_add_qual, declspecs_add_scspec) (declspecs_add_addrspace, declspecs_add_alignas): Take a new location parameter. * c-decl.c (build_null_declspecs): Initialize the new struct c_declspecs::locations member. (declspecs_add_addrspace): Take a location parameter for the address space. Store it onto declaration specifiers. (declspecs_add_qual): Likewise, take a location parameter for the qualifier. (declspecs_add_type): Likewise, take a location parameter for the type specifier. (declspecs_add_scspec): Likewise, take a location parameter for the storage class specifier. (declspecs_add_attrs): Likewise, take a location parameter for the first attribute. (declspecs_add_alignas): Likewise, take a location parameter for the alignas token. (finish_declspecs): For diagnostics, use the location of the relevant declspec, instead of the global input_location. * c-parser.c (c_parser_parameter_declaration): Pass the precise virtual location of the declspec to the declspecs-setters. (c_parser_declspecs): Likewise. Avoid calling c_parser_peek_token repeatedly. gcc/cp/ PR preprocessor/7263 * cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all the possible declarator specifiers so far. (struct cp_decl_specifier_seq::locations): Declare new member. (cp_decl_specifier_seq::{specs, type_location}): Remove. (decl_spec_seq_has_spec_p): Declare new function. * parser.c (cp_parser_check_decl_spec): Remove. (set_and_check_decl_spec_loc): Define new static function. (decl_spec_seq_has_spec_p): Define new public function. (cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt) (cp_parser_type_specifier, cp_parser_simple_type_specifier) (cp_parser_set_storage_class, cp_parser_set_decl_spec_type) (cp_parser_alias_declaration): Set the locations for each declspec, using set_and_check_decl_spec_loc. (cp_parser_explicit_instantiation, cp_parser_init_declarator) (cp_parser_member_declaration, cp_parser_init_declarator): Use the new declspec location for specifiers. Use the new decl_spec_seq_has_spec_p. (cp_parser_type_specifier_seq): Use the new set_and_check_decl_spec_loc. Stop using cp_parser_check_decl_spec. Use the new decl_spec_seq_has_spec_p. (, cp_parser_init_declarator): Use the new set_and_check_decl_spec_loc. (cp_parser_single_declaration, cp_parser_friend_p) (cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration): Use the new decl_spec_seq_has_spec_p. * decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p. Use the more precise ds_redefined_builtin_type_spec location for diagnostics about re-declaring C++ built-in types. (start_decl, grokvardecl, grokdeclarator): Use the new decl_spec_seq_has_spec_p. gcc/testsuite/ PR preprocessor/7263 * gcc.dg/binary-constants-2.c: Run without tracking locations accross macro expansion. * gcc.dg/binary-constants-3.c: Likewise. * gcc.dg/cpp/sysmac2.c: Likewise. * testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise location. * gcc.dg/cpp/syshdr3.c: New test. * gcc.dg/cpp/syshdr3.h: New header for the new test above. * gcc.dg/system-binary-constants-1.c: New test. * gcc.dg/system-binary-constants-1.h: New header for the new test above. * g++.dg/cpp/syshdr3.C: New test. * g++.dg/cpp/syshdr3.h: New header the new test above. * g++.dg/system-binary-constants-1.C: New test. * g++.dg/system-binary-constants-1.h: New header the new test above. From-SVN: r187587
2012-05-16 12:51:15 +02:00
/* An array of locations for the declaration sepecifiers, indexed by
enum cp_decl_spec_word. */
source_location locations[ds_last];
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
/* The primary type, if any, given by the decl-specifier-seq.
Modifiers, like "short", "const", and "unsigned" are not
reflected here. This field will be a TYPE, unless a typedef-name
was used, in which case it will be a TYPE_DECL. */
tree type;
/* The attributes, if any, provided with the specifier sequence. */
tree attributes;
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
/* The c++11 attributes that follows the type specifier. */
tree std_attributes;
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
/* If non-NULL, a built-in type that the user attempted to redefine
to some other type. */
tree redefined_builtin_type;
/* The storage class specified -- or sc_none if no storage class was
explicitly specified. */
cp_storage_class storage_class;
machmode.h (int_n_data_t): New. * machmode.h (int_n_data_t): New. (int_n_enabled_p): New. (int_n_data): New. * tree.c (int_n_enabled_p): New. (int_n_trees): New. (make_or_reuse_type): Check for all __intN types, not just __int128. (build_common_tree_nodes): Likewise. Also fill in integer_typs[] entries. * tree.h (int128_integer_type_node): Remove. (int128_unsigned_type_node): Remove. (int_n_trees_t): New. (int_n_enabled_p): New. (int_n_trees): New. * toplev.c (standard_type_bitsize): New. (do_compile): Check which __intN types are enabled for the current run. * builtin-types.def (BT_INT128): Remove. (BT_UINT128): Remove. * machmode.def: Add macro to create __int128 for all targets. * stor-layout.c (mode_for_size): Support __intN types. (smallest_mode_for_size): Likewise. (initialize_sizetypes): Support __intN types. * genmodes.c (struct mode_data): Add int_n field. (blank_mode): Likewise. (INT_N): New. (make_int_n): New. (emit_insn_modes_h): Count __intN entries and define NUM_INT_N_ENTS. (emit_mode_int_n): New. (emit_insn_modes_c): Call it. * gimple.c (gimple_signed_or_unsigned_type): Check for all __intN types, not just __int128. * tree-core.h (integer_type_kind): Remove __int128-specific entries, reserve spots for __intN entries. libstdc++-v3/ * src/c++11/limits.cc: Add support for __intN types. * include/std/type_traits: Likewise. * include/std/limits: Likewise. * include/c_std/cstdlib: Likewise. * include/bits/cpp_type_traits.h: Likewise. * include/c_global/cstdlib: Likewise. c-family/ * c-pretty-print.c (pp_c_integer_constant): Check for all __intN types, not just __int128. * c-cppbuiltin.c (c_cpp_builtins): Add builtins for all __intN types, not just __int128. (cpp_atomic_builtins): Round pointer sizes up. (type_suffix): Use type precision, not specific types. * c-common.c (c_common_reswords): Remove __int128 special case. (c_common_type_for_size): Check for all __intN types, not just __int128. (c_common_type_for_mode): Likewise. (c_common_signed_or_unsigned_type): Likewise. (c_build_bitfield_integer_type): Likewise. (c_common_nodes_and_builtins): Likewise. (keyword_begins_type_specifier): Likewise. * c-common.h (rid): Remove RID_INT128 and add RID_INT_N_* for all __intN variants. c/ * c-parser.c (c_parse_init): Add RID entries for each __intN. (c_token_starts_typename): Check all __intN, not just __int128. (c_token_starts_declspecs): Likewise. (c_parser_declspecs): Likewise. (c_parser_attribute_any_word): Likewise. (c_parser_objc_selector): Likewise. * c-tree.h (c_typespec_keyword): cts_int128 -> cts_int_n. (struct c_declspecs): Add int_n_idx field to record *which* __intN is specified. * c-decl.c (declspecs_add_type): Check for all __intN, not just __int128. (finish_declspecs): Likewise. testsuite/ * g++.dg/abi/mangle64.C: New. cp/ * typeck.c (cp_common_type): Check for all __intN types, not just __int128. * decl.c (grokdeclarator): Likewise. * rtti.c (emit_support_tinfos): Check for all __intN types, not just __int128. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword): Check for all __intN types, not just __int128. (cp_parser_simple_type_specifier): Likewise. * mangle.c (integer_type_codes): Remove int128-specific codes. * cp-tree.h (cp_decl_specifier_seq): Add int_n_idx to store which __intN was specified. * lex.c (init_reswords): Reserve all __intN keywords. lto/ * lto-lang.c (lto_build_c_type_nodes): Check intN types for size-type as well. (lto_init): Initialize all intN types, not just int128. From-SVN: r216220
2014-10-14 21:44:36 +02:00
/* For the __intN declspec, this stores the index into the int_n_* arrays. */
int int_n_idx;
/* True iff TYPE_SPEC defines a class or enum. */
BOOL_BITFIELD type_definition_p : 1;
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
/* True iff multiple types were (erroneously) specified for this
decl-specifier-seq. */
BOOL_BITFIELD multiple_types_p : 1;
/* True iff multiple storage classes were (erroneously) specified
for this decl-specifier-seq or a combination of a storage class
with a typedef specifier. */
BOOL_BITFIELD conflicting_specifiers_p : 1;
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
/* True iff at least one decl-specifier was found. */
BOOL_BITFIELD any_specifiers_p : 1;
/* True iff at least one type-specifier was found. */
BOOL_BITFIELD any_type_specifiers_p : 1;
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
/* True iff "int" was explicitly provided. */
BOOL_BITFIELD explicit_int_p : 1;
machmode.h (int_n_data_t): New. * machmode.h (int_n_data_t): New. (int_n_enabled_p): New. (int_n_data): New. * tree.c (int_n_enabled_p): New. (int_n_trees): New. (make_or_reuse_type): Check for all __intN types, not just __int128. (build_common_tree_nodes): Likewise. Also fill in integer_typs[] entries. * tree.h (int128_integer_type_node): Remove. (int128_unsigned_type_node): Remove. (int_n_trees_t): New. (int_n_enabled_p): New. (int_n_trees): New. * toplev.c (standard_type_bitsize): New. (do_compile): Check which __intN types are enabled for the current run. * builtin-types.def (BT_INT128): Remove. (BT_UINT128): Remove. * machmode.def: Add macro to create __int128 for all targets. * stor-layout.c (mode_for_size): Support __intN types. (smallest_mode_for_size): Likewise. (initialize_sizetypes): Support __intN types. * genmodes.c (struct mode_data): Add int_n field. (blank_mode): Likewise. (INT_N): New. (make_int_n): New. (emit_insn_modes_h): Count __intN entries and define NUM_INT_N_ENTS. (emit_mode_int_n): New. (emit_insn_modes_c): Call it. * gimple.c (gimple_signed_or_unsigned_type): Check for all __intN types, not just __int128. * tree-core.h (integer_type_kind): Remove __int128-specific entries, reserve spots for __intN entries. libstdc++-v3/ * src/c++11/limits.cc: Add support for __intN types. * include/std/type_traits: Likewise. * include/std/limits: Likewise. * include/c_std/cstdlib: Likewise. * include/bits/cpp_type_traits.h: Likewise. * include/c_global/cstdlib: Likewise. c-family/ * c-pretty-print.c (pp_c_integer_constant): Check for all __intN types, not just __int128. * c-cppbuiltin.c (c_cpp_builtins): Add builtins for all __intN types, not just __int128. (cpp_atomic_builtins): Round pointer sizes up. (type_suffix): Use type precision, not specific types. * c-common.c (c_common_reswords): Remove __int128 special case. (c_common_type_for_size): Check for all __intN types, not just __int128. (c_common_type_for_mode): Likewise. (c_common_signed_or_unsigned_type): Likewise. (c_build_bitfield_integer_type): Likewise. (c_common_nodes_and_builtins): Likewise. (keyword_begins_type_specifier): Likewise. * c-common.h (rid): Remove RID_INT128 and add RID_INT_N_* for all __intN variants. c/ * c-parser.c (c_parse_init): Add RID entries for each __intN. (c_token_starts_typename): Check all __intN, not just __int128. (c_token_starts_declspecs): Likewise. (c_parser_declspecs): Likewise. (c_parser_attribute_any_word): Likewise. (c_parser_objc_selector): Likewise. * c-tree.h (c_typespec_keyword): cts_int128 -> cts_int_n. (struct c_declspecs): Add int_n_idx field to record *which* __intN is specified. * c-decl.c (declspecs_add_type): Check for all __intN, not just __int128. (finish_declspecs): Likewise. testsuite/ * g++.dg/abi/mangle64.C: New. cp/ * typeck.c (cp_common_type): Check for all __intN types, not just __int128. * decl.c (grokdeclarator): Likewise. * rtti.c (emit_support_tinfos): Check for all __intN types, not just __int128. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword): Check for all __intN types, not just __int128. (cp_parser_simple_type_specifier): Likewise. * mangle.c (integer_type_codes): Remove int128-specific codes. * cp-tree.h (cp_decl_specifier_seq): Add int_n_idx to store which __intN was specified. * lex.c (init_reswords): Reserve all __intN keywords. lto/ * lto-lang.c (lto_build_c_type_nodes): Check intN types for size-type as well. (lto_init): Initialize all intN types, not just int128. From-SVN: r216220
2014-10-14 21:44:36 +02:00
/* True iff "__intN" was explicitly provided. */
BOOL_BITFIELD explicit_intN_p : 1;
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
/* True iff "char" was explicitly provided. */
BOOL_BITFIELD explicit_char_p : 1;
/* True iff ds_thread is set for __thread, not thread_local. */
BOOL_BITFIELD gnu_thread_keyword_p : 1;
/* True iff the type is a decltype. */
BOOL_BITFIELD decltype_p : 1;
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
/* The various kinds of declarators. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
enum cp_declarator_kind {
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
cdk_id,
cdk_function,
cdk_array,
cdk_pointer,
cdk_reference,
cdk_ptrmem,
Implement P0217R3 - C++17 structured bindings gcc/ * match.pd: Don't try to compare addresses of variables with DECL_VALUE_EXPR. gcc/cp/ * cp-tree.h (struct lang_decl_base): Add decomposition_p. (DECL_DECOMPOSITION_P): New (enum auto_deduction_context): Add adc_decomp_type. (enum cp_declarator_kind): Add cdk_decomp. * constexpr.c (cxx_eval_constant_expression): Look through DECL_VALUE_EXPR. (potential_constant_expression_1): Likewise. * decl.c (reshape_init): Preserve CONSTRUCTOR_IS_DIRECT_INIT. (check_initializer): Use build_aggr_init for DECL_DECOMPOSITION_P. (cp_finish_decl): Pass adc_decomp_type for decomposition. (find_decomp_class_base, get_tuple_size, get_tuple_element_type) (get_tuple_decomp_init, cp_finish_decomp): New. (grokdeclarator): Handle decomposition. * init.c (build_aggr_init): Handle decomposition array. (build_vec_init): Handle initialization from { array }. * name-lookup.c (add_function): Always wrap TEMPLATE_DECL in OVERLOAD. * parser.c (declarator_can_be_parameter_pack): Handle cdk_decomp. (function_declarator_p, strip_declarator_types) (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_range_for, cp_convert_range_for): Handle decomposition. (cp_parser_simple_declaration): Parse decomposition. (cp_parser_decomposition_declaration): New. * pt.c (tsubst_decomp_names): New. (subst_expr) [DECL_EXPR, RANGE_FOR_STMT]: Handle decomposition. (do_auto_deduction): Handle adc_decomp_type. * semantics.c (finish_decltype_type): Look through DECL_VALUE_EXPR. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. * tree.c (lvalue_kind): Likewise. (cp_build_reference_type): Handle reference collapsing. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r242377
2016-11-14 06:02:58 +01:00
cdk_decomp,
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
cdk_error
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
/* A declarator. */
typedef struct cp_declarator cp_declarator;
typedef struct cp_parameter_declarator cp_parameter_declarator;
/* A parameter, before it has been semantically analyzed. */
struct cp_parameter_declarator {
/* The next parameter, or NULL_TREE if none. */
cp_parameter_declarator *next;
/* The decl-specifiers-seq for the parameter. */
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
cp_decl_specifier_seq decl_specifiers;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
/* The declarator for the parameter. */
cp_declarator *declarator;
/* The default-argument expression, or NULL_TREE, if none. */
tree default_argument;
/* True iff this is a template parameter pack. */
bool template_parameter_pack_p;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
};
/* A declarator. */
struct cp_declarator {
/* The kind of declarator. */
ENUM_BITFIELD (cp_declarator_kind) kind : 4;
/* Whether we parsed an ellipsis (`...') just before the declarator,
to indicate this is a parameter pack. */
BOOL_BITFIELD parameter_pack_p : 1;
Implement P0217R3 - C++17 structured bindings gcc/ * match.pd: Don't try to compare addresses of variables with DECL_VALUE_EXPR. gcc/cp/ * cp-tree.h (struct lang_decl_base): Add decomposition_p. (DECL_DECOMPOSITION_P): New (enum auto_deduction_context): Add adc_decomp_type. (enum cp_declarator_kind): Add cdk_decomp. * constexpr.c (cxx_eval_constant_expression): Look through DECL_VALUE_EXPR. (potential_constant_expression_1): Likewise. * decl.c (reshape_init): Preserve CONSTRUCTOR_IS_DIRECT_INIT. (check_initializer): Use build_aggr_init for DECL_DECOMPOSITION_P. (cp_finish_decl): Pass adc_decomp_type for decomposition. (find_decomp_class_base, get_tuple_size, get_tuple_element_type) (get_tuple_decomp_init, cp_finish_decomp): New. (grokdeclarator): Handle decomposition. * init.c (build_aggr_init): Handle decomposition array. (build_vec_init): Handle initialization from { array }. * name-lookup.c (add_function): Always wrap TEMPLATE_DECL in OVERLOAD. * parser.c (declarator_can_be_parameter_pack): Handle cdk_decomp. (function_declarator_p, strip_declarator_types) (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_range_for, cp_convert_range_for): Handle decomposition. (cp_parser_simple_declaration): Parse decomposition. (cp_parser_decomposition_declaration): New. * pt.c (tsubst_decomp_names): New. (subst_expr) [DECL_EXPR, RANGE_FOR_STMT]: Handle decomposition. (do_auto_deduction): Handle adc_decomp_type. * semantics.c (finish_decltype_type): Look through DECL_VALUE_EXPR. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. * tree.c (lvalue_kind): Likewise. (cp_build_reference_type): Handle reference collapsing. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r242377
2016-11-14 06:02:58 +01:00
location_t id_loc; /* Currently only set for cdk_id, cdk_decomp and
cdk_function. */
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
/* GNU Attributes that apply to this declarator. If the declarator
is a pointer or a reference, these attribute apply to the type
pointed to. */
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
tree attributes;
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
/* Standard C++11 attributes that apply to this declarator. If the
declarator is a pointer or a reference, these attributes apply
to the pointer, rather than to the type pointed to. */
tree std_attributes;
Implement P0217R3 - C++17 structured bindings gcc/ * match.pd: Don't try to compare addresses of variables with DECL_VALUE_EXPR. gcc/cp/ * cp-tree.h (struct lang_decl_base): Add decomposition_p. (DECL_DECOMPOSITION_P): New (enum auto_deduction_context): Add adc_decomp_type. (enum cp_declarator_kind): Add cdk_decomp. * constexpr.c (cxx_eval_constant_expression): Look through DECL_VALUE_EXPR. (potential_constant_expression_1): Likewise. * decl.c (reshape_init): Preserve CONSTRUCTOR_IS_DIRECT_INIT. (check_initializer): Use build_aggr_init for DECL_DECOMPOSITION_P. (cp_finish_decl): Pass adc_decomp_type for decomposition. (find_decomp_class_base, get_tuple_size, get_tuple_element_type) (get_tuple_decomp_init, cp_finish_decomp): New. (grokdeclarator): Handle decomposition. * init.c (build_aggr_init): Handle decomposition array. (build_vec_init): Handle initialization from { array }. * name-lookup.c (add_function): Always wrap TEMPLATE_DECL in OVERLOAD. * parser.c (declarator_can_be_parameter_pack): Handle cdk_decomp. (function_declarator_p, strip_declarator_types) (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_range_for, cp_convert_range_for): Handle decomposition. (cp_parser_simple_declaration): Parse decomposition. (cp_parser_decomposition_declaration): New. * pt.c (tsubst_decomp_names): New. (subst_expr) [DECL_EXPR, RANGE_FOR_STMT]: Handle decomposition. (do_auto_deduction): Handle adc_decomp_type. * semantics.c (finish_decltype_type): Look through DECL_VALUE_EXPR. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. * tree.c (lvalue_kind): Likewise. (cp_build_reference_type): Handle reference collapsing. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r242377
2016-11-14 06:02:58 +01:00
/* For all but cdk_id, cdk_decomp and cdk_error, the contained declarator.
For cdk_id, cdk_decomp and cdk_error, guaranteed to be NULL. */
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
cp_declarator *declarator;
union {
/* For identifiers. */
struct {
/* If non-NULL, the qualifying scope (a NAMESPACE_DECL or
*_TYPE) for this identifier. */
tree qualifying_scope;
/* The unqualified name of the entity -- an IDENTIFIER_NODE,
BIT_NOT_EXPR, or TEMPLATE_ID_EXPR. */
tree unqualified_name;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
/* If this is the name of a function, what kind of special
function (if any). */
special_function_kind sfk;
} id;
/* For functions. */
struct {
/* The parameters to the function as a TREE_LIST of decl/default. */
tree parameters;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
/* The cv-qualifiers for the function. */
cp_cv_quals qualifiers;
/* The virt-specifiers for the function. */
cp_virt_specifiers virt_specifiers;
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
/* The ref-qualifier for the function. */
cp_ref_qualifier ref_qualifier;
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
/* The transaction-safety qualifier for the function. */
tree tx_qualifier;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
/* The exception-specification for the function. */
tree exception_specification;
/* The late-specified return type, if any. */
tree late_return_type;
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
/* The trailing requires-clause, if any. */
tree requires_clause;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
} function;
/* For arrays. */
struct {
/* The bounds to the array. */
tree bounds;
} array;
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
/* For cdk_pointer and cdk_ptrmem. */
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
struct {
/* The cv-qualifiers for the pointer. */
cp_cv_quals qualifiers;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
/* For cdk_ptrmem, the class type containing the member. */
tree class_type;
} pointer;
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
/* For cdk_reference */
struct {
/* The cv-qualifiers for the reference. These qualifiers are
only used to diagnose ill-formed code. */
cp_cv_quals qualifiers;
/* Whether this is an rvalue reference */
bool rvalue_ref;
} reference;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
} u;
};
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
/* A level of template instantiation. */
struct GTY((chain_next ("%h.next"))) tinst_level {
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
/* The immediately deeper level in the chain. */
struct tinst_level *next;
/* The original node. Can be either a DECL (for a function or static
data member) or a TYPE (for a class), depending on what we were
asked to instantiate. */
tree decl;
/* The location where the template is instantiated. */
location_t locus;
/* errorcount+sorrycount when we pushed this level. */
int errors;
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
/* True if the location is in a system header. */
bool in_system_header_p;
};
PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokens Now that we track token locations accross macro expansions, it would be cool to be able to fix PR preprocessor/7263 for real. That is, consider this example where we have a system header named header.h like this: #define _Complex __complex__ #define _Complex_I 1.0iF and then a normal C file like this: #include "header.h" static _Complex float c = _Complex_I; If we compile the file with -pedantic, the usages of _Complex or _Complex_I should not trigger any warning, even though __complex__ and the complex literal are extensions to the standard C. They shouldn't trigger any warning because _Complex and _Complex_I are defined in a system header (and expanded in normal user code). To be able to handle this, we must address two separate concerns. First, warnings about non-standard usage of numerical literals are emitted directly from within libcpp. So we must teach libcpp's parser for numerical literals to use virtual locations, instead of the spelling location it uses today. Once we have that, as the diagnostics machinery already knows how to avoid emitting errors happening on tokens that come from system headers, we win. Second, there is the issue of tracking locations for declaration specifiers, like the "_Complex" in the declaration: static _Complex float c; For that, we need to arrange for each possible declaration specifier to have its own location, because otherwise, we'd warn on e.g, on: _Complex float c; but not on: static _Complex float c; So this patch addresses the two concerns above. It's actually a follow-up on an earlier patch[1] I wrote as part of my initial work on virtual locations. We then agreed[2] that the second concern was important to address before the patch could get a chance to go in. [1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html [2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. libcpp/ PR preprocessor/7263 * include/cpplib.h (cpp_classify_number): Take a location parameter. * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic macros that take a location parameter. (cpp_classify_number): Take a (virtual) location parameter. Use it for diagnostics. Adjust comments. (eval_token): Take a location parameter. Pass it to cpp_classify_number and to diagnostic routines. (_cpp_parse_expr): Use virtual locations of tokens when parsing expressions. Pass a virtual location to eval_token and to diagnostic routines. gcc/c-family/ PR preprocessor/7263 * c-lex.c (c_lex_with_flags): Pass a virtual location to the call to cpp_classify_number. For diagnostics, use the precise location instead of the global input_location. gcc/ PR preprocessor/7263 * c-tree.h (enum c_declspec_word): Declare new enum. (struct c_declspecs::locations): New member. (declspecs_add_qual, declspecs_add_scspec) (declspecs_add_addrspace, declspecs_add_alignas): Take a new location parameter. * c-decl.c (build_null_declspecs): Initialize the new struct c_declspecs::locations member. (declspecs_add_addrspace): Take a location parameter for the address space. Store it onto declaration specifiers. (declspecs_add_qual): Likewise, take a location parameter for the qualifier. (declspecs_add_type): Likewise, take a location parameter for the type specifier. (declspecs_add_scspec): Likewise, take a location parameter for the storage class specifier. (declspecs_add_attrs): Likewise, take a location parameter for the first attribute. (declspecs_add_alignas): Likewise, take a location parameter for the alignas token. (finish_declspecs): For diagnostics, use the location of the relevant declspec, instead of the global input_location. * c-parser.c (c_parser_parameter_declaration): Pass the precise virtual location of the declspec to the declspecs-setters. (c_parser_declspecs): Likewise. Avoid calling c_parser_peek_token repeatedly. gcc/cp/ PR preprocessor/7263 * cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all the possible declarator specifiers so far. (struct cp_decl_specifier_seq::locations): Declare new member. (cp_decl_specifier_seq::{specs, type_location}): Remove. (decl_spec_seq_has_spec_p): Declare new function. * parser.c (cp_parser_check_decl_spec): Remove. (set_and_check_decl_spec_loc): Define new static function. (decl_spec_seq_has_spec_p): Define new public function. (cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt) (cp_parser_type_specifier, cp_parser_simple_type_specifier) (cp_parser_set_storage_class, cp_parser_set_decl_spec_type) (cp_parser_alias_declaration): Set the locations for each declspec, using set_and_check_decl_spec_loc. (cp_parser_explicit_instantiation, cp_parser_init_declarator) (cp_parser_member_declaration, cp_parser_init_declarator): Use the new declspec location for specifiers. Use the new decl_spec_seq_has_spec_p. (cp_parser_type_specifier_seq): Use the new set_and_check_decl_spec_loc. Stop using cp_parser_check_decl_spec. Use the new decl_spec_seq_has_spec_p. (, cp_parser_init_declarator): Use the new set_and_check_decl_spec_loc. (cp_parser_single_declaration, cp_parser_friend_p) (cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration): Use the new decl_spec_seq_has_spec_p. * decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p. Use the more precise ds_redefined_builtin_type_spec location for diagnostics about re-declaring C++ built-in types. (start_decl, grokvardecl, grokdeclarator): Use the new decl_spec_seq_has_spec_p. gcc/testsuite/ PR preprocessor/7263 * gcc.dg/binary-constants-2.c: Run without tracking locations accross macro expansion. * gcc.dg/binary-constants-3.c: Likewise. * gcc.dg/cpp/sysmac2.c: Likewise. * testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise location. * gcc.dg/cpp/syshdr3.c: New test. * gcc.dg/cpp/syshdr3.h: New header for the new test above. * gcc.dg/system-binary-constants-1.c: New test. * gcc.dg/system-binary-constants-1.h: New header for the new test above. * g++.dg/cpp/syshdr3.C: New test. * g++.dg/cpp/syshdr3.h: New header the new test above. * g++.dg/system-binary-constants-1.C: New test. * g++.dg/system-binary-constants-1.h: New header the new test above. From-SVN: r187587
2012-05-16 12:51:15 +02:00
bool decl_spec_seq_has_spec_p (const cp_decl_specifier_seq *, cp_decl_spec);
/* Return the type of the `this' parameter of FNTYPE. */
inline tree
type_of_this_parm (const_tree fntype)
{
function_args_iterator iter;
gcc_assert (TREE_CODE (fntype) == METHOD_TYPE);
function_args_iter_init (&iter, fntype);
return function_args_iter_cond (&iter);
}
/* Return the class of the `this' parameter of FNTYPE. */
inline tree
class_of_this_parm (const_tree fntype)
{
return TREE_TYPE (type_of_this_parm (fntype));
}
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
/* True iff T is a variable template declaration. */
inline bool
variable_template_p (tree t)
{
if (TREE_CODE (t) != TEMPLATE_DECL)
return false;
if (!PRIMARY_TEMPLATE_P (t))
return false;
if (tree r = DECL_TEMPLATE_RESULT (t))
return VAR_P (r);
return false;
}
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
/* True iff T is a variable concept definition. That is, T is
a variable template declared with the concept specifier. */
inline bool
variable_concept_p (tree t)
{
if (TREE_CODE (t) != TEMPLATE_DECL)
return false;
if (tree r = DECL_TEMPLATE_RESULT (t))
return VAR_P (r) && DECL_DECLARED_CONCEPT_P (r);
return false;
}
/* True iff T is a concept definition. That is, T is a variable or function
template declared with the concept specifier. */
inline bool
concept_template_p (tree t)
{
if (TREE_CODE (t) != TEMPLATE_DECL)
return false;
if (tree r = DECL_TEMPLATE_RESULT (t))
return VAR_OR_FUNCTION_DECL_P (r) && DECL_DECLARED_CONCEPT_P (r);
return false;
}
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
/* A parameter list indicating for a function with no parameters,
e.g "int f(void)". */
extern cp_parameter_declarator *no_parameters;
/* in call.c */
extern bool check_dtor_name (tree, tree);
int magic_varargs_p (tree);
extern tree build_conditional_expr (location_t, tree, tree, tree,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
re PR c++/52422 ([C++11][SFINAE] Hard errors with void or arithmetic expressions) /cp 2012-04-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52422 * cp-tree.h (build_addr_func, decay_conversion, get_member_function_from_ptrfunc, build_m_component_ref, convert_member_func_to_ptr): Add tsubst_flags_t parameter. * typeck.c (cp_default_conversion): Add. (decay_conversion, default_conversion, get_member_function_from_ptrfunc, convert_member_func_to_ptr): Add tsubst_flags_t parameter and use it throughout. (cp_build_indirect_ref, cp_build_array_ref, cp_build_function_call_vec, convert_arguments, build_x_binary_op, cp_build_binary_op, cp_build_unary_op, build_reinterpret_cast_1, build_const_cast_1, expand_ptrmemfunc_cst, convert_for_initialization): Adjust. * init.c (build_vec_init): Adjust. * decl.c (grok_reference_init, get_atexit_node): Likewise. * rtti.c (build_dynamic_cast_1, tinfo_base_init): Likewise. * except.c (build_throw): Likewise. * typeck2.c (build_x_arrow): Likewise. (build_m_component_ref): Add tsubst_flags_t parameter and use it throughout. * pt.c (convert_nontype_argument): Adjust. * semantics.c (finish_asm_stmt, maybe_add_lambda_conv_op): Likewise. * decl2.c (build_offset_ref_call_from_tree): Likewise. * call.c (build_addr_func): Add tsubst_flags_t parameter and use it throughout. (build_call_a, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, build_over_call, build_special_member_call): Adjust. * cvt.c (cp_convert_to_pointer, force_rvalue, build_expr_type_conversion): Likewise. /testsuite 2012-04-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52422 * g++.dg/cpp0x/sfinae33.C: New. * g++.dg/cpp0x/sfinae34.C: Likewise. From-SVN: r186565
2012-04-18 12:21:43 +02:00
extern tree build_addr_func (tree, tsubst_flags_t);
extern void set_flags_from_callee (tree);
builtins.c (fold_builtin_call_list, [...]): Delete, and replace with... 2007-02-28 Sandra Loosemore <sandra@codesourcery.com> * gcc/builtins.c (fold_builtin_call_list, fold_builtin_call_valist): Delete, and replace with... (fold_builtin_call_array): This. Update callers to use it. * gcc/fold-const.c (fold_build_call_list): Delete, and replace with... (fold_build_call_array): This. (fold_build_call_list_initializer): Delete, and replace with... (fold_build_call_array_initializer): This. * gcc/tree.h: Update declarations to reflect above changes. * gcc/c-typeck.c (build_function_call): Store converted arguments in a stack-allocated array instead of building a list. (convert_arguments): Store arguments in the array passed in as an argument, and return the actual number of arguments. * gcc/c-format.c: (check_function_format): Pass arguments in an array instead of a list. * gcc/c-common.c (check_function_nonnull): Likewise. (check_function_sentinel): Likewise. (check_function_arguments): Likewise. * gcc/c-common.h: Update declarations to reflect above changes. * gcc/cp/typeck.c (build_function_call): Store converted arguments in a stack-allocated array instead of building a list. (convert_arguments): Store arguments in the array passed in as an argument, and return the actual number of arguments. * gcc/cp/call.c (build_call): Delete, and replace with... (build_call_n, build_call_a): New. (build_op_delete_call): Rewrite to avoid constructing argument lists. (build_over_call): Store converted arguments in a stack-allocated array instead of building a list. (build_cxx_call): Pass arguments in an array instead of as a list. (build_java_interface_fn_ref): Rewrite to avoid constructing argument lists. * gcc/cp/tree.h: Update declarations to reflect above changes. * gcc/cp/method.c (use_thunk): Use a stack-allocated array to hold the arguments instead of a list. * gcc/cp/rtti.c (throw_bad_cast): Update call to cxx_call. (throw_bad_typeid): Likewise. (build_dynamic_cast_1): Likewise. * gcc/cp/init.c (build_builtin_delete_call): Use build_call_n. * gcc/cp/decl.c (expand_static_init): Likewise. * gcc/cp/except.c (cp_protect_cleanup_actions): Likewise. * gcc/cp/cp-gimplify.c (genericize_eh_spec_block): Likewise. (gimplify_must_not_throw_expr): Likewise. (cxx_omp_apply_fn): Use build_call_a. From-SVN: r122411
2007-02-28 20:21:20 +01:00
extern tree build_call_a (tree, int, tree*);
extern tree build_call_n (tree, int, ...);
extern bool null_ptr_cst_p (tree);
extern bool null_member_pointer_value_p (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern bool sufficient_parms_p (const_tree);
extern tree type_decays_to (tree);
extern tree extract_call_expr (tree);
re PR c++/52363 (Presence/absence of -pedantic compilation affects run-time behavior) /cp 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * call.c (tourney, perform_overload_resolution, build_operator_new_call, build_user_type_conversion_1, build_user_type_conversion, perform_overload_resolution, add_template_candidate, add_template_candidate_real, add_template_conv_candidate, add_builtin_candidates, add_builtin_candidate, build_builtin_candidate, add_conv_candidate, add_function_candidate, implicit_conversion, reference_binding, build_list_conv, conditional_conversion, add_candidates, can_convert_array, build_aggr_conv, build_array_conv, build_complex_conv, conditional_conversion): Add tsubst_flags_t parameter. (joust): Likewise, use it to handle SFINAE as if pedantic. (add_list_candidates, build_integral_nontype_arg_conv, perform_overload_resolution, build_new_function_call, build_operator_new_call, build_op_call_1, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, convert_default_arg, convert_for_arg_passing, build_over_call, build_new_method_call_1, can_convert_arg, can_convert_arg_bad, perform_implicit_conversion_flags, perform_direct_initialization_if_possible, initialize_reference): Adjust. * typeck.c (casts_away_constness, casts_away_constness_r): Add tsubst_flags_t parameter. (convert_arguments, check_for_casting_away_constness, build_static_cast_1, build_ptrmemfunc, convert_for_assignment): Adjust. * decl.c (reshape_init_r, check_default_argument): Likewise. * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise. * pt.c (convert_nontype_argument, check_non_deducible_conversion): Likewise. * init.c (build_new_1): Likewise. * cvt.c (convert_to_reference, ocp_convert, build_type_conversion, build_expr_type_conversion, ): Likewise. * search.c (check_final_overrider): Likewise. * cp-tree.h (build_user_type_conversion, build_operator_new_call, can_convert, can_convert_arg, can_convert_arg_bad, convert_default_arg, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust declaration. /testsuite 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * g++.dg/cpp0x/sfinae35.C: New. * g++.dg/cpp0x/sfinae36.C: Likewise. From-SVN: r186774
2012-04-24 18:25:15 +02:00
extern tree build_user_type_conversion (tree, tree, int,
tsubst_flags_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
extern tree build_new_function_call (tree, vec<tree, va_gc> **, bool,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_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
extern tree build_operator_new_call (tree, vec<tree, va_gc> **, tree *,
tree *, tree, tree, tree *,
re PR c++/52363 (Presence/absence of -pedantic compilation affects run-time behavior) /cp 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * call.c (tourney, perform_overload_resolution, build_operator_new_call, build_user_type_conversion_1, build_user_type_conversion, perform_overload_resolution, add_template_candidate, add_template_candidate_real, add_template_conv_candidate, add_builtin_candidates, add_builtin_candidate, build_builtin_candidate, add_conv_candidate, add_function_candidate, implicit_conversion, reference_binding, build_list_conv, conditional_conversion, add_candidates, can_convert_array, build_aggr_conv, build_array_conv, build_complex_conv, conditional_conversion): Add tsubst_flags_t parameter. (joust): Likewise, use it to handle SFINAE as if pedantic. (add_list_candidates, build_integral_nontype_arg_conv, perform_overload_resolution, build_new_function_call, build_operator_new_call, build_op_call_1, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, convert_default_arg, convert_for_arg_passing, build_over_call, build_new_method_call_1, can_convert_arg, can_convert_arg_bad, perform_implicit_conversion_flags, perform_direct_initialization_if_possible, initialize_reference): Adjust. * typeck.c (casts_away_constness, casts_away_constness_r): Add tsubst_flags_t parameter. (convert_arguments, check_for_casting_away_constness, build_static_cast_1, build_ptrmemfunc, convert_for_assignment): Adjust. * decl.c (reshape_init_r, check_default_argument): Likewise. * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise. * pt.c (convert_nontype_argument, check_non_deducible_conversion): Likewise. * init.c (build_new_1): Likewise. * cvt.c (convert_to_reference, ocp_convert, build_type_conversion, build_expr_type_conversion, ): Likewise. * search.c (check_final_overrider): Likewise. * cp-tree.h (build_user_type_conversion, build_operator_new_call, can_convert, can_convert_arg, can_convert_arg_bad, convert_default_arg, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust declaration. /testsuite 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * g++.dg/cpp0x/sfinae35.C: New. * g++.dg/cpp0x/sfinae36.C: Likewise. From-SVN: r186774
2012-04-24 18:25:15 +02:00
tsubst_flags_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
extern tree build_new_method_call (tree, tree, vec<tree, va_gc> **,
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
tree, int, tree *,
tsubst_flags_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
extern tree build_special_member_call (tree, tree, vec<tree, va_gc> **,
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
tree, int, tsubst_flags_t);
extern tree build_new_op (location_t, enum tree_code,
int, tree, tree, tree, tree *,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_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
extern tree build_op_call (tree, vec<tree, va_gc> **,
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
tsubst_flags_t);
extern bool aligned_allocation_fn_p (tree);
extern bool usual_deallocation_fn_p (tree);
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
extern tree build_op_delete_call (enum tree_code, tree, tree,
bool, tree, tree,
tsubst_flags_t);
re PR c++/52363 (Presence/absence of -pedantic compilation affects run-time behavior) /cp 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * call.c (tourney, perform_overload_resolution, build_operator_new_call, build_user_type_conversion_1, build_user_type_conversion, perform_overload_resolution, add_template_candidate, add_template_candidate_real, add_template_conv_candidate, add_builtin_candidates, add_builtin_candidate, build_builtin_candidate, add_conv_candidate, add_function_candidate, implicit_conversion, reference_binding, build_list_conv, conditional_conversion, add_candidates, can_convert_array, build_aggr_conv, build_array_conv, build_complex_conv, conditional_conversion): Add tsubst_flags_t parameter. (joust): Likewise, use it to handle SFINAE as if pedantic. (add_list_candidates, build_integral_nontype_arg_conv, perform_overload_resolution, build_new_function_call, build_operator_new_call, build_op_call_1, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, convert_default_arg, convert_for_arg_passing, build_over_call, build_new_method_call_1, can_convert_arg, can_convert_arg_bad, perform_implicit_conversion_flags, perform_direct_initialization_if_possible, initialize_reference): Adjust. * typeck.c (casts_away_constness, casts_away_constness_r): Add tsubst_flags_t parameter. (convert_arguments, check_for_casting_away_constness, build_static_cast_1, build_ptrmemfunc, convert_for_assignment): Adjust. * decl.c (reshape_init_r, check_default_argument): Likewise. * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise. * pt.c (convert_nontype_argument, check_non_deducible_conversion): Likewise. * init.c (build_new_1): Likewise. * cvt.c (convert_to_reference, ocp_convert, build_type_conversion, build_expr_type_conversion, ): Likewise. * search.c (check_final_overrider): Likewise. * cp-tree.h (build_user_type_conversion, build_operator_new_call, can_convert, can_convert_arg, can_convert_arg_bad, convert_default_arg, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust declaration. /testsuite 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * g++.dg/cpp0x/sfinae35.C: New. * g++.dg/cpp0x/sfinae36.C: Likewise. From-SVN: r186774
2012-04-24 18:25:15 +02:00
extern bool can_convert (tree, tree, tsubst_flags_t);
extern bool can_convert_standard (tree, tree, tsubst_flags_t);
re PR c++/52363 (Presence/absence of -pedantic compilation affects run-time behavior) /cp 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * call.c (tourney, perform_overload_resolution, build_operator_new_call, build_user_type_conversion_1, build_user_type_conversion, perform_overload_resolution, add_template_candidate, add_template_candidate_real, add_template_conv_candidate, add_builtin_candidates, add_builtin_candidate, build_builtin_candidate, add_conv_candidate, add_function_candidate, implicit_conversion, reference_binding, build_list_conv, conditional_conversion, add_candidates, can_convert_array, build_aggr_conv, build_array_conv, build_complex_conv, conditional_conversion): Add tsubst_flags_t parameter. (joust): Likewise, use it to handle SFINAE as if pedantic. (add_list_candidates, build_integral_nontype_arg_conv, perform_overload_resolution, build_new_function_call, build_operator_new_call, build_op_call_1, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, convert_default_arg, convert_for_arg_passing, build_over_call, build_new_method_call_1, can_convert_arg, can_convert_arg_bad, perform_implicit_conversion_flags, perform_direct_initialization_if_possible, initialize_reference): Adjust. * typeck.c (casts_away_constness, casts_away_constness_r): Add tsubst_flags_t parameter. (convert_arguments, check_for_casting_away_constness, build_static_cast_1, build_ptrmemfunc, convert_for_assignment): Adjust. * decl.c (reshape_init_r, check_default_argument): Likewise. * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise. * pt.c (convert_nontype_argument, check_non_deducible_conversion): Likewise. * init.c (build_new_1): Likewise. * cvt.c (convert_to_reference, ocp_convert, build_type_conversion, build_expr_type_conversion, ): Likewise. * search.c (check_final_overrider): Likewise. * cp-tree.h (build_user_type_conversion, build_operator_new_call, can_convert, can_convert_arg, can_convert_arg_bad, convert_default_arg, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust declaration. /testsuite 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * g++.dg/cpp0x/sfinae35.C: New. * g++.dg/cpp0x/sfinae36.C: Likewise. From-SVN: r186774
2012-04-24 18:25:15 +02:00
extern bool can_convert_arg (tree, tree, tree, int,
tsubst_flags_t);
extern bool can_convert_arg_bad (tree, tree, tree, int,
tsubst_flags_t);
extern bool enforce_access (tree, tree, tree,
tsubst_flags_t);
extern void push_defarg_context (tree);
extern void pop_defarg_context (void);
re PR c++/52363 (Presence/absence of -pedantic compilation affects run-time behavior) /cp 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * call.c (tourney, perform_overload_resolution, build_operator_new_call, build_user_type_conversion_1, build_user_type_conversion, perform_overload_resolution, add_template_candidate, add_template_candidate_real, add_template_conv_candidate, add_builtin_candidates, add_builtin_candidate, build_builtin_candidate, add_conv_candidate, add_function_candidate, implicit_conversion, reference_binding, build_list_conv, conditional_conversion, add_candidates, can_convert_array, build_aggr_conv, build_array_conv, build_complex_conv, conditional_conversion): Add tsubst_flags_t parameter. (joust): Likewise, use it to handle SFINAE as if pedantic. (add_list_candidates, build_integral_nontype_arg_conv, perform_overload_resolution, build_new_function_call, build_operator_new_call, build_op_call_1, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, convert_default_arg, convert_for_arg_passing, build_over_call, build_new_method_call_1, can_convert_arg, can_convert_arg_bad, perform_implicit_conversion_flags, perform_direct_initialization_if_possible, initialize_reference): Adjust. * typeck.c (casts_away_constness, casts_away_constness_r): Add tsubst_flags_t parameter. (convert_arguments, check_for_casting_away_constness, build_static_cast_1, build_ptrmemfunc, convert_for_assignment): Adjust. * decl.c (reshape_init_r, check_default_argument): Likewise. * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise. * pt.c (convert_nontype_argument, check_non_deducible_conversion): Likewise. * init.c (build_new_1): Likewise. * cvt.c (convert_to_reference, ocp_convert, build_type_conversion, build_expr_type_conversion, ): Likewise. * search.c (check_final_overrider): Likewise. * cp-tree.h (build_user_type_conversion, build_operator_new_call, can_convert, can_convert_arg, can_convert_arg_bad, convert_default_arg, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust declaration. /testsuite 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * g++.dg/cpp0x/sfinae35.C: New. * g++.dg/cpp0x/sfinae36.C: Likewise. From-SVN: r186774
2012-04-24 18:25:15 +02:00
extern tree convert_default_arg (tree, tree, tree, int,
tsubst_flags_t);
extern tree convert_arg_to_ellipsis (tree, tsubst_flags_t);
extern tree build_x_va_arg (source_location, tree, tree);
extern tree cxx_type_promotes_to (tree);
extern tree type_passed_as (tree);
re PR c++/52363 (Presence/absence of -pedantic compilation affects run-time behavior) /cp 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * call.c (tourney, perform_overload_resolution, build_operator_new_call, build_user_type_conversion_1, build_user_type_conversion, perform_overload_resolution, add_template_candidate, add_template_candidate_real, add_template_conv_candidate, add_builtin_candidates, add_builtin_candidate, build_builtin_candidate, add_conv_candidate, add_function_candidate, implicit_conversion, reference_binding, build_list_conv, conditional_conversion, add_candidates, can_convert_array, build_aggr_conv, build_array_conv, build_complex_conv, conditional_conversion): Add tsubst_flags_t parameter. (joust): Likewise, use it to handle SFINAE as if pedantic. (add_list_candidates, build_integral_nontype_arg_conv, perform_overload_resolution, build_new_function_call, build_operator_new_call, build_op_call_1, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, convert_default_arg, convert_for_arg_passing, build_over_call, build_new_method_call_1, can_convert_arg, can_convert_arg_bad, perform_implicit_conversion_flags, perform_direct_initialization_if_possible, initialize_reference): Adjust. * typeck.c (casts_away_constness, casts_away_constness_r): Add tsubst_flags_t parameter. (convert_arguments, check_for_casting_away_constness, build_static_cast_1, build_ptrmemfunc, convert_for_assignment): Adjust. * decl.c (reshape_init_r, check_default_argument): Likewise. * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise. * pt.c (convert_nontype_argument, check_non_deducible_conversion): Likewise. * init.c (build_new_1): Likewise. * cvt.c (convert_to_reference, ocp_convert, build_type_conversion, build_expr_type_conversion, ): Likewise. * search.c (check_final_overrider): Likewise. * cp-tree.h (build_user_type_conversion, build_operator_new_call, can_convert, can_convert_arg, can_convert_arg_bad, convert_default_arg, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust declaration. /testsuite 2012-04-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52363 * g++.dg/cpp0x/sfinae35.C: New. * g++.dg/cpp0x/sfinae36.C: Likewise. From-SVN: r186774
2012-04-24 18:25:15 +02:00
extern tree convert_for_arg_passing (tree, tree, tsubst_flags_t);
extern bool is_properly_derived_from (tree, tree);
extern tree initialize_reference (tree, tree, int,
tsubst_flags_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
extern tree extend_ref_init_temps (tree, tree, vec<tree, va_gc>**);
extern tree make_temporary_var_for_ref_to_temp (tree, tree);
extern bool type_has_extended_temps (tree);
extern tree strip_top_quals (tree);
extern bool reference_related_p (tree, tree);
extern int remaining_arguments (tree);
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
extern tree perform_implicit_conversion (tree, tree, tsubst_flags_t);
Implement explicit conversions ops as specified in N2437. * decl.c (grokdeclarator): Handle explicit conversion ops. (check_initializer): Pass flags to store_init_value. * decl2.c (maybe_emit_vtables): Likewise. * init.c (expand_aggr_init_1): Likewise. * call.c (convert_class_to_reference): Take flags parm, check DECL_NONCONVERTING_P. (build_user_type_conversion_1): Check DECL_NONCONVERTING_P. (add_builtin_candidates): Simplify getting type of conversion. (build_object_call): Likewise. Check DECL_NONCONVERTING_P. (implicit_conversion): Pass through LOOKUP_ONLYCONVERTING. (reference_binding): Take flags parm. Direct-initialize copy parm. (add_function_candidate): Direct-initialize the copy parm. (add_conv_candidate): Use LOOKUP_IMPLICIT, not LOOKUP_NORMAL. (build_builtin_candidate): Add LOOKUP_ONLYCONVERTING. (conditional_conversion): Likewise. (convert_like_real): Only complain about DECL_NONCONVERTING_P constructors. (perform_implicit_conversion_flags): Add flags parm to perform_implicit_conversion. Improve diagnostics. * cp-tree.h (LOOKUP_IMPLICIT): New macro. (LOOKUP_COPY_PARM): New bit macro. * cvt.c (build_expr_type_conversion): Check DECL_NONCONVERTING_P. * typeck.c (convert_for_assignment): Take flags parm, pass it to perform_implicit_conversion_flags. (cp_build_modify_expr): Pass flags to convert_for_assignment. (convert_for_initialization): Likewise. * typeck2.c (store_init_value): Take flags parm, pass to digest_init_flags. (digest_init_flags): Add flags parm to digest_init. (digest_init_r): Take flags parm, pass to convert_for_initialization. (process_init_constructor_array): Pass it. (process_init_constructor_record): Likewise. (process_init_constructor_union): Likewise. From-SVN: r147677
2009-05-18 23:48:02 +02:00
extern tree perform_implicit_conversion_flags (tree, tree, tsubst_flags_t, int);
extern tree build_integral_nontype_arg_conv (tree, tree, tsubst_flags_t);
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
extern tree perform_direct_initialization_if_possible (tree, tree, bool,
tsubst_flags_t);
extern tree in_charge_arg_for_name (tree);
extern tree build_cxx_call (tree, int, tree *,
tsubst_flags_t);
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
extern bool is_std_init_list (tree);
extern bool is_list_ctor (tree);
extern void validate_conversion_obstack (void);
extern void mark_versions_used (tree);
extern tree get_function_version_dispatcher (tree);
1994-02-24 02:02:37 +01:00
/* in class.c */
extern tree build_vfield_ref (tree, tree);
extern tree build_if_in_charge (tree true_stmt, tree false_stmt = void_node);
extern tree build_base_path (enum tree_code, tree,
tree, int, tsubst_flags_t);
extern tree convert_to_base (tree, tree, bool, bool,
tsubst_flags_t);
extern tree convert_to_base_statically (tree, tree);
extern tree build_vtbl_ref (tree, tree);
extern tree build_vfn_ref (tree, tree);
extern tree get_vtable_decl (tree, int);
extern void resort_type_method_vec (void *, void *,
gt_pointer_operator, void *);
extern bool add_method (tree, tree, tree);
extern tree declared_access (tree);
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
extern tree currently_open_class (tree);
extern tree currently_open_derived_class (tree);
extern tree outermost_open_class (void);
extern tree current_nonlambda_class_type (void);
extern tree finish_struct (tree, tree);
extern void finish_struct_1 (tree);
extern int resolves_to_fixed_type_p (tree, int *);
extern void init_class_processing (void);
extern int is_empty_class (tree);
extern bool is_really_empty_class (tree);
extern void pushclass (tree);
extern void popclass (void);
c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__. * c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__. * call.c (build_field_call): Use build_new_op, not build_opfncall. (prep_operand): New function. (build_new_op): Use it. Remove dead code. * class.c (pushclass): Change "modify" parameter type from int to bool. (currently_open_class): Use same_type_p, not pointer equality. (push_nested_class): Adjust calls to pushclass, remove modify parameter. * cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro. (pushclass): Change prototype. (push_nested_class): Likewise. (grokoptypename): Remove. (build_opfncall): Remove. (value_dependent_expression_p): Declare. (resolve_typename_type): Likewise. (resolve_typename_type_in_current_instantiation): Likewise. (enter_scope_of): Remove. (tsubst): Remove. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. * decl.c (warn_about_implicit_typename_lookup): Remove. (finish_case_label): Return error_mark_node for erroneous labels. (start_decl): Adjust calls to push_nested_class. (grokfndecl): Call push_scope/pop_scope around call to duplicate_decls. (grokdeclarator): Do not call tsubst. (start_function): Adjust calls to push_nested_class. * decl2.c (grok_array_decl): Use build_new_op, not build_opfncall. (check_classfn): Use push_scope/pop_scope around type comparisions. (grokoptypename): Remove. (push_sscope): Adjust call to push_nested_class. * error.c (dump_type): Show cv-qualification of typename types. * init.c (build_member_call): Use build_new_op, not build_opfncall. * method.c (build_opfncall): Remove. * parser.c (cp_parser): Add allow_non_constant_expression_p and non_constant_expression_p. (cp_parser_constant_expression): Adjust prototype. (cp_parser_resolve_typename_type): Remove. (cp_parser_non_constant_expression): New function. (cp_parser_non_constant_id_expression): Likewise. (cp_parser_new): Set allow_non_constant_expression_p and non_constant_expression_p. (cp_parser_primary_expression): Reject `this' and `va_arg' in constant-expressions. Note that dependent names aren't really constant. (cp_parser_postfix_expression): Reject conversions to non-integral types in constant-expressions. Neither are increments or decrements. (cp_parser_unary_expression): Reject increments and decrements in constant-expressions. (cp_parser_direct_new_declarator): Adjust call to cp_parser_constant_expression. (cp_parser_cast_expression): Reject conversions to non-integral types in constant-expressions. (cp_parser_assignment_expression): Rejects assignments in constant-expressions. (cp_parser_expression): Reject commas in constant-expressions. (cp_parser_labeled_statement): Adjust call to cp_parser_constant_expression. (cp_parser_direct_declarator): Simplify array bounds, even in templates, when they are non-dependent. Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_class_head): Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_member_declaration): Adjust call to cp_parser_constant_expression. (cp_parser_constant_initializer): Likewise. (cp_parser_constructor_declarator): Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_late_parsing_default_args): Adjust call to push_nested_class. * pt.c (tsubst): Give it internal linkage. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. (push_access_scope_real): Likewise. (tsubst_friend_class): Likewise. (instantiate_class_template): Adjust call to pushclass. (value_dependent_expression_p): Give it external linkage. Robustify. (resolve_typename_type): New function. * semantics.c (finish_call_expr): Use build_new_op, not build_opfncall. (begin_constructor_declarator): Remove. (begin_class_definition): Adjust call to pushclass. (enter_scope_of): Remove. * typeck.c (comptypes): Resolve typename types as appropriate. (build_x_indirect_ref): Use build_new_op, not build_opfncall. (build_x_compound_expr): Likewise. (build_modify_expr): Likewise. (build_x_modify_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. * g++.dg/parser/constant1.C: New test. * include/std/std_limits.h (numeric_limits<float>::has_infinity): Use __FLT_HAS_INIFINITY__ to initialize. (numeric_limits<float>::has_quiet_NaN): Likewise. (numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__ to initialize. (numeric_limits<double>::has_quiet_NaN): Likewise. (numeric_limits<long double>::has_infinity): Use __LDBL_HAS_INIFINITY__ to initialize. (numeric_limits<long_double>::has_quiet_NaN): Likewise. From-SVN: r62130
2003-01-30 08:24:02 +01:00
extern void push_nested_class (tree);
extern void pop_nested_class (void);
extern int current_lang_depth (void);
extern void push_lang_context (tree);
extern void pop_lang_context (void);
extern tree instantiate_type (tree, tree, tsubst_flags_t);
extern void print_class_statistics (void);
extern void build_self_reference (void);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int same_signature_p (const_tree, const_tree);
extern void maybe_add_class_template_decl_list (tree, tree, int);
extern void unreverse_member_declarations (tree);
extern void invalidate_class_lookup_cache (void);
extern void maybe_note_name_used_in_class (tree, tree);
extern void note_name_declared_in_class (tree, tree);
extern tree get_vtbl_decl_for_binfo (tree);
extern bool vptr_via_virtual_p (tree);
extern void debug_class (tree);
extern void debug_thunks (tree);
extern void set_linkage_according_to_type (tree, tree);
extern void determine_key_method (tree);
extern void check_for_override (tree, tree);
2006-06-06 13:44:09 +02:00
extern void push_class_stack (void);
extern void pop_class_stack (void);
extern bool default_ctor_p (tree);
extern bool type_has_user_nondefault_constructor (tree);
extern tree in_class_defaulted_default_constructor (tree);
extern bool user_provided_p (tree);
extern bool type_has_user_provided_constructor (tree);
extern bool type_has_non_user_provided_default_constructor (tree);
extern bool vbase_has_user_provided_move_assign (tree);
extern tree default_init_uninitialized_part (tree);
extern bool trivial_default_constructor_is_constexpr (tree);
parser.c (cp_parser_ctor_initializer_opt_and_function_body): Make sure a constexpr ctor has an empty body. * parser.c (cp_parser_ctor_initializer_opt_and_function_body): Make sure a constexpr ctor has an empty body. * class.c (type_has_constexpr_default_constructor): New. * cp-tree.h: Declare it. * init.c (perform_member_init): Complain about uninitialized member in constexpr ctor. (emit_mem_initializers): And uninitialized base. * decl.c (check_tag_decl): Fix typo. * semantics.c (valid_type_in_constexpr_fundecl_p): New fn. (is_valid_constexpr_fn): New fn. (validate_constexpr_fundecl): Use it. * decl.c (validate_constexpr_redeclaration): New. (duplicate_decls): Use it. (cp_finish_decl): Call validate_constexpr_fundecl and ensure_literal_type_for_constexpr_object here. (start_decl): Not here. Don't ICE on constexpr reference. (check_for_uninitialized_const_var): Don't handle constexpr specially. (grokfndecl): Set DECL_DECLARED_CONSTEXPR_P. (check_static_variable_definition): Give friendly message about missing constexpr. (grokdeclarator): Complain about typedef and volatile with constexpr. Reorganize. Give sorry about non-static data members in C++0x mode. (start_preparsed_function): Check validate_constexpr_fundecl here. (check_function_type): Not here. * decl2.c (finish_static_data_member_decl): Don't complain about in-class init. * parser.c (CP_PARSER_FLAGS_ONLY_TYPE_OR_CONSTEXPR): New. (cp_parser_condition): Pass it to cp_parser_decl_specifier_seq. (cp_parser_decl_specifier_seq): Handle it. (cp_parser_explicit_instantiation): Diagnose inline and constexpr. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r166013
2010-10-27 21:31:33 +02:00
extern bool type_has_constexpr_default_constructor (tree);
extern bool type_has_virtual_destructor (tree);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
extern bool type_has_move_constructor (tree);
extern bool type_has_move_assign (tree);
extern bool type_has_user_declared_move_constructor (tree);
extern bool type_has_user_declared_move_assign(tree);
extern bool type_build_ctor_call (tree);
extern bool type_build_dtor_call (tree);
extern void explain_non_literal_class (tree);
extern void inherit_targ_abi_tags (tree);
extern void defaulted_late_check (tree);
extern bool defaultable_fn_check (tree);
extern void check_abi_tags (tree);
extern tree missing_abi_tags (tree);
re PR c++/26693 (Access checks not performed for types in templates) gcc/ChangeLog: 2009-04-02 Dodji Seketeli <dodji@redhat.com> PR c++/26693 * c-decl.c: (clone_underlying_type): Move this ... * c-common.c (set_underlying_type): ... here. Also, make sure the function properly sets TYPE_STUB_DECL() on the newly created typedef variant type. * c-common.h (is_typedef_decl, set_underlying_type): Declare ... * c-common.c (is_typedef_decl, set_underlying_type): ... new entry points. gcc/cp/ChangeLog: 2009-04-02 Dodji Seketeli <dodji@redhat.com> PR c++/26693 * decl2.c (grokfield): when a typedef appears in a class, create the typedef variant type node for it. (save_template_attributes): Creating typedef variant type node here is now useless. * decl.c (grokdeclarator): If the typedef'ed struct/class was anonymous, set the proper type name to all its type variants. (xref_basetypes) : Fixup the variant types after setting TYPE_BINFO on REF. * name-lookup.c (pushdecl_maybe_friend): Reuse the set_underlying_type function to install typedef variant types. * cp-tree.h (MEMBER_TYPES_NEEDING_ACCESS_CHECK): New template accessor macro. (append_type_to_template_for_access_check): New entry points. * semantics.c (check_accessibility_of_qualified_id): When a typedef that is a member of a class appears in a template, add it to the template. It will be ... * class.c (finish_struct_bits): Split type variant fixup into ... (fixup_type_variants): A new entry point. * pt.c (instantiate_class_template, instantiate_template ): ... access checked at template instantiation time. (resolve_type_name_type): The type name should be the name of the main type variant. (retrieve_specialization): Specializations of template typedefs aren't to be looked up in DECL_TEMPLATE_INSTANTIATIONS (tmpl). (append_type_to_template_for_access_check): New entry point. (tsubst_decl): For typedefs, build the variant type from the correct original type. (get_class_bindings): Fix function comment. (perform_typedefs_access_check): New entry point. gcc/testsuite/ChangeLog: 2009-04-02 Dodji Seketeli <dodji@redhat.com> PR c++/26693 * g++.dg/template/typedef11.C: New test. * g++.dg/template/typedef12.C: Likewise. * g++.dg/template/typedef13.C: Likewise. * g++.dg/template/typedef14.C: Likewise. * g++.dg/template/typedef15.C: Likewise. * g++.dg/template/typedef16.C: Likewise. * g++.dg/template/sfinae3.C: Compile this pedantically. The only errors expected should be the one saying the typedef is ill formed. * g++.old-deja/g++.pt/typename8.C: Likewise. * g++.dg/template/access11.C: Update this. libstdc++-v3/ChangeLog: 2009-04-02 Dodji Seketeli <dodji@redhat.com> * include/ext/bitmap_allocator.h: the typedefs should be made public if we want them to be accessible. This has been revealed by the patch that fixes PR c++/26693 in g++. From-SVN: r145440
2009-04-02 11:24:19 +02:00
extern void fixup_type_variants (tree);
extern void fixup_attribute_variants (tree);
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
extern tree* decl_cloned_function_p (const_tree, bool);
extern void clone_function_decl (tree, int);
extern void adjust_clone_args (tree);
extern void deduce_noexcept_on_destructor (tree);
extern void insert_late_enum_def_into_classtype_sorted_fields (tree, tree);
extern bool uniquely_derived_from_p (tree, tree);
extern bool publicly_uniquely_derived_p (tree, tree);
extern tree common_enclosing_class (tree, tree);
1994-02-24 02:02:37 +01:00
/* in cvt.c */
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
extern tree convert_to_reference (tree, tree, int, int, tree,
tsubst_flags_t);
extern tree convert_from_reference (tree);
extern tree force_rvalue (tree, tsubst_flags_t);
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
extern tree ocp_convert (tree, tree, int, int,
tsubst_flags_t);
extern tree cp_convert (tree, tree, tsubst_flags_t);
extern tree cp_convert_and_check (tree, tree, tsubst_flags_t);
extern tree cp_fold_convert (tree, tree);
extern tree cp_get_callee (tree);
extern tree cp_get_callee_fndecl (tree);
extern tree cp_get_fndecl_from_callee (tree);
extern tree convert_to_void (tree, impl_conv_void,
tsubst_flags_t);
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
extern tree convert_force (tree, tree, int,
tsubst_flags_t);
extern tree build_expr_type_conversion (int, tree, bool);
extern tree type_promotes_to (tree);
extern tree perform_qualification_conversions (tree, tree);
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
extern bool tx_safe_fn_type_p (tree);
extern tree tx_unsafe_fn_variant (tree);
Implement P0012R1, Make exception specifications part of the type system. gcc/cp/ * cp-tree.h (enum tsubst_flags): Add tf_fndecl_type. (flag_noexcept_type, ce_type): New. * call.c (build_conv): Add ck_fnptr. (enum conversion_kind): Change ck_tsafe to ck_fnptr. (convert_like_real): Likewise. (standard_conversion): Likewise. Allow function pointer conversions for pointers to member functions. (reference_compatible_p): Allow function pointer conversions. (direct_reference_binding): Likewise. (reference_binding): Reference-compatible is no longer a subset of reference-related. (is_subseq): Also strip ck_lvalue after next_conversion. * class.c (instantiate_type): Check fnptr_conv_p. (resolve_address_of_overloaded_function): Likewise. * cvt.c (can_convert_tx_safety): Now static. (noexcept_conv_p, fnptr_conv_p, strip_fnptr_conv): New. * decl.c (flag_noexcept_type): Define. (cxx_init_decl_processing): Set it. (bad_specifiers): Check it. (grokdeclarator) [cdk_function]: Add exception-spec to type here. * lambda.c (maybe_add_lambda_conv_op): Add exception-spec to returned pointer. * mangle.c (struct globals): Add need_cxx1z_warning. (mangle_decl): Check it. (write_exception_spec): New. (write_function_type): Call it. (canonicalize_for_substitution): Handle exception spec. (write_type): Likewise. (write_encoding): Set processing_template_decl across mangling of partially-instantiated type. * pt.c (determine_specialization): Pass tf_fndecl_type. (tsubst_decl, fn_type_unification): Likewise. (tsubst): Strip tf_fndecl_type, pass it to tsubst_exception_specification. (convert_nontype_argument_function): Handle function pointer conversion. (convert_nontype_argument): Likewise. (unify, for_each_template_parm_r): Walk into noexcept-specifier. * rtti.c (ptr_initializer): Encode noexcept. * tree.c (canonical_eh_spec): New. (build_exception_variant): Use it. * typeck.c (composite_pointer_type): Handle fnptr conversion. (comp_except_specs): Compare canonical EH specs. (structural_comptypes): Call it. gcc/c-family/ * c.opt (Wc++1z-compat): New. * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_noexcept_function_type. libstdc++-v3/ * include/bits/c++config (_GLIBCXX_NOEXCEPT_PARM) (_GLIBCXX_NOEXCEPT_QUAL): New. * include/std/type_traits (is_function): Use them. * libsubc++/new (launder): Likewise. * libsupc++/cxxabi.h (__pbase_type_info::__masks): Add __noexcept_mask. * libsupc++/pbase_type_info.cc (__do_catch): Handle function pointer conversion. libiberty/ * cp-demangle.c (is_fnqual_component_type): New. (d_encoding, d_print_comp_inner, d_print_mod_list): Use it. (FNQUAL_COMPONENT_CASE): New. (d_make_comp, has_return_type, d_print_comp_inner) (d_print_function_type): Use it. (next_is_type_qual): New. (d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec. include/ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC. From-SVN: r241944
2016-11-08 00:09:29 +01:00
extern bool fnptr_conv_p (tree, tree);
extern tree strip_fnptr_conv (tree);
1994-02-24 02:02:37 +01:00
/* in name-lookup.c */
extern tree pushdecl (tree);
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
extern tree pushdecl_maybe_friend (tree, bool);
extern void maybe_push_cleanup_level (tree);
extern tree pushtag (tree, tree, tag_scope);
extern tree make_anon_name (void);
extern tree pushdecl_top_level_maybe_friend (tree, bool);
extern tree pushdecl_top_level_and_finish (tree, tree);
extern tree check_for_out_of_scope_variable (tree);
Add uniform debug dump function names. Add some overloaded functions that provide uniform debug dump function names. These names are: debug: the general debug dumper debug_verbose: for more details debug_raw: for the gory details debug_head: for the heads of declarations, e.g. function heads debug_body: for the bodies of declarations, e.g. function bodies Not all types have the last four versions. The debug functions come in two flavors, those that take pointers to the type, and those that take references to the type. The first handles printing of '<nil>' for null pointers. The second assumes a valid reference, and prints the content. Example uses are as follows: cp_token t, *p; debug (t); debug (p); From the debugger, use call debug (t) The functions sets implemented are: debug (only) basic_block_def, const bitmap_head_def, cp_binding_level, cp_parser, cp_token, data_reference, die_struct, edge_def, gimple_statement_d, ira_allocno, ira_allocno_copy, live_range, lra_live_range, omega_pb_d, pt_solution, const rtx_def, sreal, tree_live_info_d, _var_map, vec<cp_token, va_gc>, vec<data_reference_p>, vec<ddr_p>, vec<rtx>, vec<tree, va_gc>, debug and debug_raw simple_bitmap_def debug and debug_verbose expr_def, struct loop, vinsn_def debug, debug_raw, debug_verbose, debug_head, debug_body const tree_node This patch is somewhat different from the original plan at gcc.gnu.org/wiki/cxx-conversion/debugging-dumps. The reason is that gdb has an incomplete implementation of C++ call syntax; requiring explicit specification of template arguments and explicit specification of function arguments even when they have default values. So, the original plan would have required typing call dump <cp_token> (t, 0, 0, stderr) which is undesireable. Instead instead of templates, we overload plain functions. This adds a small burden of manually adding the pointer version of dump for each type. Instead of default function arguments, we simply assume the default values. Most of the underlying dump functions did not use the options and indent parameters anyway. Several provide FILE* parameters, but we expect debugging to use stderr anyway. So, the explicit specification of arguments was not as valuable as we thought initially. Finally, a change of name from dump to debug reflect the implicit output to stderr. Index: gcc/ChangeLog 2013-03-28 Lawrence Crowl <crowl@google.com> * Makefile.in: Add several missing include dependences. (DUMPFILE_H): New. (test-dump.o): New. This object is not added to any executable, but is present for ad-hoc testing. * bitmap.c (debug (const bitmap_head_def &)): New. (debug (const bitmap_head_def *)): New. * bitmap.h (extern debug (const bitmap_head_def &)): New. (extern debug (const bitmap_head_def *)): New. * cfg.c (debug (edge_def &)): New. (debug (edge_def *)): New. * cfghooks.c (debug (basic_block_def &)): New. (debug (basic_block_def *)): New. * dumpfile.h (dump_node (const_tree, int, FILE *)): Correct source file. * dwarf2out.c (debug (die_struct &)): New. (debug (die_struct *)): New. * dwarf2out.h (extern debug (die_struct &)): New. (extern debug (die_struct *)): New. * gimple-pretty-print.c (debug (gimple_statement_d &)): New. (debug (gimple_statement_d *)): New. * gimple-pretty-print.h (extern debug (gimple_statement_d &)): New. (extern debug (gimple_statement_d *)): New. * ira-build.c (debug (ira_allocno_copy &)): New. (debug (ira_allocno_copy *)): New. (debug (ira_allocno &)): New. (debug (ira_allocno *)): New. * ira-int.h (extern debug (ira_allocno_copy &)): New. (extern debug (ira_allocno_copy *)): New. (extern debug (ira_allocno &)): New. (extern debug (ira_allocno *)): New. * ira-lives.c (debug (live_range &)): New. (debug (live_range *)): New. * lra-int.h (debug (lra_live_range &)): New. (debug (lra_live_range *)): New. * lra-lives.c (debug (lra_live_range &)): New. (debug (lra_live_range *)): New. * omega.c (debug (omega_pb_d &)): New. (debug (omega_pb_d *)): New. * omega.h (extern debug (omega_pb_d &)): New. (extern debug (omega_pb_d *)): New. * print-rtl.c (debug (const rtx_def &)): New. (debug (const rtx_def *)): New. * print-tree.c (debug_tree (tree): Move within file. (debug_raw (const tree_node &)): New. (debug_raw (const tree_node *)): New. (dump_tree_via_hooks (const tree_node *, int)): New. (debug (const tree_node &)): New. (debug (const tree_node *)): New. (debug_verbose (const tree_node &)): New. (debug_verbose (const tree_node *)): New. (debug_head (const tree_node &)): New. (debug_head (const tree_node *)): New. (debug_body (const tree_node &)): New. (debug_body (const tree_node *)): New. (debug_vec_tree (tree): Move and reimplement in terms of dump. (debug (vec<tree, va_gc> &)): New. (debug (vec<tree, va_gc> *)): New. * rtl.h (extern debug (const rtx_def &)): New. (extern debug (const rtx_def *)): New. * sbitmap.c (debug_raw (simple_bitmap_def &)): New. (debug_raw (simple_bitmap_def *)): New. (debug (simple_bitmap_def &)): New. (debug (simple_bitmap_def *)): New. * sbitmap.h (extern debug (simple_bitmap_def &)): New. (extern debug (simple_bitmap_def *)): New. (extern debug_raw (simple_bitmap_def &)): New. (extern debug_raw (simple_bitmap_def *)): New. * sel-sched-dump.c (debug (vinsn_def &)): New. (debug (vinsn_def *)): New. (debug_verbose (vinsn_def &)): New. (debug_verbose (vinsn_def *)): New. (debug (expr_def &)): New. (debug (expr_def *)): New. (debug_verbose (expr_def &)): New. (debug_verbose (expr_def *)): New. (debug (vec<rtx> &)): New. (debug (vec<rtx> *)): New. * sel-sched-dump.h (extern debug (vinsn_def &)): New. (extern debug (vinsn_def *)): New. (extern debug_verbose (vinsn_def &)): New. (extern debug_verbose (vinsn_def *)): New. (extern debug (expr_def &)): New. (extern debug (expr_def *)): New. (extern debug_verbose (expr_def &)): New. (extern debug_verbose (expr_def *)): New. (extern debug (vec<rtx> &)): New. (extern debug (vec<rtx> *)): New. * sel-sched-ir.h (_list_iter_cond_expr): Make inline instead of static. * sreal.c (debug (sreal &)): New. (debug (sreal *)): New. * sreal.h (extern debug (sreal &)): New. (extern debug (sreal *)): New. * tree.h (extern debug_raw (const tree_node &)): New. (extern debug_raw (const tree_node *)): New. (extern debug (const tree_node &)): New. (extern debug (const tree_node *)): New. (extern debug_verbose (const tree_node &)): New. (extern debug_verbose (const tree_node *)): New. (extern debug_head (const tree_node &)): New. (extern debug_head (const tree_node *)): New. (extern debug_body (const tree_node &)): New. (extern debug_body (const tree_node *)): New. (extern debug (vec<tree, va_gc> &)): New. (extern debug (vec<tree, va_gc> *)): New. * tree-cfg.c (debug (struct loop &)): New. (debug (struct loop *)): New. (debug_verbose (struct loop &)): New. (debug_verbose (struct loop *)): New. * tree-dump.c: Add header dependence. * tree-flow.h (extern debug (struct loop &)): New. (extern debug (struct loop *)): New. (extern debug_verbose (struct loop &)): New. (extern debug_verbose (struct loop *)): New. * tree-data-ref.c (debug (data_reference &)): New. (debug (data_reference *)): New. (debug (vec<data_reference_p> &)): New. (debug (vec<data_reference_p> *)): New. (debug (vec<ddr_p> &)): New. (debug (vec<ddr_p> *)): New. * tree-data-ref.h (extern debug (data_reference &)): New. (extern debug (data_reference *)): New. (extern debug (vec<data_reference_p> &)): New. (extern debug (vec<data_reference_p> *)): New. (extern debug (vec<ddr_p> &)): New. (extern debug (vec<ddr_p> *)): New. * tree-ssa-alias.c (debug (pt_solution &)): New. (debug (pt_solution *)): New. * tree-ssa-alias.h (extern debug (pt_solution &)): New. (extern debug (pt_solution *)): New. * tree-ssa-alias.c (debug (_var_map &)): New. (debug (_var_map *)): New. (debug (tree_live_info_d &)): New. (debug (tree_live_info_d *)): New. * tree-ssa-alias.h (extern debug (_var_map &)): New. (extern debug (_var_map *)): New. (extern debug (tree_live_info_d &)): New. (extern debug (tree_live_info_d *)): New. Index: gcc/cp/ChangeLog 2013-03-28 Lawrence Crowl <crowl@google.com> * Make-lang.in (CXX_PARSER_H): Add header dependence. * cp-tree.h (extern debug (cp_binding_level &)): New. (extern debug (cp_binding_level *)): New. * name-lookup.h (debug (cp_binding_level &)): New. (debug (cp_binding_level *)): New. * parser.c (debug (cp_parser &)): New. (debug (cp_parser *)): New. (debug (cp_token &)): New. (debug (cp_token *)): New. (debug (vec<cp_token, va_gc> &)): New. (debug (vec<cp_token, va_gc> *)): New. * parser.c: Add header dependence. (extern debug (cp_parser &)): New. (extern debug (cp_parser *)): New. (extern debug (cp_token &)): New. (extern debug (cp_token *)): New. (extern debug (vec<cp_token, va_gc> &)): New. (extern debug (vec<cp_token, va_gc> *)): New. From-SVN: r197224
2013-03-29 04:42:21 +01:00
extern void dump (cp_binding_level &ref);
extern void dump (cp_binding_level *ptr);
extern void print_other_binding_stack (cp_binding_level *);
extern tree maybe_push_decl (tree);
extern tree current_decl_namespace (void);
/* decl.c */
extern tree poplevel (int, int, int);
extern void cxx_init_decl_processing (void);
enum cp_tree_node_structure_enum cp_tree_node_structure
(union lang_tree_node *);
extern void finish_scope (void);
extern void push_switch (tree);
extern void pop_switch (void);
extern tree make_lambda_name (void);
extern int decls_match (tree, tree);
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
extern tree duplicate_decls (tree, tree, bool);
extern tree declare_local_label (tree);
extern tree define_label (location_t, tree);
extern void check_goto (tree);
extern bool check_omp_return (void);
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
extern tree make_typename_type (tree, tree, enum tag_types, tsubst_flags_t);
extern tree make_unbound_class_template (tree, tree, tree, tsubst_flags_t);
class.c (build_vtbl_initializer): Make __cxa_deleted_virtual ECF_NORETURN | ECF_LEAF * class.c (build_vtbl_initializer): Make __cxa_deleted_virtual ECF_NORETURN | ECF_LEAF * cp-tree.h (build_library_fn_ptr, build_cp_library_fn_ptr, push_library_fn, push_void_library_fn): Update prototype. * decl.c (build_library_fn_1): Remove. (push_cp_library_fn, build_cp_library_fn): Update to take ECF flags. (cxx_init_decl_processing): Update; global_delete_fndecl is ECF_NOTROW; __cxa_pure_virtual is ECF_NORETURN | ECF_NORETURN | ECF_LEAF. (build_library_fn_1): Add ecf_flags argument; rename to ... (build_library_fn): ... this one. (build_cp_library_fn): Take ecf_flags; do not copy NOTHROW flag. (build_library_fn_ptr): Take ecf_flags. (build_cp_library_fn_ptr): Likewise. (push_library_fn): Likewise. (push_cp_library_fn): Likewise. (push_void_library_fn): Likewise. (push_throw_library_fn): All throws are ECF_NORETURN. (__cxa_atexit, __cxa_thread_atexit): Add ECF_LEAF | ECF_NOTHROW attributes. (expand_static_init): __cxa_guard_acquire, __cxa_guard_release, __cxa_guard_abort are ECF_NOTHROW | ECF_LEAF. * except.c (init_exception_processing): terminate is ECF_NOTHROW | ECF_NORETURN | ECF_LEAF. (declare_nothrow_library_fn): Add ecf_flags parameter. (__cxa_get_exception_ptr): Is ECF_NOTHROW | ECF_PURE | ECF_LEAF | ECF_TM_PURE. (do_begin_catch): cxa_begin_catch and _ITM_cxa_begin_catch are ECF_NOTHROW | ECF_LEAF. (do_end_catch): __cxa_end_catch and _ITM_cxa_end_catch is ECF_LEAF. (do_allocate_exception): _cxa_allocate_exception and _ITM_cxa_allocate_exception are ECF_NOTHROW | ECF_MALLOC | ECF_LEAF (do_free_exception): __cxa_free_exception is ECF_NOTHROW | ECF_LEAF. * rtti.c (build_dynamic_cast_1): __dynamic_cast is ECF_LEAF | ECF_PURE | ECF_NOTHROW. From-SVN: r202099
2013-08-30 10:14:37 +02:00
extern tree build_library_fn_ptr (const char *, tree, int);
extern tree build_cp_library_fn_ptr (const char *, tree, int);
extern tree push_library_fn (tree, tree, tree, int);
extern tree push_void_library_fn (tree, tree, int);
extern tree push_throw_library_fn (tree, tree);
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
extern void warn_misplaced_attr_for_class_type (source_location location,
tree class_type);
extern tree check_tag_decl (cp_decl_specifier_seq *, bool);
Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. * Make-lang.in (cp/lex.o): Do not depend on cp/lex.h. (cp/decl.o): Likewise. (cp/decl2.o): Likewise. (cp/pt.o): Likewise. (cp/semantics.o): Likewise. * config-lang.in (gtfiles): Do not reference cp/lex.h. * class.c: Do not include lex.h. (add_implicitly_declared_members): Do not use adding_implicit_members. (check_bases_and_members): Do not talk about grok_x_components. * cp/cp-tree.h (adding_implicit_members): Remove. (cp_storage_class): New type. (cp_decl_spec): Likewise. (cp_decl_specifier_seq): Likewise. (cp_parameter_declarator): Use it for the decl_specifiers field. (check_tag_decl): Adjust prototype. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (start_function): Likewise. (start_method): Likewise. (grok_x_components): Remove. (grokfield): Adjust prototype. (grokbitfield): Likewise. (finish_member_class_template): Remove. * decl.c: Do not include lex.h. (adding_implicit_members): Do not define. (check_tag_decl): Do not use trees to represent decl-specifiers. (shadow_tag): Likewise. (groktypename): Likewise. (start_decl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. * decl.h (grokdeclarator): Adjust prototype. * decl2.c: Do not include lex.h. (grok_x_components): Remove. (grokfield): Do not use trees to represent decl-specifiers. (grokbitfield): Likewise. * lex.c: Do not include lex.h. * lex.h: Remove. * parser.c: Include target.h. (clear_decl_specs): New function. (cp_parser_translation_unit): Do not use trees to represent decl-specifiers. (cp_parser_postfix_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_condition): Likewise. (cp_parser_simple_declaration): Likewise. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_type_specifier_seq): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_save_member_function_body): Likewise. (cp_parser_friend_p): Likewise. (cp_parser_set_storage_class): New function. (cp_parser_set_decl_spec_type): Likewise. * pt.c: Do not include lex.h. * semantics.c: Likewise. (finish_member_class_template): Remove. From-SVN: r83584
2004-06-24 08:48:44 +02:00
extern tree shadow_tag (cp_decl_specifier_seq *);
extern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *, bool);
extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *);
extern void start_decl_1 (tree, bool);
extern bool check_array_initializer (tree, tree, tree);
re PR c++/26266 (Trouble with static const data members in template classes) PR c++/26266 * cp-tree.h (cp_finish_decl): Adjust declaration. (grokbitfield): Likewise. (finish_static_data_member_decl): Likewise. * init.c (constant_value_1): Ensure processing_template_decl when folding non-dependent initializers for static data members of dependent types. Return error_mark_node for erroneous initailizers. * class.c (get_vtable_decl): Use finish_decl, not cp_finish_decl. * decl.c (cp_make_fname_decl): Adjust call to cp_finish_decl. (cp_finish_decl): Add init_const_expr_p parameter. Set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (finish_decl): Adjust call to cp_finish_decl. (compute_array_index_type): Robustify. (start_method): Use finish_decl, not cp_finish_decl. * rtti.c (emit_tinfo_decl): Likewise. * except.c (initialize_handler_parm): Adjust call to cp_finish_decl. (expand_start_catch_block): Likewise. * cvt.c (build_up_reference): Adjust call to cp_finish_decl. * pt.c (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_expr): Use finish_decl, not cp_finish_decl. (instantiate_decl): Adjust call to cp_finish_decl. * name-lookup.c (pushdecl_top_level_1): Use finish_decl, not cp_finish_decl. * decl2.c (finish_static_data_member_decl): Add init_const_expr_p parameter. (grokfield): Likewise. * parser.c (cp_parser_condition): Check for constant initializers. (cp_parser_init_declarator): Adjust calls to grokfield and cp_finish_decl. Don't set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (cp_parser_member_declaration): Likewise. (cp_parser_objc_class_ivars): Likewise. PR c++/26266 * g++.dg/template/static22.C: New test. * g++.dg/template/static23.C: New test. * g++.dg/template/static24.C: New test. * g++.dg/template/non-dependent13.C: New test. From-SVN: r111229
2006-02-18 09:36:11 +01:00
extern void cp_finish_decl (tree, tree, bool, tree, int);
extern tree lookup_decomp_type (tree);
extern void cp_maybe_mangle_decomp (tree, tree, unsigned int);
Implement P0217R3 - C++17 structured bindings gcc/ * match.pd: Don't try to compare addresses of variables with DECL_VALUE_EXPR. gcc/cp/ * cp-tree.h (struct lang_decl_base): Add decomposition_p. (DECL_DECOMPOSITION_P): New (enum auto_deduction_context): Add adc_decomp_type. (enum cp_declarator_kind): Add cdk_decomp. * constexpr.c (cxx_eval_constant_expression): Look through DECL_VALUE_EXPR. (potential_constant_expression_1): Likewise. * decl.c (reshape_init): Preserve CONSTRUCTOR_IS_DIRECT_INIT. (check_initializer): Use build_aggr_init for DECL_DECOMPOSITION_P. (cp_finish_decl): Pass adc_decomp_type for decomposition. (find_decomp_class_base, get_tuple_size, get_tuple_element_type) (get_tuple_decomp_init, cp_finish_decomp): New. (grokdeclarator): Handle decomposition. * init.c (build_aggr_init): Handle decomposition array. (build_vec_init): Handle initialization from { array }. * name-lookup.c (add_function): Always wrap TEMPLATE_DECL in OVERLOAD. * parser.c (declarator_can_be_parameter_pack): Handle cdk_decomp. (function_declarator_p, strip_declarator_types) (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_range_for, cp_convert_range_for): Handle decomposition. (cp_parser_simple_declaration): Parse decomposition. (cp_parser_decomposition_declaration): New. * pt.c (tsubst_decomp_names): New. (subst_expr) [DECL_EXPR, RANGE_FOR_STMT]: Handle decomposition. (do_auto_deduction): Handle adc_decomp_type. * semantics.c (finish_decltype_type): Look through DECL_VALUE_EXPR. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. * tree.c (lvalue_kind): Likewise. (cp_build_reference_type): Handle reference collapsing. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r242377
2016-11-14 06:02:58 +01:00
extern void cp_finish_decomp (tree, tree, unsigned int);
extern int cp_complete_array_type (tree *, tree, bool);
extern int cp_complete_array_type_or_error (tree *, tree, bool, tsubst_flags_t);
extern tree build_ptrmemfunc_type (tree);
extern tree build_ptrmem_type (tree, tree);
/* the grokdeclarator prototype is in decl.h */
2006-06-06 13:44:09 +02:00
extern tree build_this_parm (tree, cp_cv_quals);
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
extern tree grokparms (tree, tree *);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int copy_fn_p (const_tree);
extern bool move_fn_p (const_tree);
extern bool move_signature_fn_p (const_tree);
extern tree get_scope_of_declarator (const cp_declarator *);
extern void grok_special_member_properties (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int grok_ctor_properties (const_tree, const_tree);
extern bool grok_op_properties (tree, bool);
extern tree xref_tag (enum tag_types, tree, tag_scope, bool);
extern tree xref_tag_from_type (tree, tree, tag_scope);
extern void xref_basetypes (tree, tree);
extern tree start_enum (tree, tree, tree, tree, bool, bool *);
extern void finish_enum_value_list (tree);
extern void finish_enum (tree);
extern void build_enumerator (tree, tree, tree, tree, location_t);
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
extern tree lookup_enumerator (tree, tree);
extern bool start_preparsed_function (tree, tree, int);
extern bool start_function (cp_decl_specifier_seq *,
const cp_declarator *, tree);
extern tree begin_function_body (void);
extern void finish_function_body (tree);
c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. * langhooks.h (struct lang_hooks_for_decls): Add omp_finish_clause. Add omp_private_outer_ref hook, add another argument to omp_clause_default_ctor hook. * langhooks-def.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define. (LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define. (LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR): Change to hook_tree_tree_tree_tree_null. (LANG_HOOKS_DECLS): Add LANG_HOOKS_OMP_FINISH_CLAUSE and LANG_HOOKS_OMP_PRIVATE_OUTER_REF. * hooks.c (hook_tree_tree_tree_tree_null): New function. * hooks.h (hook_tree_tree_tree_tree_null): New prototype. * tree.def (OMP_TASK): New tree code. * tree.h (OMP_TASK_COPYFN, OMP_TASK_ARG_SIZE, OMP_TASK_ARG_ALIGN, OMP_CLAUSE_PRIVATE_OUTER_REF, OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_COLLAPSE_ITERVAR, OMP_CLAUSE_COLLAPSE_COUNT, OMP_TASKREG_CHECK, OMP_TASKREG_BODY, OMP_TASKREG_CLAUSES, OMP_TASKREG_FN, OMP_TASKREG_DATA_ARG, OMP_TASK_BODY, OMP_TASK_CLAUSES, OMP_TASK_FN, OMP_TASK_DATA_ARG, OMP_CLAUSE_COLLAPSE_EXPR): Define. (enum omp_clause_default_kind): Add OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. (OMP_DIRECTIVE_P): Add OMP_TASK. (OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): New clause codes. (OMP_CLAUSE_SCHEDULE_AUTO): New schedule kind. * tree.c (omp_clause_code_name): Add OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED entries. (omp_clause_num_ops): Likewise. Increase OMP_CLAUSE_LASTPRIVATE num_ops to 2. (walk_tree_1): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Walk OMP_CLAUSE_LASTPRIVATE_STMT. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_SCHEDULE_AUTO, OMP_CLAUSE_UNTIED, OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. (dump_generic_node): Handle OMP_TASK and collapsed OMP_FOR loops. * c-omp.c (c_finish_omp_for): Allow pointer iterators. Remove warning about unsigned iterators. Change decl/init/cond/incr arguments to TREE_VECs, check arguments for all collapsed loops. (c_finish_omp_taskwait): New function. (c_split_parallel_clauses): Put OMP_CLAUSE_COLLAPSE clause to ws_clauses. * c-parser.c (c_parser_omp_for_loop): Parse collapsed loops. Call default_function_array_conversion on init. Add par_clauses argument. If decl is present in parallel's lastprivate clause, change it to shared and add lastprivate clause for decl to OMP_FOR_CLAUSES. Add clauses argument, on success set OMP_FOR_CLAUSES to it. Look up collapse count in clauses. (c_parser_omp_for, c_parser_omp_parallel): Adjust c_parser_omp_for_loop callers. (OMP_FOR_CLAUSE_MASK): Add 1 << PRAGMA_OMP_CLAUSE_COLLAPSE. (c_parser_pragma): Handle PRAGMA_OMP_TASKWAIT. (c_parser_omp_clause_name): Handle collapse and untied clauses. (c_parser_omp_clause_collapse, c_parser_omp_clause_untied): New functions. (c_parser_omp_clause_schedule): Handle schedule(auto). Include correct location in the error message. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE and PRAGMA_OMP_CLAUSE_UNTIED. (OMP_TASK_CLAUSE_MASK): Define. (c_parser_omp_task, c_parser_omp_taskwait): New functions. (c_parser_omp_construct): Handle PRAGMA_OMP_TASK. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Handle OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_REDUCTION_INIT, OMP_CLAUSE_REDUCTION_MERGE, OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Don't handle TREE_STATIC or DECL_EXTERNAL VAR_DECLs in OMP_CLAUSE_DECL. (conver_nonlocal_reference, convert_local_reference, convert_call_expr): Handle OMP_TASK the same as OMP_PARALLEL. Use OMP_TASKREG_* macros rather than OMP_PARALLEL_*. (walk_omp_for): Adjust for OMP_FOR_{INIT,COND,INCR} changes. * tree-gimple.c (is_gimple_stmt): Handle OMP_TASK. * c-tree.h (c_begin_omp_task, c_finish_omp_task): New prototypes. * c-pragma.h (PRAGMA_OMP_TASK, PRAGMA_OMP_TASKWAIT): New. (PRAGMA_OMP_CLAUSE_COLLAPSE, PRAGMA_OMP_CLAUSE_UNTIED): New. * c-typeck.c (c_begin_omp_task, c_finish_omp_task): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. * c-pragma.c (init_pragma): Init omp task and omp taskwait pragmas. * c-common.h (c_finish_omp_taskwait): New prototype. * gimple-low.c (lower_stmt): Handle OMP_TASK. * tree-parloops.c (create_parallel_loop): Create 1 entry vectors for OMP_FOR_{INIT,COND,INCR}. * tree-cfg.c (remove_useless_stmts_1): Handle OMP_* containers. (make_edges): Handle OMP_TASK. * tree-ssa-operands.c (get_expr_operands): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. * tree-inline.c (estimate_num_insns_1): Handle OMP_TASK. * builtin-types.def (BT_PTR_ULONGLONG, BT_PTR_FN_VOID_PTR_PTR, BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New. * omp-builtins.def (BUILT_IN_GOMP_TASK, BUILT_IN_GOMP_TASKWAIT, BUILT_IN_GOMP_LOOP_ULL_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_STATIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_RUNTIME_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): New builtins. * gimplify.c (gimplify_omp_for): Allow pointer type for decl, handle POINTER_PLUS_EXPR. If loop counter has been replaced and original iterator is present in lastprivate clause or if collapse > 1, set OMP_CLAUSE_LASTPRIVATE_STMT. Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. (gimplify_expr): Handle OMP_SECTIONS_SWITCH and OMP_TASK. (enum gimplify_omp_var_data): Add GOVD_PRIVATE_OUTER_REF. (omp_notice_variable): Set GOVD_PRIVATE_OUTER_REF if needed, if it is set, lookup var in outer contexts too. Handle OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. Handle vars that are supposed to be implicitly determined firstprivate for task regions. (gimplify_scan_omp_clauses): Set GOVD_PRIVATE_OUTER_REF if needed, if it is set, lookup var in outer contexts too. Set OMP_CLAUSE_PRIVATE_OUTER_REF if GOVD_PRIVATE_OUTER_REF is set. Handle OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Take region_type as last argument instead of in_parallel and in_combined_parallel. (gimplify_omp_parallel, gimplify_omp_for, gimplify_omp_workshare): Adjust callers. (gimplify_adjust_omp_clauses_1): Set OMP_CLAUSE_PRIVATE_OUTER_REF if GOVD_PRIVATE_OUTER_REF is set. Call omp_finish_clause langhook. (new_omp_context): Set default_kind to OMP_CLAUSE_DEFAULT_UNSPECIFIED for OMP_TASK regions. (omp_region_type): New enum. (struct gimplify_omp_ctx): Remove is_parallel and is_combined_parallel fields, add region_type. (new_omp_context): Take region_type as argument instead of is_parallel and is_combined_parallel. (gimple_add_tmp_var, omp_firstprivatize_variable, omp_notice_variable, omp_is_private, omp_check_private): Adjust ctx->is_parallel and ctx->is_combined_parallel checks. (gimplify_omp_task): New function. (gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. * omp-low.c (extract_omp_for_data): Use schedule(static) for schedule(auto). Handle pointer and unsigned iterators. Compute fd->iter_type. Handle POINTER_PLUS_EXPR increments. Add loops argument. Extract data for collapsed OMP_FOR loops. (expand_parallel_call): Assert sched_kind isn't auto, map runtime schedule to index 3. (struct omp_for_data_loop): New type. (struct omp_for_data): Remove v, n1, n2, step, cond_code fields. Add loop, loops, collapse and iter_type fields. (workshare_safe_to_combine_p): Disallow combined for if iter_type is unsigned long long. Don't combine collapse > 1 loops unless all bounds and steps are constant. Adjust extract_omp_for_data caller. (expand_omp_for_generic): Handle pointer, unsigned and long long iterators. Handle collapsed OMP_FOR loops. Adjust for struct omp_for_data changes. If libgomp function doesn't return boolean_type_node, add comparison of the return value with 0. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle pointer, unsigned and long long iterators. Adjust for struct omp_for_data changes. (expand_omp_for): Assert sched_kind isn't auto, map runtime schedule to index 3. Use GOMP_loop_ull*{start,next} if iter_type is unsigned long long. Allocate loops array, pass it to extract_omp_for_data. For collapse > 1 loops use always expand_omp_for_generic. (omp_context): Add sfield_map and srecord_type fields. (is_task_ctx, lookup_sfield): New functions. (use_pointer_for_field): Use is_task_ctx helper. Change first argument's type from const_tree to tree. Clarify comment. In OMP_TASK disallow copy-in/out sharing. (build_sender_ref): Call lookup_sfield instead of lookup_field. (install_var_field): Add mask argument. Populate both record_type and srecord_type if needed. (delete_omp_context): Destroy sfield_map, clear DECL_ABSTRACT_ORIGIN in srecord_type. (fixup_child_record_type): Also remap FIELD_DECL's DECL_SIZE{,_UNIT} and DECL_FIELD_OFFSET. (scan_sharing_clauses): Adjust install_var_field callers. For firstprivate clauses on explicit tasks allocate the var by value in record_type unconditionally, rather than by reference. Handle OMP_CLAUSE_PRIVATE_OUTER_REF. Scan OMP_CLAUSE_LASTPRIVATE_STMT. Use is_taskreg_ctx instead of is_parallel_ctx. Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. (create_omp_child_function_name): Add task_copy argument, use *_omp_cpyfn* names if it is true. (create_omp_child_function): Add task_copy argument, if true create *_omp_cpyfn* helper function. (scan_omp_parallel): Adjust create_omp_child_function callers. Rename parallel_nesting_level to taskreg_nesting_level. (scan_omp_task): New function. (lower_rec_input_clauses): Don't run constructors for firstprivate explicit task vars which are initialized by *_omp_cpyfn*. Pass outer var ref to omp_clause_default_ctor hook if OMP_CLAUSE_PRIVATE_OUTER_REF or OMP_CLAUSE_LASTPRIVATE. Replace OMP_CLAUSE_REDUCTION_PLACEHOLDER decls in OMP_CLAUSE_REDUCTION_INIT. (lower_send_clauses): Clear DECL_ABSTRACT_ORIGIN if in task to avoid duplicate setting of fields. Handle OMP_CLAUSE_PRIVATE_OUTER_REF. (lower_send_shared_vars): Use srecord_type if non-NULL. Don't copy-out if TREE_READONLY, only copy-in. (expand_task_copyfn): New function. (expand_task_call): New function. (struct omp_taskcopy_context): New type. (task_copyfn_copy_decl, task_copyfn_remap_type, create_task_copyfn): New functions. (lower_omp_parallel): Rename to... (lower_omp_taskreg): ... this. Use OMP_TASKREG_* macros where needed. Call create_task_copyfn if srecord_type is needed. Adjust sender_decl type. (task_shared_vars): New variable. (check_omp_nesting_restrictions): Warn if work-sharing, barrier, master or ordered region is closely nested inside OMP_TASK. Add warnings for barrier if closely nested inside of work-sharing, ordered, or master region. (scan_omp_1): Call check_omp_nesting_restrictions even for GOMP_barrier calls. Rename parallel_nesting_level to taskreg_nesting_level. Handle OMP_TASK. (lower_lastprivate_clauses): Even if some lastprivate is found on a work-sharing construct, continue looking for them on parent parallel construct. (lower_omp_for_lastprivate): Add lastprivate clauses to the beginning of dlist rather than end. Adjust for struct omp_for_data changes. (lower_omp_for): Add rec input clauses before OMP_FOR_PRE_BODY, not after it. Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes, adjust extract_omp_for_data caller. (get_ws_args_for): Adjust extract_omp_for_data caller. (scan_omp_for): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. (lower_omp_single_simple): If libgomp function doesn't return boolean_type_node, add comparison of the return value with 0. (diagnose_sb_1, diagnose_sb_2): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. Handle OMP_TASK. (parallel_nesting_level): Rename to... (taskreg_nesting_level): ... this. (is_taskreg_ctx): New function. (build_outer_var_ref, omp_copy_decl): Use is_taskreg_ctx instead of is_parallel_ctx. (execute_lower_omp): Rename parallel_nesting_level to taskreg_nesting_level. (expand_omp_parallel): Rename to... (expand_omp_taskreg): ... this. Use OMP_TASKREG_* macros where needed. Call omp_task_call for OMP_TASK regions. (expand_omp): Adjust caller, handle OMP_TASK. (lower_omp_1): Adjust lower_omp_taskreg caller, handle OMP_TASK. * bitmap.c (bitmap_default_obstack_depth): New variable. (bitmap_obstack_initialize, bitmap_obstack_release): Do nothing if argument is NULL and bitmap_default_obstack is already initialized. * ipa-struct-reorg.c (do_reorg_1): Call bitmap_obstack_release at the end. * matrix-reorg.c (matrix_reorg): Likewise. cp/ * cp-tree.h (cxx_omp_finish_clause, cxx_omp_create_clause_info, dependent_omp_for_p, begin_omp_task, finish_omp_task, finish_omp_taskwait): New prototypes. (cxx_omp_clause_default_ctor): Add outer argument. (finish_omp_for): Add new clauses argument. * cp-gimplify.c (cxx_omp_finish_clause): New function. (cxx_omp_predetermined_sharing): Moved from semantics.c, rewritten. (cxx_omp_clause_default_ctor): Add outer argument. (cp_genericize_r): Walk OMP_CLAUSE_LASTPRIVATE_STMT. * cp-objcp-common.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define. * parser.c (cp_parser_omp_for_loop): Parse collapsed for loops. Add par_clauses argument. If decl is present in parallel's lastprivate clause, change that clause to shared and add a lastprivate clause for decl to OMP_FOR_CLAUSES. Fix wording of error messages. Adjust finish_omp_for caller. Add clauses argument. Parse loops with random access iterators. (cp_parser_omp_clause_collapse, cp_parser_omp_clause_untied): New functions. (cp_parser_omp_for, cp_parser_omp_parallel): Adjust cp_parser_omp_for_loop callers. (cp_parser_omp_for_cond, cp_parser_omp_for_incr): New helper functions. (cp_parser_omp_clause_name): Handle collapse and untied clauses. (cp_parser_omp_clause_schedule): Handle auto schedule. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE and PRAGMA_OMP_CLAUSE_UNTIED. (OMP_FOR_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_COLLAPSE. (OMP_TASK_CLAUSE_MASK): Define. (cp_parser_omp_task, cp_parser_omp_taskwait): New functions. (cp_parser_omp_construct): Handle PRAGMA_OMP_TASK. (cp_parser_pragma): Handle PRAGMA_OMP_TASK and PRAGMA_OMP_TASKWAIT. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Handle OMP_CLAUSE_LASTPRIVATE_STMT. (tsubst_omp_for_iterator): New function. (dependent_omp_for_p): New function. (tsubst_expr) <case OMP_FOR>: Use it. Handle collapsed OMP_FOR loops. Adjust finish_omp_for caller. Handle loops with random access iterators. Adjust for OMP_FOR_{INIT,COND,INCR} changes. (tsubst_expr): Handle OMP_TASK. * semantics.c (cxx_omp_create_clause_info): New function. (finish_omp_clauses): Call it. Handle OMP_CLAUSE_UNTIED and OMP_CLAUSE_COLLAPSE. (cxx_omp_predetermined_sharing): Removed. * semantics.c (finish_omp_for): Allow pointer iterators. Use handle_omp_for_class_iterator and dependent_omp_for_p. Handle collapsed for loops. Adjust c_finish_omp_for caller. Add new clauses argument. Fix check for type dependent cond or incr. Set OMP_FOR_CLAUSES to clauses. Use cp_convert instead of fold_convert to convert incr amount to difference_type. Only fold if not in template. If decl is mentioned in lastprivate clause, set OMP_CLAUSE_LASTPRIVATE_STMT. Handle loops with random access iterators. Adjust for OMP_FOR_{INIT,COND,INCR} changes. (finish_omp_threadprivate): Allow static class members of the current class. (handle_omp_for_class_iterator, begin_omp_task, finish_omp_task, finish_omp_taskwait): New functions. * parser.c (cp_parser_binary_expression): Add prec argument. (cp_parser_assignment_expression): Adjust caller. * cp-tree.h (outer_curly_brace_block): New prototype. * decl.c (outer_curly_brace_block): No longer static. fortran/ * scanner.c (skip_free_comments, skip_fixed_comments): Handle tabs. * parse.c (next_free): Allow tab after !$omp. (decode_omp_directive): Handle !$omp task, !$omp taskwait and !$omp end task. (case_executable): Add ST_OMP_TASKWAIT. (case_exec_markers): Add ST_OMP_TASK. (gfc_ascii_statement): Handle ST_OMP_TASK, ST_OMP_END_TASK and ST_OMP_TASKWAIT. (parse_omp_structured_block, parse_executable): Handle ST_OMP_TASK. * gfortran.h (gfc_find_sym_in_expr): New prototype. (gfc_statement): Add ST_OMP_TASK, ST_OMP_END_TASK and ST_OMP_TASKWAIT. (gfc_omp_clauses): Add OMP_SCHED_AUTO to sched_kind, OMP_DEFAULT_FIRSTPRIVATE to default_sharing. Add collapse and untied fields. (gfc_exec_op): Add EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * f95-lang.c (LANG_HOOKS_OMP_CLAUSE_COPY_CTOR, LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, LANG_HOOKS_OMP_CLAUSE_DTOR, LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define. * trans.h (gfc_omp_clause_default_ctor): Add another argument. (gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op, gfc_omp_clause_dtor, gfc_omp_private_outer_ref): New prototypes. * types.def (BT_ULONGLONG, BT_PTR_ULONGLONG, BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_VOID_PTR_PTR, BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New. (BT_BOOL): Use integer type with BOOL_TYPE_SIZE rather than boolean_type_node. * dump-parse-tree.c (gfc_show_omp_node): Handle EXEC_OMP_TASK, EXEC_OMP_TASKWAIT, OMP_SCHED_AUTO, OMP_DEFAULT_FIRSTPRIVATE, untied and collapse clauses. (gfc_show_code_node): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * trans.c (gfc_trans_code): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * st.c (gfc_free_statement): Likewise. * resolve.c (gfc_resolve_blocks, resolve_code): Likewise. (find_sym_in_expr): Rename to... (gfc_find_sym_in_expr): ... this. No longer static. (resolve_allocate_expr, resolve_ordinary_assign): Adjust caller. * match.h (gfc_match_omp_task, gfc_match_omp_taskwait): New prototypes. * openmp.c (resolve_omp_clauses): Allow allocatable arrays in firstprivate, lastprivate, reduction, copyprivate and copyin clauses. (omp_current_do_code): Made static. (omp_current_do_collapse): New variable. (gfc_resolve_omp_do_blocks): Compute omp_current_do_collapse, clear omp_current_do_code and omp_current_do_collapse on return. (gfc_resolve_do_iterator): Handle collapsed do loops. (resolve_omp_do): Likewise, diagnose errorneous collapsed do loops. (OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): Define. (gfc_match_omp_clauses): Handle default (firstprivate), schedule (auto), untied and collapse (n) clauses. (OMP_DO_CLAUSES): Add OMP_CLAUSE_COLLAPSE. (OMP_TASK_CLAUSES): Define. (gfc_match_omp_task, gfc_match_omp_taskwait): New functions. * trans-openmp.c (gfc_omp_private_outer_ref): New function. (gfc_omp_clause_default_ctor): Add outer argument. For allocatable arrays allocate them with the bounds of the outer var if outer var is allocated. (gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op, gfc_omp_clause_dtor): New functions. (gfc_trans_omp_array_reduction): If decl is allocatable array, allocate it with outer var's bounds in OMP_CLAUSE_REDUCTION_INIT and deallocate it in OMP_CLAUSE_REDUCTION_MERGE. (gfc_omp_predetermined_sharing): Return OMP_CLAUSE_DEFAULT_SHARED for assumed-size arrays. (gfc_trans_omp_do): Add par_clauses argument. If dovar is present in lastprivate clause and do loop isn't simple, set OMP_CLAUSE_LASTPRIVATE_STMT. If dovar is present in parallel's lastprivate clause, change it to shared and add lastprivate clause to OMP_FOR_CLAUSES. Handle collapsed do loops. (gfc_trans_omp_directive): Adjust gfc_trans_omp_do callers. (gfc_trans_omp_parallel_do): Likewise. Move collapse clause to OMP_FOR from OMP_PARALLEL. (gfc_trans_omp_clauses): Handle OMP_SCHED_AUTO, OMP_DEFAULT_FIRSTPRIVATE, untied and collapse clauses. (gfc_trans_omp_task, gfc_trans_omp_taskwait): New functions. (gfc_trans_omp_directive): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. gcc/testsuite/ * gcc.dg/gomp/collapse-1.c: New test. * gcc.dg/gomp/nesting-1.c: New test. * g++.dg/gomp/task-1.C: New test. * g++.dg/gomp/predetermined-1.C: New test. * g++.dg/gomp/tls-4.C: New test. * gfortran.dg/gomp/collapse1.f90: New test. * gfortran.dg/gomp/sharing-3.f90: New test. * gcc.dg/gomp/pr27499.c (foo): Remove is unsigned dg-warning. * g++.dg/gomp/pr27499.C (foo): Likewise. * g++.dg/gomp/for-16.C (foo): Likewise. * g++.dg/gomp/tls-3.C: Remove dg-error, add S::s definition. * g++.dg/gomp/pr34607.C: Adjust dg-error location. * g++.dg/gomp/for-16.C (foo): Add a new dg-error. * gcc.dg/gomp/appendix-a/a.35.4.c: Add dg-warning. * gcc.dg/gomp/appendix-a/a.35.6.c: Likewise. * gfortran.dg/gomp/appendix-a/a.35.4.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise. * gfortran.dg/gomp/omp_parse1.f90: Remove !$omp tab test. * gfortran.dg/gomp/appendix-a/a.33.4.f90: Remove dg-error about allocatable array. * gfortran.dg/gomp/reduction1.f90: Likewise. libgomp/ * configure.ac (LIBGOMP_GNU_SYMBOL_VERSIONING): New AC_DEFINE. Substitute also OMP_*LOCK_25*. * configure: Regenerated. * config.h.in: Regenerated. * Makefile.am (libgomp_la_SOURCES): Add loop_ull.c, iter_ull.c, ptrlock.c and task.c. * Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * task.c: New file. * loop_ull.c: New file. * iter_ull.c: New file. * libgomp.h: Include ptrlock.h. (enum gomp_task_kind): New type. (struct gomp_team): Add task_lock, task_queue, task_count, task_running_count, single_count fields. Add work_share_list_free_lock ifndef HAVE_SYNC_BUILTINS. Remove work_share_lock, generation_mask, oldest_live_gen, num_live_gen and init_work_shares fields, add work work_share_list_alloc, work_share_list_free and work_share_chunk fields. Change work_shares from pointer to pointers into an array. Change ordered_release field into gomp_sem_t ** from flexible array member. Add implicit_task and initial_work_shares fields. Move close to the end of the struct. (struct gomp_team_state): Add single_count, last_work_share, active_level and level fields, remove work_share_generation. (gomp_barrier_handle_tasks): New prototype. (gomp_finish_task): New inline function. (struct gomp_work_share): Move chunk_size, end, incr into transparent union/struct, add chunk_size_ull, end_ll, incr_ll and next_ll fields. Reshuffle fields. Add next_alloc, next_ws, next_free and inline_ordered_team_ids fields, change ordered_team_ids into pointer from flexible array member. Add mode field. Put lock and next into a different cache line from most of the write-once fields. (gomp_iter_ull_static_next, gomp_iter_ull_dynamic_next_locked, gomp_iter_ull_guided_next_locked, gomp_iter_ull_dynamic_next, gomp_iter_ull_guided_next): New prototypes. (gomp_new_icv): New prototype. (struct gomp_thread): Add thread_pool and task fields. (struct gomp_thread_pool): New type. (gomp_new_team): New prototype. (gomp_team_start): Change type of last argument. (gomp_new_work_share): Removed. (gomp_init_work_share, gomp_fini_work_share): New prototypes. (gomp_work_share_init_done): New static inline. (gomp_throttled_spin_count_var, gomp_available_cpus, gomp_managed_threads): New extern decls. (gomp_init_task): New prototype. (gomp_spin_count_var): New extern var decl. (LIBGOMP_GNU_SYMBOL_VERSIONING): Undef if no visibility or no alias support, or if not PIC. (gomp_init_lock_30, gomp_destroy_lock_30, gomp_set_lock_30, gomp_unset_lock_30, gomp_test_lock_30, gomp_init_nest_lock_30, gomp_destroy_nest_lock_30, gomp_set_nest_lock_30, gomp_unset_nest_lock_30, gomp_test_nest_lock_30, gomp_init_lock_25, gomp_destroy_lock_25, gomp_set_lock_25, gomp_unset_lock_25, gomp_test_lock_25, gomp_init_nest_lock_25, gomp_destroy_nest_lock_25, gomp_set_nest_lock_25, gomp_unset_nest_lock_25, gomp_test_nest_lock_25): New prototypes. (omp_lock_symver, strong_alias): Define. (gomp_remaining_threads_count, gomp_remaining_threads_lock): New decls. (gomp_end_task): New. (struct gomp_task_icv, gomp_global_icv): New. (gomp_thread_limit_var, gomp_max_active_levels_var): New. (struct gomp_task): New. (gomp_nthreads_var, gomp_dyn_var, gomp_nest_var, gomp_run_sched_var, gomp_run_sched_chunk): Remove. (gomp_icv): New. (gomp_schedule_type): Reorder enum to match omp_sched_t. * team.c (struct gomp_thread_start_data): Add thread_pool and task fields. (gomp_thread_start): Add gomp_team_barrier_wait call. For non-nested case remove clearing of docked thread thr fields. Use pool fields instead of global gomp_* variables. Use gomp_barrier_wait_last when needed. Initialize ts.active_level. Create tasks for each member thread. (free_team): Only destroy team barrier, task_lock here and free it. (gomp_free_thread): Free last_team if non-NULL. (gomp_team_end): Call gomp_team_barrier_wait instead of gomp_barrier_wait. For nested case call one extra gomp_barrier_wait. Move here some destruction from free_team. Call free_team on pool->last_team if any, rather than freeing current team. Destroy work_share_list_free_lock ifndef HAVE_SYNC_BUILTINS. (gomp_new_icv): New function. (gomp_threads, gomp_threads_size, gomp_threads_used, gomp_threads_dock): Removed. (gomp_thread_destructor): New variable. (gomp_new_thread_pool, gomp_free_pool_helper, gomp_free_thread): New functions. (gomp_team_start): Create new pool if current thread doesn't have one. Use pool fields instead of global gomp_* variables. Initialize thread_pool field for new threads. Clear single_count. Change last argument from ws to team, don't create new team, set ts.work_share to &team->work_shares[0] and clear ts.last_work_share. Don't clear ts.work_share_generation. If number of threads changed, adjust atomically gomp_managed_threads. Use gomp_init_task instead of gomp_new_task, set thr->task to the corresponding implicit_task array entry. Create tasks for each member thread. Initialize ts.level. (initialize_team): Call pthread_key_create on gomp_thread_destructor. (team_destructor): New function. (new_team): Removed. (gomp_new_team): New function. (free_team): Free gomp_work_share blocks chained through next_alloc, instead of freeing work_shares and destroying work_share_lock. (gomp_team_end): Call gomp_fini_work_share. If number of threads changed, adjust atomically gomp_managed_threads. Use gomp_end_task. * barrier.c (GOMP_barrier): Call gomp_team_barrier_wait instead of gomp_barrier_wait. * single.c (GOMP_single_copy_start): Call gomp_team_barrier_wait instead of gomp_barrier_wait. Call gomp_work_share_init_done if gomp_work_share_start returned true. Don't unlock ws->lock. (GOMP_single_copy_end): Call gomp_team_barrier_wait instead of gomp_barrier_wait. (GOMP_single_start): Rewritten if HAVE_SYNC_BUILTINS. Call gomp_work_share_init_done if gomp_work_share_start returned true. Don't unlock ws->lock. * work.c: Include stddef.h. (free_work_share): Use work_share_list_free_lock instead of atomic chaining ifndef HAVE_SYNC_BUILTINS. Add team argument. Call gomp_fini_work_share and then either free ws if orphaned, or put it into work_share_list_free list of the current team. (alloc_work_share, gomp_init_work_share, gomp_fini_work_share): New functions. (gomp_work_share_start, gomp_work_share_end, gomp_work_share_end_nowait): Rewritten. * omp_lib.f90.in Change some tabs to spaces to prevent warnings. (openmp_version): Set to 200805. (omp_sched_kind, omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): New parameters. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New interfaces. * omp_lib.h.in (openmp_version): Set to 200805. (omp_sched_kind, omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): New parameters. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New externals. * loop.c: Include limits.h. (GOMP_loop_runtime_next, GOMP_loop_ordered_runtime_next): Handle GFS_AUTO. (GOMP_loop_runtime_start, GOMP_loop_ordered_runtime_start): Likewise. Use gomp_icv. (gomp_loop_static_start, gomp_loop_dynamic_start): Clear ts.static_trip here. (gomp_loop_static_start, gomp_loop_ordered_static_start): Call gomp_work_share_init_done after gomp_loop_init. Don't unlock ws->lock. (gomp_loop_dynamic_start, gomp_loop_guided_start): Call gomp_work_share_init_done after gomp_loop_init. If HAVE_SYNC_BUILTINS, don't unlock ws->lock, otherwise lock it. (gomp_loop_ordered_dynamic_start, gomp_loop_ordered_guided_start): Call gomp_work_share_init_done after gomp_loop_init. Lock ws->lock. (gomp_parallel_loop_start): Call gomp_new_team instead of gomp_new_work_share. Call gomp_loop_init on &team->work_shares[0]. Adjust gomp_team_start caller. Pass 0 as second argument to gomp_resolve_num_threads. (gomp_loop_init): For GFS_DYNAMIC, multiply ws->chunk_size by incr. If adding ws->chunk_size nthreads + 1 times after end won't overflow, set ws->mode to 1. * libgomp_g.h (GOMP_loop_ull_static_start, GOMP_loop_ull_dynamic_start, GOMP_loop_ull_guided_start, GOMP_loop_ull_runtime_start, GOMP_loop_ull_ordered_static_start, GOMP_loop_ull_ordered_dynamic_start, GOMP_loop_ull_ordered_guided_start, GOMP_loop_ull_ordered_runtime_start, GOMP_loop_ull_static_next, GOMP_loop_ull_dynamic_next, GOMP_loop_ull_guided_next, GOMP_loop_ull_runtime_next, GOMP_loop_ull_ordered_static_next, GOMP_loop_ull_ordered_dynamic_next, GOMP_loop_ull_ordered_guided_next, GOMP_loop_ull_ordered_runtime_next, GOMP_task, GOMP_taskwait): New prototypes. * libgomp.map: Export lock routines also @@OMP_2.0. (GOMP_loop_ordered_dynamic_first, GOMP_loop_ordered_guided_first, GOMP_loop_ordered_runtime_first, GOMP_loop_ordered_static_first): Remove. (GOMP_loop_ull_dynamic_next, GOMP_loop_ull_dynamic_start, GOMP_loop_ull_guided_next, GOMP_loop_ull_guided_start, GOMP_loop_ull_ordered_dynamic_next, GOMP_loop_ull_ordered_dynamic_start, GOMP_loop_ull_ordered_guided_next, GOMP_loop_ull_ordered_guided_start, GOMP_loop_ull_ordered_runtime_next, GOMP_loop_ull_ordered_runtime_start, GOMP_loop_ull_ordered_static_next, GOMP_loop_ull_ordered_static_start, GOMP_loop_ull_runtime_next, GOMP_loop_ull_runtime_start, GOMP_loop_ull_static_next, GOMP_loop_ull_static_start, GOMP_task, GOMP_taskwait): Export @@GOMP_2.0. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_, omp_set_max_active_levels_, omp_set_max_active_levels_8_, omp_get_max_active_levels_, omp_get_level_, omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_, omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_): New exports @@OMP_3.0. * omp.h.in (omp_sched_t): New type. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New prototypes. * env.c (gomp_spin_count_var, gomp_throttled_spin_count_var, gomp_available_cpus, gomp_managed_threads, gomp_max_active_levels_var, gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): New variables. (parse_spincount): New function. (initialize_env): Call gomp_init_num_threads unconditionally. Initialize gomp_available_cpus. Call parse_spincount, initialize gomp_{,throttled_}spin_count_var depending on presence and value of OMP_WAIT_POLICY and GOMP_SPINCOUNT env vars. Handle GOMP_BLOCKTIME env var. Handle OMP_WAIT_POLICY, OMP_MAX_ACTIVE_LEVELS, OMP_THREAD_LIMIT, OMP_STACKSIZE env vars. Handle unit specification for GOMP_STACKSIZE. Initialize gomp_remaining_threads_count and gomp_remaining_threads_lock if needed. Use gomp_global_icv. (gomp_nthreads_var, gomp_dyn_var, gomp_nest_var, gomp_run_sched_var, gomp_run_sched_chunk): Remove. (gomp_global_icv): New. (parse_schedule): Use it. Parse "auto". (omp_set_num_threads): Use gomp_icv. (omp_set_dynamic, omp_get_dynamic, omp_set_nested, omp_get_nested): Likewise. (omp_get_max_threads): Move from parallel.c. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels): New functions, add ialias. (parse_stacksize, parse_wait_policy): New functions. * fortran.c: Rewrite lock wrappers, if symbol versioning provide both wrappers for compatibility and new locks. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New ialias_redirect. (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_, omp_set_max_active_levels_, omp_set_max_active_levels_8_, omp_get_max_active_levels_, omp_get_level_, omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_, omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_): New functions. * parallel.c: Include limits.h. (gomp_resolve_num_threads): Add count argument. Rewritten. (GOMP_parallel_start): Call gomp_new_team and pass that as last argument to gomp_team_start. Pass 0 as second argument to gomp_resolve_num_threads. (GOMP_parallel_end): Decrease gomp_remaining_threads_count if gomp_thread_limit_var != ULONG_MAX. (omp_in_parallel): Implement using ts.active_level. (omp_get_max_threads): Move to env.c. (omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New functions, add ialias. * sections.c (GOMP_sections_start): Call gomp_work_share_init_done after gomp_sections_init. If HAVE_SYNC_BUILTINS, call gomp_iter_dynamic_next instead of the _locked variant and don't take lock around it, otherwise acquire it before calling gomp_iter_dynamic_next_locked. (GOMP_sections_next): If HAVE_SYNC_BUILTINS, call gomp_iter_dynamic_next instead of the _locked variant and don't take lock around it. (GOMP_parallel_sections_start): Call gomp_new_team instead of gomp_new_work_share. Call gomp_sections_init on &team->work_shares[0]. Adjust gomp_team_start caller. Pass count as second argument to gomp_resolve_num_threads, don't adjust num_threads after the call. Use gomp_icv. * iter.c (gomp_iter_dynamic_next_locked): Don't multiply ws->chunk_size by incr. (gomp_iter_dynamic_next): Likewise. If ws->mode, use more efficient code. * libgomp_f.h.in (omp_lock_25_arg_t, omp_nest_lock_25_arg_t): New types. (omp_lock_25_arg, omp_nest_lock_25_arg): New macros. (omp_check_defines): Check even the compat defines. * config/linux/ptrlock.c: New file. * config/linux/ptrlock.h: New file. * config/linux/wait.h: New file. * config/posix/ptrlock.c: New file. * config/posix/ptrlock.h: New file. * config/linux/bar.h (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes. (gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): New inlines. (gomp_barrier_t): Rewritten. (gomp_barrier_state_t): New typedef. (gomp_barrier_init, gomp_barrier_reinit, gomp_barrier_destroy, gomp_barrier_wait_start): Rewritten. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_barrier_last_thread, gomp_barrier_wait_last): New static inlines. * config/linux/bar.c: Include wait.h instead of libgomp.h and futex.h. (gomp_barrier_wait_end): Rewritten. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake, gomp_barrier_wait_last): New functions. * config/posix/bar.h (gomp_barrier_t): Add generation field. (gomp_barrier_state_t): New typedef. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes. (gomp_barrier_wait_start): Or all but low 2 bits from generation into the return value. Return gomp_barrier_state_t. (gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): New inlines. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_barrier_last_thread, gomp_barrier_wait_last): New static inlines. * config/posix/bar.c (gomp_barrier_init): Clear generation field. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New functions. * config/linux/mutex.c: Include wait.h instead of libgomp.h and futex.h. (gomp_futex_wake, gomp_futex_wait): New variables. (gomp_mutex_lock_slow): Call do_wait instead of futex_wait. * config/linux/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. Include wait.h instead of libgomp.h and futex.h. (gomp_set_nest_lock_25): Call do_wait instead of futex_wait. * config/posix95/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. * config/posix/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. * config/linux/proc.c (gomp_init_num_threads): Use gomp_global_icv. (get_num_procs, gomp_dynamic_max_threads): Use gomp_icv. * config/posix/proc.c, config/mingw32/proc.c: Similarly. * config/linux/powerpc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/alpha/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/x86/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/s390/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/ia64/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/sparc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/sem.c: Include wait.h instead of libgomp.h and futex.h. (gomp_sem_wait_slow): Call do_wait instead of futex_wait. * config/linux/affinity.c: Assume HAVE_SYNC_BUILTINS. * config/linux/omp-lock.h (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_nest_lock_t): Change owner into void *, add lock field. * config/posix95/omp-lock.h: Include semaphore.h. (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_lock_t): Use sem_t instead of mutex if semaphores aren't broken. (omp_nest_lock_t): Likewise. Change owner to void *. * config/posix/omp-lock.h: Include semaphore.h. (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_lock_t): Use sem_t instead of mutex if semaphores aren't broken. (omp_nest_lock_t): Likewise. Add owner field. * testsuite/libgomp.c/collapse-1.c: New test. * testsuite/libgomp.c/collapse-2.c: New test. * testsuite/libgomp.c/collapse-3.c: New test. * testsuite/libgomp.c/icv-1.c: New test. * testsuite/libgomp.c/icv-2.c: New test. * testsuite/libgomp.c/lib-2.c: New test. * testsuite/libgomp.c/lock-1.c: New test. * testsuite/libgomp.c/lock-2.c: New test. * testsuite/libgomp.c/lock-3.c: New test. * testsuite/libgomp.c/loop-4.c: New test. * testsuite/libgomp.c/loop-5.c: New test. * testsuite/libgomp.c/loop-6.c: New test. * testsuite/libgomp.c/loop-7.c: New test. * testsuite/libgomp.c/loop-8.c: New test. * testsuite/libgomp.c/loop-9.c: New test. * testsuite/libgomp.c/nested-3.c: New test. * testsuite/libgomp.c/nestedfn-6.c: New test. * testsuite/libgomp.c/sort-1.c: New test. * testsuite/libgomp.c/task-1.c: New test. * testsuite/libgomp.c/task-2.c: New test. * testsuite/libgomp.c/task-3.c: New test. * testsuite/libgomp.c/task-4.c: New test. * testsuite/libgomp.c++/c++.exp: Add libstdc++-v3 build includes to C++ testsuite default compiler options. * testsuite/libgomp.c++/collapse-1.C: New test. * testsuite/libgomp.c++/collapse-2.C: New test. * testsuite/libgomp.c++/ctor-10.C: New test. * testsuite/libgomp.c++/for-1.C: New test. * testsuite/libgomp.c++/for-2.C: New test. * testsuite/libgomp.c++/for-3.C: New test. * testsuite/libgomp.c++/for-4.C: New test. * testsuite/libgomp.c++/for-5.C: New test. * testsuite/libgomp.c++/loop-8.C: New test. * testsuite/libgomp.c++/loop-9.C: New test. * testsuite/libgomp.c++/loop-10.C: New test. * testsuite/libgomp.c++/task-1.C: New test. * testsuite/libgomp.c++/task-2.C: New test. * testsuite/libgomp.c++/task-3.C: New test. * testsuite/libgomp.c++/task-4.C: New test. * testsuite/libgomp.c++/task-5.C: New test. * testsuite/libgomp.c++/task-6.C: New test. * testsuite/libgomp.fortran/allocatable1.f90: New test. * testsuite/libgomp.fortran/allocatable2.f90: New test. * testsuite/libgomp.fortran/allocatable3.f90: New test. * testsuite/libgomp.fortran/allocatable4.f90: New test. * testsuite/libgomp.fortran/collapse1.f90: New test. * testsuite/libgomp.fortran/collapse2.f90: New test. * testsuite/libgomp.fortran/collapse3.f90: New test. * testsuite/libgomp.fortran/collapse4.f90: New test. * testsuite/libgomp.fortran/lastprivate1.f90: New test. * testsuite/libgomp.fortran/lastprivate2.f90: New test. * testsuite/libgomp.fortran/lib4.f90: New test. * testsuite/libgomp.fortran/lock-1.f90: New test. * testsuite/libgomp.fortran/lock-2.f90: New test. * testsuite/libgomp.fortran/nested1.f90: New test. * testsuite/libgomp.fortran/nestedfn4.f90: New test. * testsuite/libgomp.fortran/strassen.f90: New test. * testsuite/libgomp.fortran/tabs1.f90: New test. * testsuite/libgomp.fortran/tabs2.f: New test. * testsuite/libgomp.fortran/task1.f90: New test. * testsuite/libgomp.fortran/task2.f90: New test. * testsuite/libgomp.fortran/vla4.f90: Add dg-warning. * testsuite/libgomp.fortran/vla5.f90: Likewise. * testsuite/libgomp.c/pr26943-2.c: Likewise. * testsuite/libgomp.c/pr26943-3.c: Likewise. * testsuite/libgomp.c/pr26943-4.c: Likewise. Co-Authored-By: Jakob Blomer <jakob.blomer@ira.uka.de> Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Ulrich Drepper <drepper@redhat.com> From-SVN: r136433
2008-06-06 15:01:54 +02:00
extern tree outer_curly_brace_block (tree);
extern tree finish_function (int);
extern tree grokmethod (cp_decl_specifier_seq *, const cp_declarator *, tree);
extern void maybe_register_incomplete_var (tree);
extern void maybe_commonize_var (tree);
extern void complete_vars (tree);
extern tree static_fn_type (tree);
extern void revert_static_member_fn (tree);
extern void fixup_anonymous_aggr (tree);
call.c (null_ptr_cst_p): Use maybe_constant_value. * call.c (null_ptr_cst_p): Use maybe_constant_value. (set_up_extended_ref_temp): Support constant initialization. (initialize_reference): Adjust. * class.c (check_bitfield_decl): Use cxx_constant_value. * cvt.c (ocp_convert): Don't use integral_constant_value when converting to class type. * decl.c (finish_case_label): Use maybe_constant_value. (build_init_list_var_init): Support constant initialization. (check_initializer): Likewise. Reorganize. (cp_finish_decl): Likewise. (expand_static_init): Likewise. (compute_array_index_type): Use maybe_constant_value. Add complain parm. (create_array_type_for_decl, grokdeclarator): Pass it. (build_enumerator): Use cxx_constant_value. * decl2.c (grokfield): Use maybe_constant_init. * except.c (check_noexcept_r): Handle constexpr. (build_noexcept_spec): Use maybe_constant_value. * init.c (expand_default_init): Support constant initialization. (build_vec_init): Likewise. (constant_value_1): Adjust. (build_new_1): Adjust. * parser.c (cp_parser_constant_expression): Allow non-integral in C++0x mode. (cp_parser_direct_declarator): Don't fold yet in C++0x mode. (cp_parser_initializer_clause): Toss folded result if non-constant. * pt.c (fold_decl_constant_value): Remove. (convert_nontype_argument): Use maybe_constant_value. Give clearer error about overflow. (tsubst): Move array bounds handling into compute_array_index_type. (value_dependent_expression_p): Handle constant CALL_EXPR. * semantics.c (finish_static_assert): Use maybe_constant_value. (ensure_literal_type_for_constexpr_object): Make sure type is complete. (potential_constant_expression): Use maybe_constant_value. * tree.c (cast_valid_in_integral_constant_expression_p): Any cast is potentially valid in C++0x. * typeck2.c (store_init_value): Handle constant init. (check_narrowing): Use maybe_constant_value. (build_functional_cast): Set TREE_CONSTANT on literal T(). * cp-tree.h (DECL_INTEGRAL_CONSTANT_VAR_P): Remove. (LOOKUP_ALREADY_DIGESTED): New. (compute_array_index_type): Adjust prototype. From-SVN: r166167
2010-11-02 02:31:18 +01:00
extern tree compute_array_index_type (tree, tree, tsubst_flags_t);
extern tree check_default_argument (tree, tree, tsubst_flags_t);
typedef int (*walk_namespaces_fn) (tree, void *);
extern int walk_namespaces (walk_namespaces_fn,
void *);
extern int wrapup_globals_for_namespace (tree, void *);
Implement P0386R2 - C++17 inline variables 2016-10-11 Jakub Jelinek <jakub@redhat.com> * dwarf2out.c (gen_member_die): Handle inline static data member definitions. c-family/ * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_inline_variables. cp/ * cp-tree.h (struct lang_type): Shrink language field to 1 bit from 4. Add var_declared_inline_p field. Mention 2 spare bits. (DECL_VAR_DECLARED_INLINE_P): Define. (SET_DECL_VAR_DECLARED_INLINE_P): Define. (DECL_INLINE_VAR_P): Define. (diagnose_inline_vars_for_namespace): Declare. * decl.c (diagnose_inline_vars_for_namespace): New function. (duplicate_decls): For static data members copy DECL_DECLARED_CONSTEXPR_P. (redeclaration_error_message): Handle C++17 redundant redeclaration of constexpr static data member outside of class. (maybe_commonize_var): Handle inline variables. (check_initializer): Ignore inline variables for diagnostics. Adjust diagnostic wording for C++17. (make_rtl_for_nonlocal_decl): Allow in-class definition of inline static data members. (bad_specifiers): Don't diagnose inline on variables here. (grokvardecl): Add inlinep argument, non-static const inline variables are TREE_PUBLIC. (check_static_variable_definition): Return early also for inline variables. (grokdeclarator): Handle inline variables and inline static data members. * typeck2.c (store_init_value): Don't diagnose non-constant initializers for non-constexpr inline static data members. * decl2.c (vague_linkage_p): Return true for inline variables. (c_parse_final_cleanups): In-class declaration of inline static data members is a definition. Call diagnose_inline_vars_for_namespace through walk_namespaces. * pt.c (instantiate_decl): Set pattern_defined for in-class definitions of inline static data members. From-SVN: r241137
2016-10-13 21:26:54 +02:00
extern int diagnose_inline_vars_for_namespace (tree, void *);
extern tree create_implicit_typedef (tree, tree);
c-common.c (const_strip_array_types): New. * c-common.c (const_strip_array_types): New. * c-common.h (lang_missing_noreturn_ok_p): Delete. (const_strip_array_types): New. * c-objc-common.c (c_disregard_inline_limits, c_warn_unused_global_decl): Constify. * c-tree.h (c_disregard_inline_limits, c_warn_unused_global_decl, c_vla_type_p, c_incomplete_type_error): Likewise. * c-typeck.c (c_incomplete_type_error, c_vla_type_p): Likewise. * hooks.c (hook_bool_const_tree_false): New. * hooks.h (hook_bool_const_tree_false): Likewise. * langhooks-def.h (lhd_warn_unused_global_decl, lhd_incomplete_type_error, lhd_expr_size, lhd_tree_inlining_disregard_inline_limits, lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, LANG_HOOKS_GENERIC_TYPE_P, LANG_HOOKS_TYPE_MAX_SIZE): Constify. * langhooks.c (lhd_warn_unused_global_decl, lhd_incomplete_type_error, lhd_tree_inlining_disregard_inline_limits, lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, lhd_expr_size): Likewise. * langhooks.h (lang_hooks_for_tree_inlining, lang_hooks_for_tree_dump, lang_hooks_for_types, lang_hooks_for_decls, lang_hooks): Likewise. * pointer-set.c (pointer_set_t, pointer_set_create, pointer_set_contains, insert_aux, pointer_set_insert, pointer_set_traverse, pointer_map_t, pointer_map_create, pointer_map_contains, pointer_map_insert, pointer_map_traverse): Likewise. * pointer-set.h (pointer_set_contains, pointer_set_insert, pointer_set_traverse, pointer_map_contains, pointer_map_insert, pointer_map_traverse): Likewise. * predict.c (assert_is_empty): Likewise. * tree-affine.c (free_name_expansion): Likewise. * tree-cfg.c (edge_to_cases_cleanup): Likewise. * tree.c (size_in_bytes, max_int_size_in_bytes): Likewise. * tree.h (size_in_bytes, max_int_size_in_bytes): Likewise. ada: * misc.c (gnat_type_max_size): Constify. cp: * cp-objcp-common.c (cxx_warn_unused_global_decl, cp_expr_size): Constify. * cp-tree.h (local_variable_p, nonstatic_local_decl_p, class_tmpl_impl_spec_p, cp_auto_var_in_fn_p, cp_type_quals, cxx_incomplete_type_diagnostic, cxx_incomplete_type_error, cxx_warn_unused_global_decl, cp_expr_size): Likewise. * decl.c (local_variable_p, nonstatic_local_decl_p): Likewise. * tree.c (class_tmpl_impl_spec_p, cp_auto_var_in_fn_p): Likewise. * typeck.c (cp_type_quals): Likewise. * typeck2.c (cxx_incomplete_type_diagnostic, cxx_incomplete_type_error): Likewise. From-SVN: r127560
2007-08-16 16:31:21 +02:00
extern int local_variable_p (const_tree);
extern tree register_dtor_fn (tree);
extern tmpl_spec_kind current_tmpl_spec_kind (int);
extern tree cp_fname_init (const char *, tree *);
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
extern tree cxx_builtin_function (tree decl);
extern tree cxx_builtin_function_ext_scope (tree decl);
extern tree check_elaborated_type_specifier (enum tag_types, tree, bool);
extern void warn_extern_redeclared_static (tree, tree);
cgraphunit.c (cgraph_function_versioning,save_inline_function_body): Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY. 2009-06-15 Rafael Avila de Espindola <espindola@google.com> * cgraphunit.c (cgraph_function_versioning,save_inline_function_body): Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY. * cgraph.c (cgraph_create_virtual_clone): Use DECL_COMDAT_GROUP. * config/i386/i386.c (ix86_file_end): Compute DECL_COMDAT_GROUP. * dwarf2asm.c(dw2_force_const_mem): Update call to make_decl_one_only. * langhooks-def.h (lhd_comdat_group, LANG_HOOKS_COMDAT_GROUP): Remove. (LANG_HOOKS_DECLS): Remove LANG_HOOKS_COMDAT_GROUP. * langhooks.c (lhd_comdat_group): Remove. * langhooks.h (lang_hooks_for_decls): Remove comdat_group. * tree.h (DECL_COMDAT_GROUP): New. (DECL_ONE_ONLY): Use DECL_COMDAT_GROUP. (tree_decl_with_vis): Add comdat_group. Remove one_only. (make_decl_one_only): Change signature. * varasm.c (get_emutls_init_templ_addr, emutls_decl): Update call to make_decl_one_only. (make_decl_one_only): Change signature. (default_elf_asm_named_section): Use DECL_COMDAT_GROUP. 2009-06-15 Rafael Avila de Espindola <espindola@google.com> * cp-objcp-common.h (LANG_HOOKS_COMDAT_GROUP): Remove. * cp-tree.h (cxx_comdat_group): Change signature. * decl.c (duplicate_decls): Use DECL_COMDAT_GROUP. (cxx_comdat_group): Change signature. * decl2.c (comdat_linkage, maybe_make_one_only): Update call to make_decl_one_only. (constrain_visibility, get_guard): Use DECL_COMDAT_GROUP. * method.c (use_thunk): Update call to make_decl_one_only. * optimize.c (maybe_clone_body): Use DECL_COMDAT_GROUP 2009-06-15 Rafael Avila de Espindola <espindola@google.com> * g++.dg/abi/mangle11.C: Update warning line. * g++.dg/abi/mangle12.C: Update warning line. * g++.dg/abi/mangle17.C: Update warning line. * g++.dg/abi/mangle20-2.C: Update warning line. From-SVN: r148492
2009-06-15 16:25:50 +02:00
extern tree cxx_comdat_group (tree);
extern bool cp_missing_noreturn_ok_p (tree);
extern bool is_direct_enum_init (tree, 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
extern void initialize_artificial_var (tree, vec<constructor_elt, va_gc> *);
extern tree check_var_type (tree, tree);
extern tree reshape_init (tree, tree, tsubst_flags_t);
extern tree next_initializable_field (tree);
extern tree fndecl_declared_return_type (tree);
extern bool undeduced_auto_decl (tree);
extern bool require_deduced_type (tree, tsubst_flags_t = tf_warning_or_error);
java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. gcc/java/ * java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. * expr.c (force_evaluation_order): Same. * typeck.c: Add location to build_decl or PUSH_FIELD calls. * class.c: Same. * decl.c: Same. * jcf-parse.c: Same. * constants.c: Same. * resource.c: Same. * except.c: Same. * builtins.c: Same. * expr.c: Same. * java-tree.h (PUSH_FIELD): Add location field. gcc/objc/ * objc-act.c (finish_var_decl): Pass location to finish_decl. (objc_get_parm_info): Same. (get_super_receiver): Same. * objc-act.c (objc_build_component_ref): Pass location to build_compound_ref. (build_module_initializer_routine): Pass location to c_end_compound_stmt. (objc_generate_static_init_call): Pass location to build_stmt. (build_typed_selector_reference): New location argument. (build_selector_reference): Same. (objc_substitute_decl): Pass location to build_array_ref. (next_sjlj_build_try_catch_finally): Pass location to build_stmt. (objc_begin_catch_clause): Same. (objc_finish_try_stmt): Same. (objc_finish_catch_clause): Pass location to c_end_compound_stmt. (objc_build_throw_stmt): New argument. (generate_shared_structures): Pass location to build_c_cast. (objc_build_message_expr): Use local location. (objc_finish_message_expr): Use input_location. (build_objc_method_call): New argument. (objc_build_selector_expr): Same. (get_super_receiver): Pass location to build_c_cast, build_modify_expr, build_compound_expr. * objc-act.c: Add location to all calls to start_struct, build_decl, finish_struct. gcc/ * tree-pretty-print.c (dump_generic_node): Dump column numbers. * gimple-pretty-print.c (dump_gimple_stmt): Same. * gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs created. * c-parser.c (c_parser_binary_expression): Use current column while building binary operations. * common.opt (fshow-column): Enable by default. * tree-vrp.c (check_array_ref): Use warning_at. (check_array_bounds): Use location from call back if expr has no location. * tree.h: Add location argument to maybe_fold_*. * tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*. (maybe_fold_offset_to_array_ref): Add location argument and use it. (maybe_fold_offset_to_component_ref): Same. (maybe_fold_offset_to_reference): Same. (maybe_fold_offset_to_address): Same. (maybe_fold_stmt_indirect): Same. (maybe_fold_stmt_addition): Same. (fold_stmt_r): Pass location to maybe_fold_*. (fold_gimple_assign): Same. * c-tree.h: Add location argument to finish_decl, default_function_array_conversion, store_init_value. * c-decl.c (define_label): Use error_at. (c_make_fname_decl): Pass location to finish_decl. (finish_decl): New location argument. (build_compound_literal): Pass location to store_init_value. (grokdeclarator): Pass location to finish_decl. (grokfield): Same. * c-typeck.c (array_to_pointer_conversion): New location argument. (function_to_pointer_conversion): Same. (default_function_array_conversion): Same. (parser_build_unary_op): Pass location to overflow_warning. (parser_build_binary_op): Same. Use warning_at. (build_unary_op): Pass location to array_to_pointer_conversion. (build_c_cast): Pass location to digest_init. (build_modify_expr): New location argument. (convert_for_assignment): Same. (store_init_value): Same. (digest_init): Same. (output_init_element): Pass location to digest_init and array_to_pointer_conversion. (c_finish_return): Pass location to convert_for_assignment. * gimplify.c (gimplify_conversion): Pass location to maybe_fold_offset_to_address. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location to maybe_fold_stmt_addition. * c-omp.c (c_finish_omp_atomic): Pass new location to build_modify_expr. (c_finish_omp_for): Same. * c-common.c (overflow_warning): New argument. * c-common.h: New argument to build_modify_expr, overflow_warning. * c-parser.c (c_parser_declaration_or_fndef): Pass location to finish_decl. (c_parser_initializer): Pass location to default_function_array_conversion. (c_parser_initelt): Same. (c_parser_initval): Same. (c_parser_asm_operands): Same. (c_parser_expr_no_commas): Same. Pass location to build_modify_expr. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Add location info to stack. Use it. (c_parser_unary_expression): Pass location to default_function_array_conversion, parser_build_unary_op, build_indirect_ref, c_parser_postfix_expression_after_primary. (c_parser_postfix_expression_after_primary): New location argument. Use it. (c_parser_expression_conv): Pass location to default_function_array_conversion. (c_parser_expr_list): Same. (c_parser_omp_atomic): Same. (c_parser_omp_for_loop): Same. * c-tree.h: (struct c_declarator): Add comment to id_loc. (build_array_declarator): New argument. * c-decl.c (build_array_declarator): Add location argument. (grokdeclarator): Set id_loc for cdk_array. * c-parser.c (c_parser_direct_declarator_inner): Pass location to build_array_declarator. * tree.c (build_omp_clause): Add location argument. * tree.h (OMP_CLAUSE_HAS_LOCATION): New macro. (OMP_CLAUSE_LOCATION): New macro. (struct tree_omp_clause): Add location field. (build_omp_clause): Add argument. * testsuite/gcc.dg/gomp/for-1.c: Fix column. * cp/pt.c (tsubst_omp_for_iterator): Pass location to build_omp_clause. * cp/parser.c (cp_parser_omp_var_list_no_open): Same. (cp_parser_omp_clause_collapse): Same. (cp_parser_omp_clause_default): Same. (cp_parser_omp_clause_if): Same. (cp_parser_omp_clause_nowait): Same. (cp_parser_omp_clause_num_threads): Same. (cp_parser_omp_clause_ordered): Same. (cp_parser_omp_clause_schedule): Same. (cp_parser_omp_clause_untied): Same. (cp_parser_omp_for_loop): Same. (cp_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (c_start_case): Add location argument. (c_process_expr_stmt): Same. (c_finish_goto_*): Same. * tree-parloops.c (initialize_reductions): Pass location to build_omp_clause. (create_parallel_loop): Same. * fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same. (gfc_trans_omp_reduction_list): Same. (gfc_trans_omp_clauses): Same. (gfc_trans_omp_do): Same. * c-typeck.c (c_finish_goto_label): Same. (c_finish_goto_ptr): New location argument. (c_start_case): Same. (emit_side_effect_warnings): Same. (c_process_expr_stmt): Same. (c_finish_stmt_expr): Same. (c_finish_omp_clauses): Use error_at instead of error. * gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to build_omp_clause. * c-omp.c (c_split_parallel_clauses): New location argument. * tree-nested.c (convert_nonlocal_reference_stmt): Pass location to build_omp_clause. (convert_local_reference_stmt): Same. (convert_gimple_call): Same. * c-common.h (c_split_parallel_clauses): New argument. * c-parser.c (c_parser_statement_after_labels): Pass location to c_finish_goto_label. (c_parser_switch_statement): Pass location to c_start_case. (c_parser_for_statement): Pass location to c_finish_expr_stmt, and c_process_expr_stmt. (c_parser_omp_variable_list): Add location argument. (c_parser_omp_clause_collapse): Pass location to build_omp_clause. (c_parser_omp_clause_default): Same. (c_parser_omp_clause_if): Same. (c_parser_omp_clause_num_threads): Same. (-c_parser_omp_clause_ordered): Same. (c_parser_omp_clause_reduction): Pass location to c_parser_omp_variable_list. (c_parser_omp_clause_schedule): Pass location to build_omp_clause. (c_parser_omp_clause_untied): Same. (c_parser_omp_for_loop): Pass location to c_process_expr_stmt. (c_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (check_for_loop_decls, undeclared_variable, build_component_ref, build_array_ref, build_external_ref, c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op, build_conditional_expr, build_compound_expr, c_cast_expr, build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr, c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New argument. * c-semantics.c (build_stmt): Same. (build_case_label): Same. * c-decl.c (c_finish_incomplete_decl): Pass location on down. (undeclared_variable): New argument. (make_label): Same. (lookup_label): Pass location on down. (define_label): Same. (finish_decl): Same. (build_compound_literal): Same. (finish_struct): Same. (finish_function): Do not set location here. (check_for_loop_decls): New argument. * tree.c (save_expr): Set location. (build_empty_stmt): New argument. * tree.h (build_empty_stmt): New argument to build_empty_stmt. (CAN_HAVE_LOCATION_P): Make sure we have a non empty node. * builtins.c (gimplify_va_arg_expr): Use locations. (expand_builtin_sync_operation): Same. * c-typeck.c (build_component_ref): New argument. (build_array_ref): Same. (build_external_ref): Same. (c_expr_sizeof_expr): Same. (c_expr_sizeof_type): Same. (parser_build_unary_op): Same. (build_conditional_expr): Same. (build_compound_expr): Pass location on down. (build_compound_expr): New argument. (build_c_cast): Same. (c_cast_expr): Same. (build_asm_expr): Same. (c_finish_return): Same. (c_process_expr_stmt): Pass location on down. (c_finish_stmt_expr): New argument. (push_clenaup): Same. (c_finish_omp_parallel): Same. (c_finish_omp_task): Same. * gimplify.c (gimplify_call_expr): Pass location on down. * c-omp.c (c_finish_omp_master): New argument. (c_finish_omp_critical): Same. (c_finish_omp_ordered): Same. (c_finish_omp_barrier): Same. (-c_finish_omp_taskwait): Same. (c_finish_omp_atomic): Same. (c_finish_omp_flush): Same. * tree-inline.c (copy_tree_body_r): Pass location on down. (inline_forbidden_p): Remove use of input_location. * c-gimplify.c (c_build_bind_expr): New argument. * c-common.c (c_common_truthvalue_conversion): Pass location on down. (c_sizeof_or_alignof_type): New argument. (c_alignof_expr): Same. (build_va_arg): Same. (c_add_case_label): Same. * c-common.h (c_sizeof_or_alignof_type, c_alignof_expr, c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label, c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt, c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered, c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush, c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses): New argument. * stub-objc.c (objc_build_selector_expr): Same. (objc_build_throw_stmt): Same. * c-parser.c (c_parser_declaration_or_fndef): Pass location on down. (c_parser_initelt): Same. (c_parser_compound_statement): Same. (c_parser_compound_statement_nostart): Same. (c_parser_label): Same. (c_parser_statement_after_labels): Same. (c_parser_if_body): Same. (c_parser_else_body): Same. (c_parser_if_statement): Same. (c_parser_switch_statement): Same. (c_parser_while_statement): Same. (c_parser_do_statement): Same. (c_parser_for_statement): Same. (c_parser_asm_statement): Same. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Same. (c_parser_cast_expression): Same. (c_parser_unary_expression): Same. (c_parser_sizeof_expression): Same. (c_parser_alignof_expression): Same. (c_parser_postfix_expression): Same. (c_parser_expression): Same. (c_parser_objc_receiver): Same. (c_parser_omp_variable_list): Same. (c_parser_omp_structured_block): Same. (c_parser_omp_atomic): New argument. (c_parser_omp_barrier): Same. (c_parser_omp_critical): Same. (c_parser_omp_flush): Pass location on down. (c_parser_omp_for_loop): New argument. (c_parser_omp_for): Same. (c_parser_omp_master): Same. (c_parser_omp_ordered): Same. (c_parser_omp_sections_scope): Same. (c_parser_omp_sections): Same. (c_parser_omp_parallel): Same. (c_parser_omp_single): Same. (c_parser_omp_task): Same. (c_parser_omp_taskwait): Pass location on down. (c_parser_omp_construct): Same. (c_parser_omp_threadprivate): Same. * dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h, builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c, tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c, c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c, c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c, emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c, rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h, tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c, config/i386/i386.c, stmt.c: Add location argument to the following function definitions and/or function calls: build_decl, objcp_start_struct, objcp_finish_struct, start_struct, finish_struct, PUSH_FIELD, create_artificial_label, cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl, build_compound_literal, parser_xref_tag, resolve_overloaded_builtin, do_case, c_finish_bc_stmt, build_compound_literal, build_function_call. * c-decl.c (build_compound_literal): Add location argument. Make all diagnostic calls use location. (start_struct): Same. (finish_struct): Same. (start_enum): Same. (build_enumerator): Same. (start_function): Same. (grokdeclarator): Make all diagnostic calls use location. (store_parm_decls_oldstyle): Same. * c-typeck.c (build_function_call): Add location argument. Make all diagnostic calls use location. (do_case): Same. (c_finish_bc_stmt): Same. * tree-nested.c (get_trampoline_type): Add argument. Pass location to build_decl. (lookup_tramp_for_decl): Pass location to get_trampoline_type. * rtl.h (RTL_LOCATION): New. * c-common.c (c_add_case_label): Add location argument. Make all diagnostic calls use location. * c-common.h: Add location argument to make_fname_decl, do_case, c_add_case_label, build_function_call, resolve_overloaded_builtin. * c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc. Set it appropriately for every case. Pass enum_loc to start_enum call. Pass value_loc first to build_enumerator. Pass enum_loc to parser_xref_tag. (c_parser_struct_or_union_specifier): Save location. Use it for start_struct, finish_struct, and parser_xref_tag. gcc/testsuite/ * gcc.dg/old-style-prom-3.c: Add column info. * gcc.dg/overflow-warn-1.c * gcc.dg/gomp/pr27415.c * gcc.dg/gomp/for-1.c: Same. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/c99-tag-3.c: Same. * gcc.dg/Wredundant-decls-2.c: Same. * gcc.dg/func-ptr-conv-1.c: Same. * gcc.dg/asm-wide-1.c: Same. * gcc.dg/nofixed-point-2.c: Same. * gcc.dg/cpp/line3.c: Same. * gcc.dg/array-10.c: Same. * gcc.dg/c99-vla-jump-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/Wshadow-3.c: Same. * gcc.dg/c90-const-expr-8.c: Same. * gcc.dg/label-decl-2.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/c90-const-expr-5.c: Same. * gcc.dg/builtins-30.c: Same. * gcc.dg/Warray-bounds.c: Same. * gcc.dg/Wcxx-compat-2.c: Same. * gcc.dg/tree-ssa/col-1.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/cast-function-1.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/vla-8.c: Same. * gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct line. * gcc.dg/label-decl-2.c: Move label diagnostic to correct line. * gcc.dg/old-style-prom-3.c: Check for error on the correct line. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/builtins-30.c: Same. Test for columns. gcc/objcp/ * objcp-decl.h (c_end_compound_stmt): New argument. * objcp-decl.c (objcp_start_struct): Add argument. (objcp_finish_struct): Same. gcc/cp/ * typeck.c (cp_build_binary_op): Pass location to overflow_warning. (build_modify_expr): New arg. * semantics.c (finish_unary_op_expr): Pass location to overflow_warning. (handle_omp_for_class_iterator): Pass location to build_modify_expr. * typeck.c (cxx_sizeof_or_alignof_type): Pass location to c_sizeof_or_alignof_type. (build_array_ref): New argument. (build_compound_expr): Same. (build_const_cast): Same. (build_ptrmemfunc): Pass location to build_c_cast. * init.c (avoid_placement_new_aliasing): Pass location to build_stmt. (build_vec_delete_1): Pass location to cp_build_modify_expr, build_compound_expr. * class.c (build_vtbl_ref_1): Pass location to build_array_ref. * decl.c (poplevel): Pass location to c_build_bind_expr. (finish_case_label): Pass location to build_case_label. (finish_constructor_body): Same. (finish_destructor_body): Pass location to build_stmt. (cxx_maybe_build_cleanup): Same, but to build_compound_expr. * call.c (build_new_op): Pass location to build_array_ref. (build_x_va_arg): Pass location to build_va_arg. * except.c (expand_end_catch_block): Pass location to build_stmt. * cp-tree.h (build_array_ref): New argument. (build_compound_expr): Same. (build_c_cast): Same. * cp-gimplify.c (gimplify_if_stmt): Pass location on down. (gimplify_switch_stmt): Same. * typeck2.c (split_nonconstant_init_1): Same. * pt.c (tsubst_copy): Same. * semantics.c (add_decl_expr): Same. (do_poplevel): Same. (push_cleanup): Same. (finish_goto_stmt): Same. (finish_expr_stmt): Same. (begin_if_stmt): Same. (begin_while_stmt): Same. (begin_do_stmt): Same. (finish_return_stmt): Same. (begin_for_stmt): Same. (finish_break_stmt): Same. (finish_continue_stmt): Same. (begin_switch_stmt): Same. (begin_try_block): Same. (begin_handler): Same. (finish_asm_stmt): Same. (finish_label_stmt): Same. (finish_stmt_expr_expr): Same. (finalize_nrv_r): Same. (finish_omp_atomic): Same. * name-lookup.c (do_using_directive): Same. * decl2.c (grok_array_decl): Same. * parser.c (cp_parser_cast_expression): Same. (cp_parser_selection_statement): Same. (cp_parser_implicitly_scoped_statement): Same. (cp_parser_objc_selector_expression): Same. (cp_parser_objc_synchronized_statement): Same. (cp_parser_objc_throw_statement): Same. (cp_parser_omp_critical): Same. (cp_parser_omp_master): Same. * typeck.c (build_function_call): Add location argument. * init.c: Add location argument to all build_decl calls. * class.c: Same. * method.c: Same. * rtti.c: Same. * tree.c: Same. * pt.c: Same. * semantics.c: Same. * lex.c: Same. * decl2.c: Same. * cp-gimplify.c: Same. * decl.c: Same. (cp_make_fname_decl): Add location argument. Pass location ot build_decl. (finish_case_label): Same. * cp-tree.h (finish_case_label): Add location argument. * parser.c (cp_parser_label_for_labeled_statement): Pass location to finish_case_label. gcc/fortran/ * trans-array.c (gfc_trans_allocate_array_storage): Pass location on down. (gfc_trans_array_constructor_value): Same. (gfc_trans_scalarized_loop_end): Same. (gfc_conv_ss_startstride): Same. (gfc_trans_g77_array): Same. (gfc_trans_dummy_array_bias): Same. (gfc_conv_array_parameter): Same. (structure_alloc_comps): Same. * trans-expr.c (gfc_conv_function_call): Same. (fill_with_spaces): Same. (gfc_trans_string_copy): Same. (gfc_trans_scalar_assign): Same. * trans-stmt.c (gfc_trans_goto): Same. (gfc_trans_if_1): Same. (gfc_trans_simple_do): Same. (gfc_trans_do): Same. (gfc_trans_do_while): Same. (gfc_trans_logical_select): Same. (gfc_trans_select): Same. (gfc_trans_forall_loop): Same. (gfc_trans_nested_forall_loop): Same. (generate_loop_for_temp_to_lhs): Same. (generate_loop_for_rhs_to_temp): Same. (gfc_trans_forall_1): Same. (gfc_trans_where_assign): Same. (gfc_trans_where_3): Same. (gfc_trans_allocate): Same. * trans.c (gfc_finish_block): Same. (gfc_trans_runtime_check): Same. (gfc_call_malloc): Same. (gfc_allocate_with_status): Same. (gfc_call_free): Same. (gfc_deallocate_with_status): Same. (gfc_call_realloc): Same. (gfc_trans_code): Same. * trans-decl.c (gfc_init_default_dt): Same. (gfc_generate_constructors): Same. * trans-io.c (gfc_trans_io_runtime_check): Same. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same. (gfc_conv_intrinsic_fdate): Same. (gfc_conv_intrinsic_ttynam): Same. (gfc_conv_intrinsic_minmax): Same. (gfc_conv_intrinsic_minmax_char): Same. (gfc_conv_intrinsic_anyall): Same. (gfc_conv_intrinsic_count): Same. (gfc_conv_intrinsic_arith): Same. (gfc_conv_intrinsic_minmaxloc): Same. (gfc_conv_intrinsic_minmaxval): Same. (gfc_conv_intrinsic_rrspacing): Same. (gfc_conv_intrinsic_array_transfer): Same. (gfc_conv_intrinsic_trim): Same. (gfc_conv_intrinsic_repeat): Same. From-SVN: r148442
2009-06-13 00:06:47 +02:00
extern tree finish_case_label (location_t, tree, tree);
extern tree cxx_maybe_build_cleanup (tree, tsubst_flags_t);
/* in decl2.c */
extern void note_mangling_alias (tree, tree);
extern void generate_mangling_aliases (void);
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
extern tree build_memfn_type (tree, tree, cp_cv_quals, cp_ref_qualifier);
extern tree build_pointer_ptrmemfn_type (tree);
extern tree change_return_type (tree, tree);
extern void maybe_retrofit_in_chrg (tree);
extern void maybe_make_one_only (tree);
extern bool vague_linkage_p (tree);
extern void grokclassfn (tree, tree,
enum overload_flags);
extern tree grok_array_decl (location_t, tree, tree, bool);
extern tree delete_sanity (tree, tree, bool, int, tsubst_flags_t);
extern tree check_classfn (tree, tree, tree);
extern void check_member_template (tree);
extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *,
re PR c++/26266 (Trouble with static const data members in template classes) PR c++/26266 * cp-tree.h (cp_finish_decl): Adjust declaration. (grokbitfield): Likewise. (finish_static_data_member_decl): Likewise. * init.c (constant_value_1): Ensure processing_template_decl when folding non-dependent initializers for static data members of dependent types. Return error_mark_node for erroneous initailizers. * class.c (get_vtable_decl): Use finish_decl, not cp_finish_decl. * decl.c (cp_make_fname_decl): Adjust call to cp_finish_decl. (cp_finish_decl): Add init_const_expr_p parameter. Set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (finish_decl): Adjust call to cp_finish_decl. (compute_array_index_type): Robustify. (start_method): Use finish_decl, not cp_finish_decl. * rtti.c (emit_tinfo_decl): Likewise. * except.c (initialize_handler_parm): Adjust call to cp_finish_decl. (expand_start_catch_block): Likewise. * cvt.c (build_up_reference): Adjust call to cp_finish_decl. * pt.c (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_expr): Use finish_decl, not cp_finish_decl. (instantiate_decl): Adjust call to cp_finish_decl. * name-lookup.c (pushdecl_top_level_1): Use finish_decl, not cp_finish_decl. * decl2.c (finish_static_data_member_decl): Add init_const_expr_p parameter. (grokfield): Likewise. * parser.c (cp_parser_condition): Check for constant initializers. (cp_parser_init_declarator): Adjust calls to grokfield and cp_finish_decl. Don't set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (cp_parser_member_declaration): Likewise. (cp_parser_objc_class_ivars): Likewise. PR c++/26266 * g++.dg/template/static22.C: New test. * g++.dg/template/static23.C: New test. * g++.dg/template/static24.C: New test. * g++.dg/template/non-dependent13.C: New test. From-SVN: r111229
2006-02-18 09:36:11 +01:00
tree, bool, tree, tree);
extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *,
tree, tree);
extern bool any_dependent_type_attributes_p (tree);
extern tree cp_reconstruct_complex_type (tree, tree);
extern bool attributes_naming_typedef_ok (tree);
extern void cplus_decl_attributes (tree *, tree, int);
extern void finish_anon_union (tree);
Merge debug-early branch into mainline. * dwarf2out.c: Remove deferred_locations*. (dwarf2_debug_hooks): Add early_finish hook. Remove global_decl hook. Add early_global_decl and late_global_decl hook. New global early_dwarf. New structure set_early_dwarf. (output_die): Indicate whether a DIE was generated early when generating assembly with -dA. (struct limbo_die_struct): Document created_for field. Remove file_table_last_lookup. (remove_AT): Return TRUE if successful. (remove_child_TAG): Clear die_parent. (reparent_child): New function abstracted from... (splice_child_die): ...here. (new_die): ICE if a DIE ends up in limbo too late. (check_die): New. (defer_location): Remove. (add_subscript_info): Reuse DW_TAG_subrange_type if available. (fill_variable_array_bounds): New. (decl_start_label): Call fill_variable_array_bounds. (gen_formal_parameter_die): Rewrite to reuse previously generated DIEs. (gen_subprogram_die): Same. (gen_variable_die): Same. (gen_const_die): Same. (gen_label_die): Same. (gen_lexical_block_die): Same. (decl_will_get_specification_p): New. (local_function_static): New. (gen_struct_or_union_type_die): Fill in variable-length fields. (gen_typedef_die): Fill in variable-length typedefs. (gen_tagged_type_die): Gracefully return on error_mark_node. Handle re-entrancy. (gen_type_die_with_usage): Handle variable-length types. Remove duplicate code for ARRAY_TYPE case. (process_scope_var): Only process imported modules during early dwarf. (dwarf2out_early_global_decl): New. (dwarf2out_late_global_decl): Rename from dwarf2out_global_decl. (dwarf2out_type_decl): Set early_dwarf while calling dwarf2out_decl. (dwarf2out_decl): Verify that we did not recreate a previously generated DIE. Do not return on DECL_EXTERNALs in VAR_DECLs. Abstract some code to local_function_static. (lookup_filename): Remove use of file_table_last_lookup. Gracefully exit on missing file_name. (dwarf2out_finish): Verify limbo list. Remove deferred_locations_list use. Move deferred_asm_name and limbo flushing to... (dwarf2out_early_finish): ...here. New. (dwarf2out_c_finalize): Remove set of deferred_location_list, deferred_asm_name, and file_table_last_lookup. * cgraph.h (referred_to_p): Add default argument. * cgraphunit.c (referred_to_p): Add and handle include_self argument. (analyze_functions): Add first_time argument. Call check_global_declaration for all symbols. Call late_global_decl for nodes for moribund nodes. (finalize_compilation_unit): Add new argument to analyze_functions. Call early_global_decl for functions. Call early_finish debug hook. * dbxout.c (dbxout_early_global_decl): New. (dbxout_late_global_decl): New. Adapted from dbxout_global_decl. (dbx_debug_hooks): Add new hooks. (xcoff_debug_hooks): Same. * debug.c (do_nothing_debug_hooks): Add early_finish field. Add early and late debug hooks. Remove global_decl hook. * debug.h (struct gcc_debug_hooks): Add early_finish, early_global_decl, and late_global_decl fields. Remove global_decl field. Document gcc_debug_hooks. * gengtype.c (output_typename): Remove. * godump.c (go_early_global_decl): New. (go_late_global_decl): New. (go_global_decl): Remove. (dump_go_spec_init): Remove global_decl. Add {early,late}_global_decl. * langhooks-def.h (LANG_HOOKS_WRITE_GLOBALS): Remove. (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): New. * langhooks.c (lhd_warn_unused_global_decl): Adjust comment. (write_global_declarations): Remove. (global_decl_processing): New. * langhooks.h (struct lang_hooks_for_decls): Remove final_write_globals field. Add post_compilation_parsing_cleanups field. * passes.c (rest_of_decl_compilation): Call early_global_decl. * sdbout.c: Add early and late_global_decl hooks. Remove sdbout_global_decl hook. Add early_finish field for sdb_debug_hooks. (sdbout_global_decl): Remove. (sdbout_early_global_decl): New. (sdbout_late_global_decl): New. * timevar.def (TV_PHASE_LATE_PARSING_CLEANUPS): New. * toplev.c (check_global_declaration): Rename from check_global_declaration_1. Adapt to use symtab infrastructure. (check_global_declarations): Remove. (emit_debug_global_declarations): Remove. (compile_file): Remove call to final_write_globals langhook. Run the actual compilation process. Perform any post compilation parser cleanups. Generate late debug info. * toplev.h (check_global_declaration): New. (check_global_declaration_1): Remove. (check_global_declarations): Remove. (write_global_declarations): Remove. (emit_debug_global_declarations): Remove. (global_decl_processing): New. * tree-core.h (struct tree_block): Add DIE field. * tree.h (BLOCK_DIE): New. * vmsdbgout.c (vmsdbgout_global_decl): Remove function and its use throughout. (vmsdbgout_early_global_decl): New. (vmsdbgout_late_global_decl): New. Add early_finish debug hook field to vmsdbg_debug_hooks. Remove vmsdbgout_decl to vmsdbgout_function_decl. Add early and late_global_decl debug hooks. From-SVN: r224161
2015-06-05 20:44:53 +02:00
extern void cxx_post_compilation_parsing_cleanups (void);
extern tree coerce_new_type (tree);
extern tree coerce_delete_type (tree);
extern void comdat_linkage (tree);
extern void determine_visibility (tree);
re PR c++/26905 (default-visibility class symbol improperly resolved as hidden-visibility) PR c++/26905 PR c++/26612 PR c++/27000 PR c++/26984 PR c++/19134 * tree.c (build_decl_stat): Don't hande #pragma visibility here. * c-common.c (c_determine_visibility): Handle it here. * c-decl.c (finish_decl): Call c_determine_visibility for functions, too. * flags.h (enum symbol_visibility): Sort from most to least visibility. * tree.h: Likewise. * varasm.c (default_assemble_visibility): Likewise. * c-common.c (handle_visibility_attribute): Complain about trying to give visibility to an already defined class, or trying to change declared visibility. Always attach the attribute. * cp/decl2.c (determine_visibility): Overhaul. (determine_visibility_from_class): Likewise. (min_vis_r, type_visibility, constrain_visibility): New fns. (constrain_visibility_for_template): Likewise. (constrain_class_visibility): Likewise. * cp/decl.c (cp_finish_decl): Call determine_visibility for function decls, too. * cp/name-lookup.c (pushtag): Call determine_visibility. * cp/decl.c (duplicate_decls): Don't copy visibility from template to specialization. * cp/pt.c (check_explicit_specialization): Likewise. (lookup_template_class, tsubst_decl): Call determine_visibility. * cp/class.c (finish_struct_1): Call constrain_class_visibility. PR c++/26905 PR c++/21675 PR c++/17470 * cp/parser.c (cp_parser_explicit_instantiation): Pass the attributes to grokdeclarator. (cp_parser_type_specifier): Allow 'enum __attribute ((...)) E'. (cp_parser_enum_specifier): Likewise. (cp_parser_elaborated_type_specifier): Apply attributes if this declares only the class. (cp_parser_class_specifier): Apply leading attributes immediately. * cp/semantics.c (begin_class_definition): Add attributes parameter, apply them to the type. * attribs.c (decl_attributes): Ignore type-in-place attributes once the type has been defined. PR c++/21581 PR c++/25915 * cp/tree.c (decl_anon_ns_mem_p): New function. * cp/cp-tree.h: Declare it. * cp/decl2.c (determine_visibility): Make anonymous namespace members static. (min_vis_r, constrain_visibility): Likewise. * cp/rtti.c (create_pseudo_type_info): Set TREE_PUBLIC on pseudo-types. * cp/decl.c (cxx_init_decl_processing): Set TREE_PUBLIC on global_namespace. * cp/name-lookup.c (push_namespace_with_attribs): Don't set TREE_PUBLIC on anonymous namespaces. From-SVN: r115086
2006-06-30 03:15:56 +02:00
extern void constrain_class_visibility (tree);
extern void reset_type_linkage (tree);
extern void tentative_decl_linkage (tree);
extern void import_export_decl (tree);
extern tree build_cleanup (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
extern tree build_offset_ref_call_from_tree (tree, vec<tree, va_gc> **,
tsubst_flags_t);
extern bool decl_defined_p (tree);
extern bool decl_constant_var_p (tree);
extern bool decl_maybe_constant_var_p (tree);
extern void no_linkage_error (tree);
extern void check_default_args (tree);
extern bool mark_used (tree);
extern bool mark_used (tree, tsubst_flags_t);
re PR c++/26266 (Trouble with static const data members in template classes) PR c++/26266 * cp-tree.h (cp_finish_decl): Adjust declaration. (grokbitfield): Likewise. (finish_static_data_member_decl): Likewise. * init.c (constant_value_1): Ensure processing_template_decl when folding non-dependent initializers for static data members of dependent types. Return error_mark_node for erroneous initailizers. * class.c (get_vtable_decl): Use finish_decl, not cp_finish_decl. * decl.c (cp_make_fname_decl): Adjust call to cp_finish_decl. (cp_finish_decl): Add init_const_expr_p parameter. Set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (finish_decl): Adjust call to cp_finish_decl. (compute_array_index_type): Robustify. (start_method): Use finish_decl, not cp_finish_decl. * rtti.c (emit_tinfo_decl): Likewise. * except.c (initialize_handler_parm): Adjust call to cp_finish_decl. (expand_start_catch_block): Likewise. * cvt.c (build_up_reference): Adjust call to cp_finish_decl. * pt.c (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_expr): Use finish_decl, not cp_finish_decl. (instantiate_decl): Adjust call to cp_finish_decl. * name-lookup.c (pushdecl_top_level_1): Use finish_decl, not cp_finish_decl. * decl2.c (finish_static_data_member_decl): Add init_const_expr_p parameter. (grokfield): Likewise. * parser.c (cp_parser_condition): Check for constant initializers. (cp_parser_init_declarator): Adjust calls to grokfield and cp_finish_decl. Don't set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (cp_parser_member_declaration): Likewise. (cp_parser_objc_class_ivars): Likewise. PR c++/26266 * g++.dg/template/static22.C: New test. * g++.dg/template/static23.C: New test. * g++.dg/template/static24.C: New test. * g++.dg/template/non-dependent13.C: New test. From-SVN: r111229
2006-02-18 09:36:11 +01:00
extern void finish_static_data_member_decl (tree, tree, bool, tree, int);
extern tree cp_build_parm_decl (tree, tree);
extern tree get_guard (tree);
Remove TARGET_RELAXED_ORDERING and optimize for weak memory models. This patch removes the special casing for targets with relaxed memory ordering and handles guard accesses with equivalent atomic load acquire operations. In this process we change the algorithm to load the guard variable with an atomic load that has ACQUIRE semantics. This then means that on targets which have weak memory models, the fast path is inlined and can directly use a load-acquire instruction where available (and yay! one more hook gone). 2015-06-04 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> PR c++/66192 PR target/66200 * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_RELAXED_ORDERING): Delete. * target.def (TARGET_RELAXED_ORDERING): Likewise. * config/alpha/alpha.c (TARGET_RELAXED_ORDERING): Likewise. * config/ia64/ia64.c (TARGET_RELAXED_ORDERING): Likewise. * config/rs6000/rs6000.c (TARGET_RELAXED_ORDERING): Likewise. * config/sparc/linux.h (SPARC_RELAXED_ORDERING): Likewise. * config/sparc/linux64.h (SPARC_RELAXED_ORDERING): Likewise. * config/sparc/sparc.c (TARGET_RELAXED_ORDERING): Likewise. * config/sparc/sparc.h (SPARC_RELAXED_ORDERING): Likewise. * system.h (TARGET_RELAXED_ORDERING): Poison. 2015-06-04 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> PR c++/66192 PR target/66200 * cp-tree.h (get_guard_cond): Adjust declaration * decl.c (expand_static_init): Use atomic load acquire and adjust call to get_guard_cond. * decl2.c (build_atomic_load_byte): New function. (get_guard_cond): Handle thread_safety. (one_static_initialization_or_destruction): Adjust call to get_guard_cond. From-SVN: r224118
2015-06-04 11:19:51 +02:00
extern tree get_guard_cond (tree, bool);
extern tree set_guard (tree);
extern tree get_tls_wrapper_fn (tree);
extern void mark_needed (tree);
extern bool decl_needed_p (tree);
extern void note_vague_linkage_fn (tree);
extern void note_variable_template_instantiation (tree);
2006-06-06 13:44:09 +02:00
extern tree build_artificial_parm (tree, tree);
extern bool possibly_inlined_p (tree);
extern int parm_index (tree);
Commit the vtable verification feature. Commit the vtable verification feature. This feature is designed to detect, at run time, if/when the vtable pointer in a C++ object has been corrupted, before allowing virtual calls through that pointer. If pointer corruption is detected, execution of the program is halted. libstdc++-v3 ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * fragment.am: Add XTEMPLATE_FLAGS. * configure.ac: Add definitions for --enable-vtable-verify. * acinclude.m4: Add --enable-vtable-verify and --disable-vtable-verify; define --enable-vtable-verify; define VTV_CXXFLAGS, VTV_PCH_CXXFLAGS and VTV_CXXLINKFLAGS. * config/abi/pre/gnu.ver: Export symbols for vtable verification. * libsupc++/Makefile.am: Define vtv_sources and add it to libsupc___la_SOURCES and libsupc__convenience_la_SOURCES. * libsupc++/vtv_stubs.cc: New file. * include/Makefile.am: Add VTV_PCH_CXXFLAGS to PCHFLAGS. * src/Makefile.am: Add VTV_CXXFLAGS to AM_CXXFLAGS; add VTV_CXXLINKFLAGS to CXXLINK. * src/c++98/Makefile.am: Comment out XTEMPLATE_FLAGS; add VTV_CXXFLAGS to AM_CXXFLAGS; add VTV_CXXXLINKFLAGS to CXXLINK. * src/C++11/Makefile.am: Ditto. * doc/xml/manual/configure.xml: Add entry for --enable-vtable-verify. * scripts/testsuite_flags.in: Add cxxvtvflags to Usage; cause cxxvtvflags to use VTV_CXXFLAGS and VTV_CXXLINKFLAGS. * testsuite/lib/libstdc++.exp: Add cxxvtvflags; add code to locate libvtv if --enable-vtable-verify was used; set cxxvtvflags; add cxxvtvflags to cxx_final. * testsuite/18_support/bad_exception/23591_thread-1.c: Add -fvtable-verify=none to compiler flags. * testsuite/17_intro/freestanding.cc: Add -fvtable-verify=none to compiler flags. * configure: Regenerated. * Makefile.in: Regenerated. * python/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * libsupc++/Makefile.in: Regenerated. * config.h.in: Regenerated. * po/Makefile.in: Regenerated. * src/Makefile.in: Regenerated. * src/c++98/Makefile.in: Regenerated. * src/c++11/Makefile.in: Regenerated. * doc/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. top level ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * configure.ac: Add target-libvtv to target_libraries; disable libvtv on non-linux systems; add target-libvtv to noconfigdirs; add libsupc++/.libs to C++ library search paths. * configure: Regenerated. * Makefile.def: Add libvtv to target_modules; make libvtv depend on libstdc++ and libgcc. * Makefile.in: Regenerated. include/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * vtv-change-permission.h: New file. contrib/ChangeLog: 2013-08-06 Caroline Tice4 <cmtice@google.com> * gcc_update: Add libvtv files. libgcc/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> config.host (extra_parts): Add vtv_start.o, vtv_end.o vtv_start_preinit.o and vtv_end_preinit.o. configure.ac: Add code to check/set enable_vtable_verify. Makefile.in: Add rules to build vtv_*.o, if enable_vtable_verify is true. vtv_start_preinit.c: New file. vtv_end_preinit.c: New file. vtv_start.c: New file. vtv_end.c: New file. configure: Regenerated. gcc/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * gcc.c (VTABLE_VERIFICATION_SPEC): New definition. (LINK_COMMAND_SPEC): Add VTABLE_VERIFICATION_SPEC. * tree-pass.h: Add pass_vtable_verify. * varasm.c (assemble_variable): Add code to properly set the comdat section and name for the .vtable_map_vars section. (assemble_vtyv_preinit_initializer): New function. (default_sectin_type_flags): Make sure .vtable_map_vars section has LINK_ONCE flag. * output.h: Add function decl for assemble_vtv_preinit_initializer. * vtable-verify.c: New file. * vtable-verify.h: New file. * flag-types.h (enum vtv_priority): Defintions for flag_vtable_verify initialiation levels. * timevar.def (TV_VTABLE_VERIFICATION): New definition. * passes.def: Insert pass_vtable_verify. * aclocal.m4: Reorder includes. * doc/invoke.texi: Add documentation for the flags -fvtable-verify=, -fvtv-debug and -fvtv-counts. * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Add vtv_start*.o, as appropriate, if -fvtable-verify=... is used. (GNU_USER_TARGET_ENDFILE_SPEC): Add vtv_end*.o as appropriate, if -fvtable-verify=... is used. * Makefile.in (OBJS): Add vtable-verify.o to list. (vtable-verify.o): Add new build rule. (GTFILES): Add vtable-verify.c to list. * common.opt (fvtable-verify=): New flag. (vtv_priority): Values for fvtable-verify= flag. (fvtv-counts): New flag. (fvtv-debug): New flag. * tree.h (save_vtable_map_decl): New extern function decl. gcc/cp/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * Make-lang.in (*CXX_AND_OBJCXX_OBJS): Add vtable-class-hierarchy.o to list. (vtable-class-hierarchy.o): Add build rule. * cp-tree.h (vtv_start_verification_constructor_init_function): New extern function decl. (vtv_finish_verification_constructor_init_function): New extern function decl. (build_vtbl_address): New extern function decl. (get_mangled_vtable_map_var_name): New extern function decl. (vtv_compute_class_hierarchy_transitive_closure): New extern function decl. (vtv_generate_init_routine): New extern function decl. (vtv_save_class_info): New extern function decl. (vtv_recover_class_info): New extern function decl. (vtv_build_vtable_verify_fndecl): New extern function decl. * class.c (finish_struct_1): Add call to vtv_save_class_info if flag_vtable_verify is true. * config-lang.in: Add vtable-class-hierarchy.c to gtfiles list. * vtable-class-hierarchy.c: New file. * mangle.c (get_mangled_vtable_map_var_name): New function. * decl2.c (start_objects): Update function comment. (cp_write_global_declarations): Call vtv_recover_class_info, vtv_compute_class_hierarchy_transitive_closure and vtv_build_vtable_verify_fndecl, before calling finalize_compilation_unit, and call vtv_generate_init_rount after, IFF flag_vtable_verify is true. (vtv_start_verification_constructor_init_function): New function. (vtv_finish_verification_constructor_init_function): New function. * init.c (build_vtbl_address): Remove static qualifier from function. libvtv/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> Initial check-in of new vtable verification feature. * configure.ac : New file. * acinclude.m4 : New file. * Makefile.am : New file. * aclocal.m4 : New file. * configure.tgt : New file. * configure: New file (generated). * Makefile.in: New file (generated). * vtv_set.h : New file. * vtv_utils.cc : New file. * vtv_utils.h : New file. * vtv_malloc.cc : New file. * vtv_rts.cc : New file. * vtv_malloc.h : New file. * vtv_rts.h : New file. * vtv_fail.cc : New file. * vtv_fail.h : New file. * vtv_map.h : New file. * scripts/run-testsuite.sh : New file. * scripts/sum-vtv-counts.c : New file. * testsuite/parts-test-main.h : New file. * testusite/dataentry.cc : New file. * testsuite/temp_deriv.cc : New file. * testsuite/register_pair.cc : New file. * testsuite/virtual_inheritance.cc : New file. * testsuite/field-test.cc : New file. * testsuite/nested_vcall_test.cc : New file. * testsuite/template-list-iostream.cc : New file. * testsuite/register_pair_inserts.cc : New file. * testsuite/register_pair_inserts_mt.cc : New file. * testsuite/event.list : New file. * testsuite/parts-test-extra-parts-views.cc : New file. * testsuite/parts-test-extra-parts-views.h : New file. * testsuite/environment-fail-32.s : New file. * testsuite/parts-test-extra-parts.h : New file. * testsuite/temp_deriv2.cc : New file. * testsuite/dlopen_mt.cc : New file. * testsuite/event.h : New file. * testsuite/template-list.cc : New file. * testsuite/replace-fail.cc : New file. * testsuite/Makefile.am : New file. * testsuite/Makefile.in: New file (generated). * testsuite/mempool_negative.c : New file. * testsuite/parts-test-main.cc : New file. * testsuite/event-private.cc : New file. * testsuite/thunk.cc : New file. * testsuite/event-defintiions.cc : New file. * testsuite/event-private.h : New file. * testsuite/parts-test.list : New file. * testusite/register_pair_mt.cc : New file. * testsuite/povray-derived.cc : New file. * testsuite/event-main.cc : New file. * testsuite/environment.cc : New file. * testsuite/template-list2.cc : New file. * testsuite/thunk_vtable_map_attack.cc : New file. * testsuite/parts-test-extra-parts.cc : New file. * testsuite/environment-fail-64.s : New file. * testsuite/dlopen.cc : New file. * testsuite/so.cc : New file. * testsuite/temp_deriv3.cc : New file. * testsuite/const_vtable.cc : New file. * testsuite/mempool_positive.c : New file. * testsuite/dup_name.cc : New file. From-SVN: r201555
2013-08-07 05:38:59 +02:00
extern tree vtv_start_verification_constructor_init_function (void);
extern tree vtv_finish_verification_constructor_init_function (tree);
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
extern bool cp_omp_mappable_type (tree);
1994-02-24 02:02:37 +01:00
/* in error.c */
extern const char *type_as_string (tree, int);
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
extern const char *type_as_string_translate (tree, int);
extern const char *decl_as_string (tree, int);
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
extern const char *decl_as_string_translate (tree, int);
extern const char *decl_as_dwarf_string (tree, int);
extern const char *expr_as_string (tree, int);
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
extern const char *lang_decl_name (tree, int, bool);
extern const char *lang_decl_dwarf_name (tree, int, bool);
extern const char *language_to_string (enum languages);
extern const char *class_key_or_enum_as_string (tree);
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
extern void maybe_warn_variadic_templates (void);
extern void maybe_warn_cpp0x (cpp0x_warn_str str);
extern bool pedwarn_cxx98 (location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
extern location_t location_of (tree);
extern void qualified_name_lookup_error (tree, tree, tree,
location_t);
/* in except.c */
extern void init_exception_processing (void);
extern tree expand_start_catch_block (tree);
extern void expand_end_catch_block (void);
extern tree build_exc_ptr (void);
extern tree build_throw (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int nothrow_libfn_p (const_tree);
extern void check_handlers (tree);
extern tree finish_noexcept_expr (tree, tsubst_flags_t);
extern bool expr_noexcept_p (tree, tsubst_flags_t);
extern void perform_deferred_noexcept_checks (void);
extern bool nothrow_spec_p (const_tree);
extern bool type_noexcept_p (const_tree);
extern bool type_throw_all_p (const_tree);
extern tree build_noexcept_spec (tree, int);
extern void choose_personality_routine (enum languages);
extern tree build_must_not_throw_expr (tree,tree);
extern tree eh_type_info (tree);
extern tree begin_eh_spec_block (void);
extern void finish_eh_spec_block (tree, tree);
langhooks-def.h (LANG_HOOKS_EH_RUNTIME_TYPE): Define. 2009-09-13 Richard Guenther <rguenther@suse.de> Rafael Avila de Espindola <espindola@google.com> * langhooks-def.h (LANG_HOOKS_EH_RUNTIME_TYPE): Define. (LANG_HOOKS_EH_PERSONALITY): Likewise. (LANG_HOOKS_INITIALIZER): Adjust. (lhd_pass_through_t): Declare. * langhooks.h (struct lang_hooks): Add eh_runtime_type and eh_personality. * langhooks.c (lhd_pass_through_t): New function. * dwarf2out.c (output_call_frame_info, dwarf2out_do_cfi_startproc, dwarf2out_begin_prologue): Use personality from current_function_decl. * expr.h (get_personality_function): Declare. * expr.c (get_personality_function): New function. (build_personality_function): Likewise. * libfuncs.h (libfunc_index): Remove LTI_eh_personality. (eh_personality_libfunc): Remove. * optabs.c (build_libfunc_function): New function split out from ... (init_one_libfunc): ... here. * tree.h (DECL_FUNCTION_PERSONALITY): New. (tree_function_decl): Add personality. (lhd_gcc_personality): Declare. (build_personality_function): Likewise. * tree.c (gcc_eh_personality_decl): New. (lhd_gcc_personality): New function. * except.h (lang_eh_runtime_type): Remove. (enum eh_personality_kind): New. (build_personality_function): Declare. (function_needs_eh_personality): Declare. * except.c (lang_eh_runtime_type): Remove. (function_needs_eh_personality): New function. (add_type_for_runtime): Call lang_hooks.type_for_runtime instead. (sjlj_emit_function_enter, output_function_exception_table): Use personality from current_function_decl. * tree-eh.c (lower_eh_constructs): Set DECL_FUNCTION_PERSONALITY. * tree-inline.c (tree_can_inline_p): Do not inline across different EH personalities. (expand_call_inline): Likewise. Adjust the callers EH personality. (tree_function_versioning): Copy DECL_FUNCTION_PERSONALITY. * cgraph.c (cgraph_add_new_function): Set DECL_FUNCTION_PERSONALITY. * Makefile.in (cgraph.o): Add $(EXCEPT_H) dependency. (c-parser.o): Likewise * c-tree.h (c_eh_initialized_p): Remove. (c_maybe_initialize_eh): Likewise. * c-decl.c (finish_decl): Don't call c_maybe_initialize_eh. (finish_decl): Don't call c_maybe_initialize_eh. (c_eh_initialized_p): Remove. (c_maybe_initialize_eh): Likewise. * c-parser.c (c_parser_omp_construct): Likewise. (c_parse_file): Initialize exception handling. objc/ * objc-act.c (objc_eh_runtime_type): Export. (objc_init_exceptions): Remove. Move warning code ... (objc_begin_try_stmt): ... here (objc_build_throw_stmt): ... and here. (objc_eh_personality_decl): New. (objc_eh_personality): New function. * objc-act.h (objc_eh_runtime_type): Declare. (objc_eh_personality): Likewise. * objc-lang.c (LANG_HOOKS_EH_RUNTIME_TYPE): Define. (LANG_HOOKS_EH_PERSONALITY): Likewise. cp/ * except.c (init_exception_processing): Do not set lang_eh_runtime_type. (choose_personality_routine): Do not set eh_personality_decl, set pragma_java_exceptions. * cp-lang.c (LANG_HOOKS_EH_RUNTIME_TYPE): Define. (LANG_HOOKS_EH_PERSONALITY): Likewise. (cp_eh_personality_decl): New. (cp_eh_personality): Likewise. * Make-lang.in (cp-lang.o): Add $(EXPR_H) and $(EXCEPT_H) dependencies. java/ * decl.c (do_nothing): Remove. (java_init_decl_processing): Do not set lang_eh_runtime_type. * Make-lang.in (lang.o): Add $(EXCEPT_H) dependency. * lang.c (java_eh_personality): New. (java_eh_personality_decl): Likewise. (LANG_HOOKS_EH_PERSONALITY): Define. ada/ * gcc-interface/misc.c (gnat_init_gcc_eh): Do not set lang_eh_runtime_type. (LANG_HOOKS_EH_PERSONALITY): Define. (gnat_eh_personality_decl): New. (gnat_eh_personality): Likewise. * Make-lang.in (misc.o): Add gt-ada-misc.h dependency. * config-lang.in (gtfiles): Add misc.c. fortran/ * f95-lang.c (gfc_maybe_initialize_eh): Do not init eh_personality_libfunc. Co-Authored-By: Rafael Avila de Espindola <espindola@google.com> From-SVN: r151676
2009-09-13 21:40:33 +02:00
extern tree build_eh_type_type (tree);
system.h: Poison GCC_EXCEPT_H for front-end files. gcc/ChangeLog: 2010-06-28 Steven Bosscher <steven@gcc.gnu.org> * system.h: Poison GCC_EXCEPT_H for front-end files. * langhooks.h (struct lang_hooks): Add eh_protect_cleanup_actions langhook. * langhooks-def.h (LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS) New. Define to NULL by default. * except.h: Define GCC_EXCEPT_H. (doing_eh): Remove prototype. (init_eh, init_eh_for_function): Move prototypes to toplev.h. (lang_protect_cleanup_actions): Remove. * except.c (lang_protect_cleanup_actions): Remove. (doing_eh): Remove. (gen_eh_region): Don't check doing_eh here. * toplev.h (init_eh, init_eh_for_function_): Moved from except.h. * tree-eh.c (honor_protect_cleanup_actions): Use new langhook instead of lang_protect_cleanup_actions. * omp-low.c (maybe_catch_exception): Likewise. * Makefile.in: Update dependencies. gcc/c-family/ChangeLog: 2010-06-28 Steven Bosscher <steven@gcc.gnu.org> * c-cppbuiltin.c: Do not include except.h. gcc/objc/ChangeLog: 2010-06-28 Steven Bosscher <steven@gcc.gnu.org> * objc-act.c: Do not include except.h. gcc/cp/ChangeLog: 2010-06-28 Steven Bosscher <steven@gcc.gnu.org> * init.c: Do not include except.h. * decl.c: Likewise. * expr.c: Likewise. * cp-lang.c: Likewise. * pt.c: Likewise. * semantics.c: Likewise. * decl2.c: Likewise. * except.c: Likewise. (init_exception_processing): Do not set the removed lang_protect_cleanup_actions here. (cp_protect_cleanup_actions): Make non-static and remove prototype. (doing_eh): New, moved from except.c but removed the do_warning flag. (expand_start_catch_block): Update doing_eh call. (expand_end_catch_block): Likewise. (build_throw): Likewise. * cp-tree.h: Prototype cp_protect_cleanup_actions. * cp-objcp-common.h: Set LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS to cp_protect_cleanup_actions. * Make-lang.in: Update dependencies. gcc/objcp/ChangeLog: 2010-06-28 Steven Bosscher <steven@gcc.gnu.org> * objcp-lang.c: Do not include except.h. * Make-lang.in: Update dependencies. gcc/java/ChangeLog: 2010-06-28 Steven Bosscher <steven@gcc.gnu.org> * lang.c: Do not include except.h * except.c: Likewise. (doing_eh): New, moved from except.c (in gcc/) but removed the do_warning flag. (maybe_start_try): Update doing_eh call. * Make-lang.in: Update dependencies. gcc/ada/ChangeLog: 2010-06-28 Steven Bosscher <steven@gcc.gnu.org> * gcc-interface/misc.c: Do not include except.h. * gcc-interface/Make-lang.in: Update dependencies. gcc/fortran/ChangeLog: 2010-06-28 Steven Bosscher <steven@gcc.gnu.org> * Make-lang.in: Update dependencies. From-SVN: r161484
2010-06-28 12:52:46 +02:00
extern tree cp_protect_cleanup_actions (void);
Added Compiler Support for _Cilk_spawn and _Cilk_sync for C++. gcc/c-family/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * cilk.c (cilk_outline): Made this function non-static. (gimplify_cilk_spawn): Removed pre_p and post_p arguments. (create_cilk_wrapper): Added a new parameter: a function pointer. (c_install_body_w_frame_cleanup): Remove (extract_free_variables): Added VEC_INIT_EXPR and CONSTRUCTOR case. * c-common.h (cilk_outline): New prototype. (gimplify_cilk_spawn): Removed two parameters. (cilk_install_body_with_frame_cleanup): New prototype. * c-gimplify.c (c_gimplify_expr): Added MODIFY_EXPR, CALL_EXPR and CILK_SPAWN_STMT case. gcc/c/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-objc-common.h (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Remove. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. (LANG_HOOKS_CILKPLUS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. * c-typeck.c (cilk_install_body_with_frame_cleanup): New function. gcc/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * langhooks.h (lang_hooks_for_decls): Remove lang_hooks_for_cilkplus. (lang_hooks_for_cilkplus): Remove. * langhooks.c (lhd_cilk_detect_spawn): Likewise. (lhd_install_body_with_frame_cleanup): Likewise. * langhooks-def.h (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. (LANG_HOOKS_CILKPLUS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. (LANG_HOOKS_DECLS): Remove LANG_HOOKS_CILKPLUS. * gimplify.c (gimplify_expr): Removed CILK_SPAWN_STMT case. (gimplify_modify_expr): Removed handling of _Cilk_spawn in expr. (gimplify_call_expr): Likewise. gcc/cp/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * cp-tree.h (cilk_valid_spawn): New prototype. (gimplify_cilk_spawn): Likewise. (create_try_catch_expr): Likewise. * decl.c (finish_function): Insert Cilk function-calls when a _Cilk_spawn is used in a function. * parser.c (cp_parser_postfix_expression): Added RID_CILK_SPAWN and RID_CILK_SYNC cases. * cp-cilkplus.c (set_cilk_except_flag): New function. (set_cilk_except_data): Likewise. (cilk_install_body_with_frame_cleanup): Likewise. * except.c (create_try_catch_expr): Likewise. * parser.h (IN_CILK_SPAWN): New #define. * pt.c (tsubst_expr): Added CILK_SPAWN_STMT and CILK_SYNC_STMT cases. * semantics.c (potential_constant_expression_1): Likewise. * typeck.c (cp_build_compound_expr): Reject a spawned function in a compound expression. (check_return_expr): Reject a spawned function in a return expression. * cp-gimplify.c (cp_gimplify_expr): Added a CILK_SPAWN_STMT and CALL_EXPR case. Added handling of spawned function in MODIFY_EXPR and INIT_EXPR. gcc/testsuite/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * g++.dg/cilk-plus/CK/catch_exc.cc: New test case. * g++.dg/cilk-plus/CK/const_spawn.cc: Likewise. * g++.dg/cilk-plus/CK/fib-opr-overload.cc: Likewise. * g++.dg/cilk-plus/CK/fib-tplt.cc: Likewise. * g++.dg/cilk-plus/CK/lambda_spawns.cc: Likewise. * g++.dg/cilk-plus/CK/lambda_spawns_tplt.cc: Likewise. * g++.dg/cilk-plus/cilk-plus.exp: Added support to run Cilk Keywords test stored in c-c++-common. Also, added the Cilk runtime's library to the ld_library_path. From-SVN: r205902
2013-12-11 19:23:27 +01:00
extern tree create_try_catch_expr (tree, tree);
1994-02-24 02:02:37 +01:00
/* in expr.c */
extern tree cplus_expand_constant (tree);
extern tree mark_rvalue_use (tree,
location_t = UNKNOWN_LOCATION,
bool = true);
C++ support for -Wunused-but-set-variable gcc/cp/ChangeLog: PR 18624 * cp-tree.h (mark_exp_read, mark_rvalue_use, mark_lvalue_use, mark_type_use): Declare ... * expr.c (mark_exp_read, mark_rvalue_use, mark_lvalue_use, mark_type_use): ... new fns. * typeck.c (cxx_sizeof_expr, cxx_alignof_expr): Call mark_type_use. (perform_integral_promotions): Call mark_rvalue_use. (cp_build_unary_op): Call mark_lvalue_use. (decay_conversion): Update comment. Call mark_lvalue. * decl.c (unused_but_set_errorcount): New variable. (poplevel): Issue -Wunused-but-set-variable diagnostics. (duplicate_decls): Merge DECL_READ_P flags. (start_cleanup_fn): Set DECL_READ_P flag. (finish_function): Issue -Wunused-but-set-parameter diagnostics. * tree.c (rvalue): Call mark_rvalue_use. * pt.c (convert_nontype_argument): Likewise. * semantics.c (finish_typeof, finish_decltype_type): Call mark_type_use. (finish_asm_stmt): Call mark_lvalue_use. (finish_expr_stmt): Call mark_exp_read. * call.c (convert_like_real) <ck_identity, ck_user>: Call mark_rvalue_use. (build_x_va_arg): Call mark_lvalue_use. (build_over_call): Call mark_type_use. * init.c (build_new, build_delete): Call mark_value_use. * rtti.c (build_typeid): Call mark_lvalue_use or mark_type_use. (build_dynamic_cast_1): call mark_lvalue_use or mark_rvalue_use. gcc/testsuite/ChangeLog: PR 18624 * g++.dg/warn/Wunused-7.C: Add dg-warning. * g++.dg/template/sfinae16.C: Likewise. * gcc.dg/Wunused-var-1.c: Moved to... * c-c++-common/Wunused-var-1.c: ...here. New test. * gcc.dg/Wunused-var-2.c: Moved to... * c-c++-common/Wunused-var-2.c: ...here. New test. * gcc.dg/Wunused-var-3.c: Moved to... * c-c++-common/Wunused-var-3.c: ...here. New test. * gcc.dg/Wunused-var-4.c: Moved to... * gcc.dg/Wunused-var-1.c: ... here. * gcc.dg/Wunused-var-5.c: Moved to... * c-c++-common/Wunused-var-4.c: ...here. New test. * gcc.dg/Wunused-var-7.c: Moved to... * c-c++-common/Wunused-var-5.c: ...here. New test. * gcc.dg/Wunused-var-6.c: Moved to... * gcc.dg/Wunused-var-2.c: ... here. * c-c++-common/Wunused-var-1.c: New test. * c-c++-common/Wunused-var-2.c: New test. * c-c++-common/Wunused-var-3.c: New test. * c-c++-common/Wunused-var-4.c: New test. * c-c++-common/Wunused-var-5.c: New test. * g++.dg/warn/Wunused-var-1.C: New test. * g++.dg/warn/Wunused-var-2.C: New test. * g++.dg/warn/Wunused-var-3.C: New test. * g++.dg/warn/Wunused-var-4.C: New test. * g++.dg/warn/Wunused-var-5.C: New test. * g++.dg/warn/Wunused-var-6.C: New test. * g++.dg/warn/Wunused-var-7.C: New test. * g++.dg/warn/Wunused-var-8.C: New test. * g++.dg/warn/Wunused-parm-1.C: New test. * g++.dg/warn/Wunused-parm-2.C: New test. * g++.dg/warn/Wunused-parm-3.C: New test. Co-Authored-By: Dodji Seketeli <dodji@redhat.com> From-SVN: r159096
2010-05-06 08:52:30 +02:00
extern tree mark_lvalue_use (tree);
extern tree mark_type_use (tree);
extern void mark_exp_read (tree);
1994-02-24 02:02:37 +01:00
/* friend.c */
extern int is_friend (tree, tree);
extern void make_friend_class (tree, tree, bool);
extern void add_friend (tree, tree, bool);
extern tree do_friend (tree, tree, tree, tree, enum overload_flags, bool);
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
extern void set_global_friend (tree);
extern bool is_global_friend (tree);
/* in init.c */
extern tree expand_member_init (tree);
extern void emit_mem_initializers (tree);
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
extern tree build_aggr_init (tree, tree, int,
tsubst_flags_t);
cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. 2008-03-21 Paolo Carlini <pcarlini@suse.de> * cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. (SET_IS_AGGR_TYPE): Rename to SET_CLASS_TYPE_P. (IS_AGGR_TYPE_CODE): Rename to RECORD_OR_UNION_CODE_P. (PROMOTES_TO_AGGR_TYPE): Remove. (CLASS_TYPE_P, TYPE_NON_AGGREGATE_CLASS): Adjust. * typeck.c (unary_complex_lvalue, build_modify_expr, convert_for_initialization): Adjust. * init.c (is_aggr_type): Remove. (is_class_type): Add. (build_offset_ref, build_new_1, build_vec_delete_1, build_vec_init, build_delete): Adjust. * lex.c (make_aggr_type): Remove. (make_class_type): Add. (cxx_make_type): Adjust. * class.c (finish_struct_1, fixed_type_or_null, is_empty_class): Adjust. * decl.c (build_typename_type, make_typename_type, make_unbound_class_template, cxx_init_decl_processing, check_tag_decl, groktypename, start_decl_1, layout_var_decl, check_initializer, cp_finish_decl, build_ptrmemfunc_type, grokparms, grok_op_properties, xref_tag, check_function_type): Adjust. * call.c (check_dtor_name, standard_conversion, implicit_conversion, add_builtin_candidate, add_builtin_candidates, build_user_type_conversion_1, convert_like_real, build_cxx_call, is_subseq, compare_ics): Adjust. * method.c (use_thunk): Adjust. * rtti.c (build_dynamic_cast_1, create_pseudo_type_info, create_tinfo_types): Adjust. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, convert_from_reference, ocp_convert, build_expr_type_conversion): Adjust. * tree.c (bind_template_template_parm, error_type): Adjust. * dump.c (cp_dump_tree): Adjust. * search.c (lookup_member): Adjust. * friend.c (make_friend_class, do_friend): Adjust. * typeck2.c (store_init_value, process_init_constructor_array, process_init_constructor_record, build_x_arrow, build_m_component_ref, build_functional_cast): Adjust. * pt.c (finish_member_template_decl, process_template_parm, lookup_template_class, tsubst_function_type, tsubst, tsubst_copy_and_build, get_template_base, bt_instantiate_type_proc): Adjust. * semantics.c (begin_class_definition, finish_base_specifier, finish_typeof, cxx_omp_predetermined_sharing, finish_decltype_type): Adjust. * name-lookup.c (constructor_name_p, push_overloaded_decl, do_class_using_decl, lookup_qualified_name, maybe_process_template_type_declaration): Adjust. * decl2.c (grok_array_decl, check_member_template, constrain_class_visibility): Adjust. * parser.c (cp_parser_class_name): Adjust. From-SVN: r133434
2008-03-21 19:56:51 +01:00
extern int is_class_type (tree, int);
extern tree get_type_value (tree);
extern tree build_zero_init (tree, tree, bool);
extern tree build_value_init (tree, tsubst_flags_t);
extern tree build_value_init_noctor (tree, tsubst_flags_t);
extern tree get_nsdmi (tree, bool);
extern tree build_offset_ref (tree, tree, bool,
tsubst_flags_t);
extern tree throw_bad_array_new_length (void);
extern bool type_has_new_extended_alignment (tree);
extern unsigned malloc_alignment (void);
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
extern tree build_new (vec<tree, va_gc> **, tree, tree,
vec<tree, va_gc> **, int,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern tree get_temp_regvar (tree, tree);
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
extern tree build_vec_init (tree, tree, tree, bool, int,
tsubst_flags_t);
extern tree build_delete (tree, tree,
special_function_kind,
int, int, tsubst_flags_t);
extern void push_base_cleanups (void);
extern tree build_vec_delete (tree, tree,
special_function_kind, int,
tsubst_flags_t);
extern tree create_temporary_var (tree);
extern void initialize_vtbl_ptrs (tree);
extern tree scalar_constant_value (tree);
extern tree decl_really_constant_value (tree);
extern int diagnose_uninitialized_cst_or_ref_member (tree, bool, bool);
Commit the vtable verification feature. Commit the vtable verification feature. This feature is designed to detect, at run time, if/when the vtable pointer in a C++ object has been corrupted, before allowing virtual calls through that pointer. If pointer corruption is detected, execution of the program is halted. libstdc++-v3 ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * fragment.am: Add XTEMPLATE_FLAGS. * configure.ac: Add definitions for --enable-vtable-verify. * acinclude.m4: Add --enable-vtable-verify and --disable-vtable-verify; define --enable-vtable-verify; define VTV_CXXFLAGS, VTV_PCH_CXXFLAGS and VTV_CXXLINKFLAGS. * config/abi/pre/gnu.ver: Export symbols for vtable verification. * libsupc++/Makefile.am: Define vtv_sources and add it to libsupc___la_SOURCES and libsupc__convenience_la_SOURCES. * libsupc++/vtv_stubs.cc: New file. * include/Makefile.am: Add VTV_PCH_CXXFLAGS to PCHFLAGS. * src/Makefile.am: Add VTV_CXXFLAGS to AM_CXXFLAGS; add VTV_CXXLINKFLAGS to CXXLINK. * src/c++98/Makefile.am: Comment out XTEMPLATE_FLAGS; add VTV_CXXFLAGS to AM_CXXFLAGS; add VTV_CXXXLINKFLAGS to CXXLINK. * src/C++11/Makefile.am: Ditto. * doc/xml/manual/configure.xml: Add entry for --enable-vtable-verify. * scripts/testsuite_flags.in: Add cxxvtvflags to Usage; cause cxxvtvflags to use VTV_CXXFLAGS and VTV_CXXLINKFLAGS. * testsuite/lib/libstdc++.exp: Add cxxvtvflags; add code to locate libvtv if --enable-vtable-verify was used; set cxxvtvflags; add cxxvtvflags to cxx_final. * testsuite/18_support/bad_exception/23591_thread-1.c: Add -fvtable-verify=none to compiler flags. * testsuite/17_intro/freestanding.cc: Add -fvtable-verify=none to compiler flags. * configure: Regenerated. * Makefile.in: Regenerated. * python/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * libsupc++/Makefile.in: Regenerated. * config.h.in: Regenerated. * po/Makefile.in: Regenerated. * src/Makefile.in: Regenerated. * src/c++98/Makefile.in: Regenerated. * src/c++11/Makefile.in: Regenerated. * doc/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. top level ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * configure.ac: Add target-libvtv to target_libraries; disable libvtv on non-linux systems; add target-libvtv to noconfigdirs; add libsupc++/.libs to C++ library search paths. * configure: Regenerated. * Makefile.def: Add libvtv to target_modules; make libvtv depend on libstdc++ and libgcc. * Makefile.in: Regenerated. include/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * vtv-change-permission.h: New file. contrib/ChangeLog: 2013-08-06 Caroline Tice4 <cmtice@google.com> * gcc_update: Add libvtv files. libgcc/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> config.host (extra_parts): Add vtv_start.o, vtv_end.o vtv_start_preinit.o and vtv_end_preinit.o. configure.ac: Add code to check/set enable_vtable_verify. Makefile.in: Add rules to build vtv_*.o, if enable_vtable_verify is true. vtv_start_preinit.c: New file. vtv_end_preinit.c: New file. vtv_start.c: New file. vtv_end.c: New file. configure: Regenerated. gcc/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * gcc.c (VTABLE_VERIFICATION_SPEC): New definition. (LINK_COMMAND_SPEC): Add VTABLE_VERIFICATION_SPEC. * tree-pass.h: Add pass_vtable_verify. * varasm.c (assemble_variable): Add code to properly set the comdat section and name for the .vtable_map_vars section. (assemble_vtyv_preinit_initializer): New function. (default_sectin_type_flags): Make sure .vtable_map_vars section has LINK_ONCE flag. * output.h: Add function decl for assemble_vtv_preinit_initializer. * vtable-verify.c: New file. * vtable-verify.h: New file. * flag-types.h (enum vtv_priority): Defintions for flag_vtable_verify initialiation levels. * timevar.def (TV_VTABLE_VERIFICATION): New definition. * passes.def: Insert pass_vtable_verify. * aclocal.m4: Reorder includes. * doc/invoke.texi: Add documentation for the flags -fvtable-verify=, -fvtv-debug and -fvtv-counts. * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Add vtv_start*.o, as appropriate, if -fvtable-verify=... is used. (GNU_USER_TARGET_ENDFILE_SPEC): Add vtv_end*.o as appropriate, if -fvtable-verify=... is used. * Makefile.in (OBJS): Add vtable-verify.o to list. (vtable-verify.o): Add new build rule. (GTFILES): Add vtable-verify.c to list. * common.opt (fvtable-verify=): New flag. (vtv_priority): Values for fvtable-verify= flag. (fvtv-counts): New flag. (fvtv-debug): New flag. * tree.h (save_vtable_map_decl): New extern function decl. gcc/cp/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * Make-lang.in (*CXX_AND_OBJCXX_OBJS): Add vtable-class-hierarchy.o to list. (vtable-class-hierarchy.o): Add build rule. * cp-tree.h (vtv_start_verification_constructor_init_function): New extern function decl. (vtv_finish_verification_constructor_init_function): New extern function decl. (build_vtbl_address): New extern function decl. (get_mangled_vtable_map_var_name): New extern function decl. (vtv_compute_class_hierarchy_transitive_closure): New extern function decl. (vtv_generate_init_routine): New extern function decl. (vtv_save_class_info): New extern function decl. (vtv_recover_class_info): New extern function decl. (vtv_build_vtable_verify_fndecl): New extern function decl. * class.c (finish_struct_1): Add call to vtv_save_class_info if flag_vtable_verify is true. * config-lang.in: Add vtable-class-hierarchy.c to gtfiles list. * vtable-class-hierarchy.c: New file. * mangle.c (get_mangled_vtable_map_var_name): New function. * decl2.c (start_objects): Update function comment. (cp_write_global_declarations): Call vtv_recover_class_info, vtv_compute_class_hierarchy_transitive_closure and vtv_build_vtable_verify_fndecl, before calling finalize_compilation_unit, and call vtv_generate_init_rount after, IFF flag_vtable_verify is true. (vtv_start_verification_constructor_init_function): New function. (vtv_finish_verification_constructor_init_function): New function. * init.c (build_vtbl_address): Remove static qualifier from function. libvtv/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> Initial check-in of new vtable verification feature. * configure.ac : New file. * acinclude.m4 : New file. * Makefile.am : New file. * aclocal.m4 : New file. * configure.tgt : New file. * configure: New file (generated). * Makefile.in: New file (generated). * vtv_set.h : New file. * vtv_utils.cc : New file. * vtv_utils.h : New file. * vtv_malloc.cc : New file. * vtv_rts.cc : New file. * vtv_malloc.h : New file. * vtv_rts.h : New file. * vtv_fail.cc : New file. * vtv_fail.h : New file. * vtv_map.h : New file. * scripts/run-testsuite.sh : New file. * scripts/sum-vtv-counts.c : New file. * testsuite/parts-test-main.h : New file. * testusite/dataentry.cc : New file. * testsuite/temp_deriv.cc : New file. * testsuite/register_pair.cc : New file. * testsuite/virtual_inheritance.cc : New file. * testsuite/field-test.cc : New file. * testsuite/nested_vcall_test.cc : New file. * testsuite/template-list-iostream.cc : New file. * testsuite/register_pair_inserts.cc : New file. * testsuite/register_pair_inserts_mt.cc : New file. * testsuite/event.list : New file. * testsuite/parts-test-extra-parts-views.cc : New file. * testsuite/parts-test-extra-parts-views.h : New file. * testsuite/environment-fail-32.s : New file. * testsuite/parts-test-extra-parts.h : New file. * testsuite/temp_deriv2.cc : New file. * testsuite/dlopen_mt.cc : New file. * testsuite/event.h : New file. * testsuite/template-list.cc : New file. * testsuite/replace-fail.cc : New file. * testsuite/Makefile.am : New file. * testsuite/Makefile.in: New file (generated). * testsuite/mempool_negative.c : New file. * testsuite/parts-test-main.cc : New file. * testsuite/event-private.cc : New file. * testsuite/thunk.cc : New file. * testsuite/event-defintiions.cc : New file. * testsuite/event-private.h : New file. * testsuite/parts-test.list : New file. * testusite/register_pair_mt.cc : New file. * testsuite/povray-derived.cc : New file. * testsuite/event-main.cc : New file. * testsuite/environment.cc : New file. * testsuite/template-list2.cc : New file. * testsuite/thunk_vtable_map_attack.cc : New file. * testsuite/parts-test-extra-parts.cc : New file. * testsuite/environment-fail-64.s : New file. * testsuite/dlopen.cc : New file. * testsuite/so.cc : New file. * testsuite/temp_deriv3.cc : New file. * testsuite/const_vtable.cc : New file. * testsuite/mempool_positive.c : New file. * testsuite/dup_name.cc : New file. From-SVN: r201555
2013-08-07 05:38:59 +02:00
extern tree build_vtbl_address (tree);
extern bool maybe_reject_flexarray_init (tree, tree);
1994-02-24 02:02:37 +01:00
/* in lex.c */
extern void cxx_dup_lang_specific_decl (tree);
extern void yyungetc (int, int);
re PR c++/71238 (Undeclared function message imprecisely points to error column) /cp 2016-05-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/71238 * lex.c (unqualified_name_lookup_error): Take a location too. (unqualified_fn_lookup_error): Take a cp_expr. * cp-tree.h (unqualified_name_lookup_error, unqualified_fn_lookup_error): Adjust declarations. * semantics.c (perform_koenig_lookup): Adjust unqualified_fn_lookup_error call, pass the location of the identifier too as part of a cp_expr. /testsuite 2016-05-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/71238 * g++.dg/parse/pr71238.C: New. * g++.dg/concepts/friend1.C: Test column numbers too. * g++.dg/cpp0x/initlist31.C: Likewise. * g++.dg/cpp0x/pr51420.C: Likewise. * g++.dg/cpp0x/udlit-declare-neg.C: Likewise. * g++.dg/cpp0x/udlit-member-neg.C: Likewise. * g++.dg/ext/builtin3.C: Likewise. * g++.dg/lookup/friend12.C: Likewise. * g++.dg/lookup/friend7.C: Likewise. * g++.dg/lookup/koenig1.C: Likewise. * g++.dg/lookup/koenig5.C: Likewise. * g++.dg/lookup/used-before-declaration.C: Likewise. * g++.dg/overload/koenig1.C: Likewise. * g++.dg/template/crash65.C: Likewise. * g++.dg/template/friend57.C: Likewise. * g++.dg/warn/Wshadow-5.C: Likewise. * g++.dg/warn/Wunused-8.C: Likewise. * g++.old-deja/g++.bugs/900211_01.C: Likewise. * g++.old-deja/g++.jason/lineno5.C: Likewise. * g++.old-deja/g++.jason/member.C: Likewise. * g++.old-deja/g++.jason/report.C: Likewise. * g++.old-deja/g++.jason/scoping12.C: Likewise. * g++.old-deja/g++.law/visibility20.C: Likewise. * g++.old-deja/g++.ns/koenig5.C: Likewise. * g++.old-deja/g++.other/static5.C: Likewise. * g++.old-deja/g++.pt/overload2.C: Likewise. From-SVN: r236896
2016-05-30 21:18:13 +02:00
extern tree unqualified_name_lookup_error (tree,
location_t = UNKNOWN_LOCATION);
extern tree unqualified_fn_lookup_error (cp_expr);
extern tree build_lang_decl (enum tree_code, tree, tree);
extern tree build_lang_decl_loc (location_t, enum tree_code, tree, tree);
extern void retrofit_lang_decl (tree);
extern tree copy_decl (tree);
extern tree copy_type (tree);
extern tree cxx_make_type (enum tree_code);
cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. 2008-03-21 Paolo Carlini <pcarlini@suse.de> * cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. (SET_IS_AGGR_TYPE): Rename to SET_CLASS_TYPE_P. (IS_AGGR_TYPE_CODE): Rename to RECORD_OR_UNION_CODE_P. (PROMOTES_TO_AGGR_TYPE): Remove. (CLASS_TYPE_P, TYPE_NON_AGGREGATE_CLASS): Adjust. * typeck.c (unary_complex_lvalue, build_modify_expr, convert_for_initialization): Adjust. * init.c (is_aggr_type): Remove. (is_class_type): Add. (build_offset_ref, build_new_1, build_vec_delete_1, build_vec_init, build_delete): Adjust. * lex.c (make_aggr_type): Remove. (make_class_type): Add. (cxx_make_type): Adjust. * class.c (finish_struct_1, fixed_type_or_null, is_empty_class): Adjust. * decl.c (build_typename_type, make_typename_type, make_unbound_class_template, cxx_init_decl_processing, check_tag_decl, groktypename, start_decl_1, layout_var_decl, check_initializer, cp_finish_decl, build_ptrmemfunc_type, grokparms, grok_op_properties, xref_tag, check_function_type): Adjust. * call.c (check_dtor_name, standard_conversion, implicit_conversion, add_builtin_candidate, add_builtin_candidates, build_user_type_conversion_1, convert_like_real, build_cxx_call, is_subseq, compare_ics): Adjust. * method.c (use_thunk): Adjust. * rtti.c (build_dynamic_cast_1, create_pseudo_type_info, create_tinfo_types): Adjust. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, convert_from_reference, ocp_convert, build_expr_type_conversion): Adjust. * tree.c (bind_template_template_parm, error_type): Adjust. * dump.c (cp_dump_tree): Adjust. * search.c (lookup_member): Adjust. * friend.c (make_friend_class, do_friend): Adjust. * typeck2.c (store_init_value, process_init_constructor_array, process_init_constructor_record, build_x_arrow, build_m_component_ref, build_functional_cast): Adjust. * pt.c (finish_member_template_decl, process_template_parm, lookup_template_class, tsubst_function_type, tsubst, tsubst_copy_and_build, get_template_base, bt_instantiate_type_proc): Adjust. * semantics.c (begin_class_definition, finish_base_specifier, finish_typeof, cxx_omp_predetermined_sharing, finish_decltype_type): Adjust. * name-lookup.c (constructor_name_p, push_overloaded_decl, do_class_using_decl, lookup_qualified_name, maybe_process_template_type_declaration): Adjust. * decl2.c (grok_array_decl, check_member_template, constrain_class_visibility): Adjust. * parser.c (cp_parser_class_name): Adjust. From-SVN: r133434
2008-03-21 19:56:51 +01:00
extern tree make_class_type (enum tree_code);
c-common.h (c_common_init, [...]): Update. * c-common.h (c_common_init, c_common_post_options): Update. * c-objc-common.c (c_objc_common_init): Update for new prototype. * c-opts.c (saved_lineno): New. (c_common_post_options, c_common_init): Update prototypes, move call to cpp_read_main_file from latter to former. * c-tree.h (c_ojbc_common_init): Update. * langhooks-def.h (lhd_post_options): New. (LANG_HOOKS_INIT, LANG_HOOKS_POST_OPTIONS): Update. * langhooks.c (lhd_post_options): New. * langhooks.h (struct lang_hooks): Update post_options and init hooks. * toplev.c (no_backend): New. (process_options): Call post_options hook and set main_input_filename and input_filename here. (lang_dependent_init, do_compile): post_options hook moved to process_options. * objc/objc-act.c (objc_init): Update prototype. * objc/objc-act.h (objc_init): Update prototype. ada: * misc.c (gnat_init): Update for new prototype. cp: * cp-tree.h (cxx_init): Update prototype. * lex.c (cxx_init): Similarly. f: * com.c (ffe_init): Update prototype; move code to ffe_post_options. (ffe_post_options): New. java: * lang.c (java_init): Update prototype, move code to java_post_options. (java_post_options): Similarly. treelang: * tree1.c (in_fname): Fix type. (treelang_init): Update prototype and use of in_fname. * treelang.h (in_fname): Fix type. * treetree.c (tree_code_if_start, tree_code_if_else, tree_code_if_end, tree_code_create_function_prototype, tree_code_create_function_initial, tree_code_create_funciton_wrapup, tree_code_create_variable, tree_code_output_expression_statement) : Fix prototypes and use of filenames. * treetree.h: Similarly. From-SVN: r64001
2003-03-08 22:12:26 +01:00
extern bool cxx_init (void);
extern void cxx_finish (void);
extern bool in_main_input_context (void);
1994-02-24 02:02:37 +01:00
/* in method.c */
extern void init_method (void);
extern tree make_thunk (tree, bool, tree, tree);
extern void finish_thunk (tree);
extern void use_thunk (tree, bool);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
extern bool trivial_fn_p (tree);
extern tree forward_parm (tree);
extern bool is_trivially_xible (enum tree_code, tree, tree);
extern tree get_defaulted_eh_spec (tree);
extern tree unevaluated_noexcept_spec (void);
extern void after_nsdmi_defaulted_late_checks (tree);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
extern bool maybe_explain_implicit_delete (tree);
extern void explain_implicit_non_constexpr (tree);
extern void deduce_inheriting_ctor (tree);
extern void synthesize_method (tree);
extern tree lazily_declare_fn (special_function_kind,
tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern tree skip_artificial_parms_for (const_tree, tree);
extern int num_artificial_parms_for (const_tree);
extern tree make_alias_for (tree, tree);
extern tree get_copy_ctor (tree, tsubst_flags_t);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
extern tree get_copy_assign (tree);
extern tree get_default_ctor (tree);
extern tree get_dtor (tree, tsubst_flags_t);
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
extern tree strip_inheriting_ctors (tree);
extern tree inherited_ctor_binfo (tree);
extern bool ctor_omit_inherited_parms (tree);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
extern tree locate_ctor (tree);
extern tree implicitly_declare_fn (special_function_kind, tree,
bool, tree, tree);
1994-02-24 02:02:37 +01:00
Make-lang.in (CXX_SRCS): Add optimize.c. 1999-11-25 Mark Mitchell <mark@codesourcery.com> * Make-lang.in (CXX_SRCS): Add optimize.c. * Makefile.in (CXX_OBJS): Add optimize.o. (CXX_TREE_H): Add splay-tree.h, system.h, and $(CONFIG_H). (spew.o, lex.o, decl.o, decl2.o, typeck2.o, typeck.o): Adjust. (class.o, call.o, friend.o, init.o, method.o, cvt.o): Likewise. (search.o, tree.o, ptree.o, rtti.o, except.o, expr.o): Likewise. (xref.o, pt.o, error.o, errfn.o, repo.o, semantics.o): Likewise. (dump.o): Likewise. (optimize.o): New target. * class.c: Don't include splay-tree.h. * cp-tree.def (CTOR_COMPLETE): Rename to CTOR_STMT. * cp-tree.h: Include splay-tree.h. (DECL_UNINLINABLE): New macro. (CTOR_BEGIN_P, CTOR_END_P): New macros. (flag_inline_trees): New variable. (local_variable_p): New function. (nonstatic_local_decl_p): Likewise. (optimize_function): Likewise. (cplus_unsave_expr_now): Remove. (copy_tree_r): Declare. (remap_save_expr): Likewise. * decl.c (local_variable_p): Don't make it static. (local_variable_p_walkfn): New function. (make_rtl_for_local_static): Remove code to try to avoid writing out static constants. (emit_local_var): Fix indentation. (nonstatic_local_decl_p): New function. (check_default_argument): Use local_variable_p_walkfn, not local_variable_p, when walking the tree. (start_function): Set the DECL_CONTEXT for automatically generated labels. (finish_constructor_body): Use CTOR_STMT to mark the end of a constructor. * decl2.c: Don't include splay-tree.h. (flag_inline_trees): Define. * dump.c: Don't include splay-tree.h. * except.c (expand_end_catch_block): Fix comment formatting. (expand_end_eh_spec): Set DECL_CONTEXT on temporary variables. (expand_throw): Tidy comment. * init.c (build_vec_delete_1): Use create_temporary_var. * lex.c (cplus_tree_code_type): Make it static. (cplus_tree_code_length): Likewise. (cplus_tree_code_name): Likewise. * optimize.c: New file. * semantics.c (finish_goto_stmt): Set DECL_UNLINABLE for functions with computed gotos. (setup_vtbl_ptr): Mark the beginnings of constructors with CTOR_STMT. (expand_stmt): Handle CTOR_STMT, not CTOR_COMPLETE. (expand_body): Call optimize_function. Save bodies if we're doing inlining on trees. * tree.c: Don't include splay-tree.h. Include insn-config.h and integrate.h. (copy_tree_r): Make it public. (statement_code_p): New function. (mark_local_for_remap_r): Likewise. (cp_usave_r): Likewise. (cp_unsave): Likewise. (build_cplus_new): Set DECL_CONTEXT for temporary variables. (walk_tree): Walk into `s' class nodes. Walk statement chains. (copy_tree_r): Handle 's' class nodes. Restore chains for statements. Nullify scopes. Don't copy types. (init_tree): Set lang_unsave to cp_unsave. (remap_save_expr): Define. * ir.texi: Document CTOR_STMT. From-SVN: r30669
1999-11-25 21:32:04 +01:00
/* In optimize.c */
extern bool maybe_clone_body (tree);
Make-lang.in (CXX_SRCS): Add optimize.c. 1999-11-25 Mark Mitchell <mark@codesourcery.com> * Make-lang.in (CXX_SRCS): Add optimize.c. * Makefile.in (CXX_OBJS): Add optimize.o. (CXX_TREE_H): Add splay-tree.h, system.h, and $(CONFIG_H). (spew.o, lex.o, decl.o, decl2.o, typeck2.o, typeck.o): Adjust. (class.o, call.o, friend.o, init.o, method.o, cvt.o): Likewise. (search.o, tree.o, ptree.o, rtti.o, except.o, expr.o): Likewise. (xref.o, pt.o, error.o, errfn.o, repo.o, semantics.o): Likewise. (dump.o): Likewise. (optimize.o): New target. * class.c: Don't include splay-tree.h. * cp-tree.def (CTOR_COMPLETE): Rename to CTOR_STMT. * cp-tree.h: Include splay-tree.h. (DECL_UNINLINABLE): New macro. (CTOR_BEGIN_P, CTOR_END_P): New macros. (flag_inline_trees): New variable. (local_variable_p): New function. (nonstatic_local_decl_p): Likewise. (optimize_function): Likewise. (cplus_unsave_expr_now): Remove. (copy_tree_r): Declare. (remap_save_expr): Likewise. * decl.c (local_variable_p): Don't make it static. (local_variable_p_walkfn): New function. (make_rtl_for_local_static): Remove code to try to avoid writing out static constants. (emit_local_var): Fix indentation. (nonstatic_local_decl_p): New function. (check_default_argument): Use local_variable_p_walkfn, not local_variable_p, when walking the tree. (start_function): Set the DECL_CONTEXT for automatically generated labels. (finish_constructor_body): Use CTOR_STMT to mark the end of a constructor. * decl2.c: Don't include splay-tree.h. (flag_inline_trees): Define. * dump.c: Don't include splay-tree.h. * except.c (expand_end_catch_block): Fix comment formatting. (expand_end_eh_spec): Set DECL_CONTEXT on temporary variables. (expand_throw): Tidy comment. * init.c (build_vec_delete_1): Use create_temporary_var. * lex.c (cplus_tree_code_type): Make it static. (cplus_tree_code_length): Likewise. (cplus_tree_code_name): Likewise. * optimize.c: New file. * semantics.c (finish_goto_stmt): Set DECL_UNLINABLE for functions with computed gotos. (setup_vtbl_ptr): Mark the beginnings of constructors with CTOR_STMT. (expand_stmt): Handle CTOR_STMT, not CTOR_COMPLETE. (expand_body): Call optimize_function. Save bodies if we're doing inlining on trees. * tree.c: Don't include splay-tree.h. Include insn-config.h and integrate.h. (copy_tree_r): Make it public. (statement_code_p): New function. (mark_local_for_remap_r): Likewise. (cp_usave_r): Likewise. (cp_unsave): Likewise. (build_cplus_new): Set DECL_CONTEXT for temporary variables. (walk_tree): Walk into `s' class nodes. Walk statement chains. (copy_tree_r): Handle 's' class nodes. Restore chains for statements. Nullify scopes. Don't copy types. (init_tree): Set lang_unsave to cp_unsave. (remap_save_expr): Define. * ir.texi: Document CTOR_STMT. From-SVN: r30669
1999-11-25 21:32:04 +01:00
/* In parser.c */
Implement P0217R3 - C++17 structured bindings gcc/ * match.pd: Don't try to compare addresses of variables with DECL_VALUE_EXPR. gcc/cp/ * cp-tree.h (struct lang_decl_base): Add decomposition_p. (DECL_DECOMPOSITION_P): New (enum auto_deduction_context): Add adc_decomp_type. (enum cp_declarator_kind): Add cdk_decomp. * constexpr.c (cxx_eval_constant_expression): Look through DECL_VALUE_EXPR. (potential_constant_expression_1): Likewise. * decl.c (reshape_init): Preserve CONSTRUCTOR_IS_DIRECT_INIT. (check_initializer): Use build_aggr_init for DECL_DECOMPOSITION_P. (cp_finish_decl): Pass adc_decomp_type for decomposition. (find_decomp_class_base, get_tuple_size, get_tuple_element_type) (get_tuple_decomp_init, cp_finish_decomp): New. (grokdeclarator): Handle decomposition. * init.c (build_aggr_init): Handle decomposition array. (build_vec_init): Handle initialization from { array }. * name-lookup.c (add_function): Always wrap TEMPLATE_DECL in OVERLOAD. * parser.c (declarator_can_be_parameter_pack): Handle cdk_decomp. (function_declarator_p, strip_declarator_types) (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_range_for, cp_convert_range_for): Handle decomposition. (cp_parser_simple_declaration): Parse decomposition. (cp_parser_decomposition_declaration): New. * pt.c (tsubst_decomp_names): New. (subst_expr) [DECL_EXPR, RANGE_FOR_STMT]: Handle decomposition. (do_auto_deduction): Handle adc_decomp_type. * semantics.c (finish_decltype_type): Look through DECL_VALUE_EXPR. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. * tree.c (lvalue_kind): Likewise. (cp_build_reference_type): Handle reference collapsing. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r242377
2016-11-14 06:02:58 +01:00
extern tree cp_convert_range_for (tree, tree, tree, tree, unsigned int, bool);
extern bool parsing_nsdmi (void);
extern bool parsing_default_capturing_generic_lambda (void);
extern void inject_this_parameter (tree, cp_cv_quals);
/* in pt.c */
extern bool check_template_shadow (tree);
extern tree get_innermost_template_args (tree, int);
extern void maybe_begin_member_template_processing (tree);
extern void maybe_end_member_template_processing (void);
extern tree finish_member_template_decl (tree);
extern void begin_template_parm_list (void);
extern bool begin_specialization (void);
extern void reset_specialization (void);
extern void end_specialization (void);
extern void begin_explicit_instantiation (void);
extern void end_explicit_instantiation (void);
extern void check_unqualified_spec_or_inst (tree, location_t);
extern tree check_explicit_specialization (tree, tree, int, int);
extern int num_template_headers_for_class (tree);
extern void check_template_variable (tree);
extern tree make_auto (void);
extern tree make_decltype_auto (void);
extern tree make_template_placeholder (tree);
extern bool template_placeholder_p (tree);
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
extern tree do_auto_deduction (tree, tree, tree);
extern tree do_auto_deduction (tree, tree, tree,
tsubst_flags_t,
auto_deduction_context,
tree = NULL_TREE,
int = LOOKUP_NORMAL);
extern tree type_uses_auto (tree);
Support using 'auto' in a function parameter list to introduce an implicit template parameter. gcc/cp/ * cp-tree.h (type_uses_auto_or_concept): Declare. (is_auto_or_concept): Declare. * decl.c (grokdeclarator): Allow 'auto' parameters in lambdas with -std=gnu++1y or -std=c++1y or, as a GNU extension, in plain functions. * type-utils.h: New header defining ... (find_type_usage): ... this new function based on pt.c (type_uses_auto) for searching a type tree given a predicate. * pt.c (type_uses_auto): Reimplement via type-utils.h (find_type_usage). (is_auto_or_concept): New function. (type_uses_auto_or_concept): New function. * parser.h (struct cp_parser): Add fully_implicit_function_template_p. * parser.c (cp_parser_new): Initialize fully_implicit_function_template_p. (cp_parser_new): Initialize fully_implicit_function_template_p. (cp_parser_lambda_expression): Copy and restore value of fully_implicit_function_template_p as per other parser fields. (cp_parser_parameter_declaration_list): Count generic parameters and call ... (add_implicit_template_parms): ... this new function to synthesize them with help from type-utils.h (find_type_usage), ... (tree_type_is_auto_or_concept): ... this new static function and ... (make_generic_type_name): ... this new static function. (cp_parser_direct_declarator): Account for implicit template parameters. (cp_parser_lambda_declarator_opt): Finish fully implicit template if necessary by calling ... (finish_fully_implicit_template): ... this new function. (cp_parser_init_declarator): Likewise. (cp_parser_function_definition_after_declarator): Likewise. (cp_parser_member_declaration): Likewise. * Make-lang.in (cp/pt.o): Add dependency on type-utils.h. (cp/parser.o): Likewise. gcc/testsuite/ g++.dg/cpp0x/auto9.C: Downgrade two previously expected errors (now interpreted as implicit templates) to be expected pedwarns instead. From-SVN: r202612
2013-09-16 09:14:34 +02:00
extern tree type_uses_auto_or_concept (tree);
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01:00
extern void append_type_to_template_for_access_check (tree, tree, tree,
location_t);
extern tree convert_generic_types_to_packs (tree, int, int);
extern tree splice_late_return_type (tree, tree);
extern bool is_auto (const_tree);
Support using 'auto' in a function parameter list to introduce an implicit template parameter. gcc/cp/ * cp-tree.h (type_uses_auto_or_concept): Declare. (is_auto_or_concept): Declare. * decl.c (grokdeclarator): Allow 'auto' parameters in lambdas with -std=gnu++1y or -std=c++1y or, as a GNU extension, in plain functions. * type-utils.h: New header defining ... (find_type_usage): ... this new function based on pt.c (type_uses_auto) for searching a type tree given a predicate. * pt.c (type_uses_auto): Reimplement via type-utils.h (find_type_usage). (is_auto_or_concept): New function. (type_uses_auto_or_concept): New function. * parser.h (struct cp_parser): Add fully_implicit_function_template_p. * parser.c (cp_parser_new): Initialize fully_implicit_function_template_p. (cp_parser_new): Initialize fully_implicit_function_template_p. (cp_parser_lambda_expression): Copy and restore value of fully_implicit_function_template_p as per other parser fields. (cp_parser_parameter_declaration_list): Count generic parameters and call ... (add_implicit_template_parms): ... this new function to synthesize them with help from type-utils.h (find_type_usage), ... (tree_type_is_auto_or_concept): ... this new static function and ... (make_generic_type_name): ... this new static function. (cp_parser_direct_declarator): Account for implicit template parameters. (cp_parser_lambda_declarator_opt): Finish fully implicit template if necessary by calling ... (finish_fully_implicit_template): ... this new function. (cp_parser_init_declarator): Likewise. (cp_parser_function_definition_after_declarator): Likewise. (cp_parser_member_declaration): Likewise. * Make-lang.in (cp/pt.o): Add dependency on type-utils.h. (cp/parser.o): Likewise. gcc/testsuite/ g++.dg/cpp0x/auto9.C: Downgrade two previously expected errors (now interpreted as implicit templates) to be expected pedwarns instead. From-SVN: r202612
2013-09-16 09:14:34 +02:00
extern bool is_auto_or_concept (const_tree);
java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. gcc/java/ * java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. * expr.c (force_evaluation_order): Same. * typeck.c: Add location to build_decl or PUSH_FIELD calls. * class.c: Same. * decl.c: Same. * jcf-parse.c: Same. * constants.c: Same. * resource.c: Same. * except.c: Same. * builtins.c: Same. * expr.c: Same. * java-tree.h (PUSH_FIELD): Add location field. gcc/objc/ * objc-act.c (finish_var_decl): Pass location to finish_decl. (objc_get_parm_info): Same. (get_super_receiver): Same. * objc-act.c (objc_build_component_ref): Pass location to build_compound_ref. (build_module_initializer_routine): Pass location to c_end_compound_stmt. (objc_generate_static_init_call): Pass location to build_stmt. (build_typed_selector_reference): New location argument. (build_selector_reference): Same. (objc_substitute_decl): Pass location to build_array_ref. (next_sjlj_build_try_catch_finally): Pass location to build_stmt. (objc_begin_catch_clause): Same. (objc_finish_try_stmt): Same. (objc_finish_catch_clause): Pass location to c_end_compound_stmt. (objc_build_throw_stmt): New argument. (generate_shared_structures): Pass location to build_c_cast. (objc_build_message_expr): Use local location. (objc_finish_message_expr): Use input_location. (build_objc_method_call): New argument. (objc_build_selector_expr): Same. (get_super_receiver): Pass location to build_c_cast, build_modify_expr, build_compound_expr. * objc-act.c: Add location to all calls to start_struct, build_decl, finish_struct. gcc/ * tree-pretty-print.c (dump_generic_node): Dump column numbers. * gimple-pretty-print.c (dump_gimple_stmt): Same. * gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs created. * c-parser.c (c_parser_binary_expression): Use current column while building binary operations. * common.opt (fshow-column): Enable by default. * tree-vrp.c (check_array_ref): Use warning_at. (check_array_bounds): Use location from call back if expr has no location. * tree.h: Add location argument to maybe_fold_*. * tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*. (maybe_fold_offset_to_array_ref): Add location argument and use it. (maybe_fold_offset_to_component_ref): Same. (maybe_fold_offset_to_reference): Same. (maybe_fold_offset_to_address): Same. (maybe_fold_stmt_indirect): Same. (maybe_fold_stmt_addition): Same. (fold_stmt_r): Pass location to maybe_fold_*. (fold_gimple_assign): Same. * c-tree.h: Add location argument to finish_decl, default_function_array_conversion, store_init_value. * c-decl.c (define_label): Use error_at. (c_make_fname_decl): Pass location to finish_decl. (finish_decl): New location argument. (build_compound_literal): Pass location to store_init_value. (grokdeclarator): Pass location to finish_decl. (grokfield): Same. * c-typeck.c (array_to_pointer_conversion): New location argument. (function_to_pointer_conversion): Same. (default_function_array_conversion): Same. (parser_build_unary_op): Pass location to overflow_warning. (parser_build_binary_op): Same. Use warning_at. (build_unary_op): Pass location to array_to_pointer_conversion. (build_c_cast): Pass location to digest_init. (build_modify_expr): New location argument. (convert_for_assignment): Same. (store_init_value): Same. (digest_init): Same. (output_init_element): Pass location to digest_init and array_to_pointer_conversion. (c_finish_return): Pass location to convert_for_assignment. * gimplify.c (gimplify_conversion): Pass location to maybe_fold_offset_to_address. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location to maybe_fold_stmt_addition. * c-omp.c (c_finish_omp_atomic): Pass new location to build_modify_expr. (c_finish_omp_for): Same. * c-common.c (overflow_warning): New argument. * c-common.h: New argument to build_modify_expr, overflow_warning. * c-parser.c (c_parser_declaration_or_fndef): Pass location to finish_decl. (c_parser_initializer): Pass location to default_function_array_conversion. (c_parser_initelt): Same. (c_parser_initval): Same. (c_parser_asm_operands): Same. (c_parser_expr_no_commas): Same. Pass location to build_modify_expr. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Add location info to stack. Use it. (c_parser_unary_expression): Pass location to default_function_array_conversion, parser_build_unary_op, build_indirect_ref, c_parser_postfix_expression_after_primary. (c_parser_postfix_expression_after_primary): New location argument. Use it. (c_parser_expression_conv): Pass location to default_function_array_conversion. (c_parser_expr_list): Same. (c_parser_omp_atomic): Same. (c_parser_omp_for_loop): Same. * c-tree.h: (struct c_declarator): Add comment to id_loc. (build_array_declarator): New argument. * c-decl.c (build_array_declarator): Add location argument. (grokdeclarator): Set id_loc for cdk_array. * c-parser.c (c_parser_direct_declarator_inner): Pass location to build_array_declarator. * tree.c (build_omp_clause): Add location argument. * tree.h (OMP_CLAUSE_HAS_LOCATION): New macro. (OMP_CLAUSE_LOCATION): New macro. (struct tree_omp_clause): Add location field. (build_omp_clause): Add argument. * testsuite/gcc.dg/gomp/for-1.c: Fix column. * cp/pt.c (tsubst_omp_for_iterator): Pass location to build_omp_clause. * cp/parser.c (cp_parser_omp_var_list_no_open): Same. (cp_parser_omp_clause_collapse): Same. (cp_parser_omp_clause_default): Same. (cp_parser_omp_clause_if): Same. (cp_parser_omp_clause_nowait): Same. (cp_parser_omp_clause_num_threads): Same. (cp_parser_omp_clause_ordered): Same. (cp_parser_omp_clause_schedule): Same. (cp_parser_omp_clause_untied): Same. (cp_parser_omp_for_loop): Same. (cp_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (c_start_case): Add location argument. (c_process_expr_stmt): Same. (c_finish_goto_*): Same. * tree-parloops.c (initialize_reductions): Pass location to build_omp_clause. (create_parallel_loop): Same. * fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same. (gfc_trans_omp_reduction_list): Same. (gfc_trans_omp_clauses): Same. (gfc_trans_omp_do): Same. * c-typeck.c (c_finish_goto_label): Same. (c_finish_goto_ptr): New location argument. (c_start_case): Same. (emit_side_effect_warnings): Same. (c_process_expr_stmt): Same. (c_finish_stmt_expr): Same. (c_finish_omp_clauses): Use error_at instead of error. * gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to build_omp_clause. * c-omp.c (c_split_parallel_clauses): New location argument. * tree-nested.c (convert_nonlocal_reference_stmt): Pass location to build_omp_clause. (convert_local_reference_stmt): Same. (convert_gimple_call): Same. * c-common.h (c_split_parallel_clauses): New argument. * c-parser.c (c_parser_statement_after_labels): Pass location to c_finish_goto_label. (c_parser_switch_statement): Pass location to c_start_case. (c_parser_for_statement): Pass location to c_finish_expr_stmt, and c_process_expr_stmt. (c_parser_omp_variable_list): Add location argument. (c_parser_omp_clause_collapse): Pass location to build_omp_clause. (c_parser_omp_clause_default): Same. (c_parser_omp_clause_if): Same. (c_parser_omp_clause_num_threads): Same. (-c_parser_omp_clause_ordered): Same. (c_parser_omp_clause_reduction): Pass location to c_parser_omp_variable_list. (c_parser_omp_clause_schedule): Pass location to build_omp_clause. (c_parser_omp_clause_untied): Same. (c_parser_omp_for_loop): Pass location to c_process_expr_stmt. (c_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (check_for_loop_decls, undeclared_variable, build_component_ref, build_array_ref, build_external_ref, c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op, build_conditional_expr, build_compound_expr, c_cast_expr, build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr, c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New argument. * c-semantics.c (build_stmt): Same. (build_case_label): Same. * c-decl.c (c_finish_incomplete_decl): Pass location on down. (undeclared_variable): New argument. (make_label): Same. (lookup_label): Pass location on down. (define_label): Same. (finish_decl): Same. (build_compound_literal): Same. (finish_struct): Same. (finish_function): Do not set location here. (check_for_loop_decls): New argument. * tree.c (save_expr): Set location. (build_empty_stmt): New argument. * tree.h (build_empty_stmt): New argument to build_empty_stmt. (CAN_HAVE_LOCATION_P): Make sure we have a non empty node. * builtins.c (gimplify_va_arg_expr): Use locations. (expand_builtin_sync_operation): Same. * c-typeck.c (build_component_ref): New argument. (build_array_ref): Same. (build_external_ref): Same. (c_expr_sizeof_expr): Same. (c_expr_sizeof_type): Same. (parser_build_unary_op): Same. (build_conditional_expr): Same. (build_compound_expr): Pass location on down. (build_compound_expr): New argument. (build_c_cast): Same. (c_cast_expr): Same. (build_asm_expr): Same. (c_finish_return): Same. (c_process_expr_stmt): Pass location on down. (c_finish_stmt_expr): New argument. (push_clenaup): Same. (c_finish_omp_parallel): Same. (c_finish_omp_task): Same. * gimplify.c (gimplify_call_expr): Pass location on down. * c-omp.c (c_finish_omp_master): New argument. (c_finish_omp_critical): Same. (c_finish_omp_ordered): Same. (c_finish_omp_barrier): Same. (-c_finish_omp_taskwait): Same. (c_finish_omp_atomic): Same. (c_finish_omp_flush): Same. * tree-inline.c (copy_tree_body_r): Pass location on down. (inline_forbidden_p): Remove use of input_location. * c-gimplify.c (c_build_bind_expr): New argument. * c-common.c (c_common_truthvalue_conversion): Pass location on down. (c_sizeof_or_alignof_type): New argument. (c_alignof_expr): Same. (build_va_arg): Same. (c_add_case_label): Same. * c-common.h (c_sizeof_or_alignof_type, c_alignof_expr, c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label, c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt, c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered, c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush, c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses): New argument. * stub-objc.c (objc_build_selector_expr): Same. (objc_build_throw_stmt): Same. * c-parser.c (c_parser_declaration_or_fndef): Pass location on down. (c_parser_initelt): Same. (c_parser_compound_statement): Same. (c_parser_compound_statement_nostart): Same. (c_parser_label): Same. (c_parser_statement_after_labels): Same. (c_parser_if_body): Same. (c_parser_else_body): Same. (c_parser_if_statement): Same. (c_parser_switch_statement): Same. (c_parser_while_statement): Same. (c_parser_do_statement): Same. (c_parser_for_statement): Same. (c_parser_asm_statement): Same. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Same. (c_parser_cast_expression): Same. (c_parser_unary_expression): Same. (c_parser_sizeof_expression): Same. (c_parser_alignof_expression): Same. (c_parser_postfix_expression): Same. (c_parser_expression): Same. (c_parser_objc_receiver): Same. (c_parser_omp_variable_list): Same. (c_parser_omp_structured_block): Same. (c_parser_omp_atomic): New argument. (c_parser_omp_barrier): Same. (c_parser_omp_critical): Same. (c_parser_omp_flush): Pass location on down. (c_parser_omp_for_loop): New argument. (c_parser_omp_for): Same. (c_parser_omp_master): Same. (c_parser_omp_ordered): Same. (c_parser_omp_sections_scope): Same. (c_parser_omp_sections): Same. (c_parser_omp_parallel): Same. (c_parser_omp_single): Same. (c_parser_omp_task): Same. (c_parser_omp_taskwait): Pass location on down. (c_parser_omp_construct): Same. (c_parser_omp_threadprivate): Same. * dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h, builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c, tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c, c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c, c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c, emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c, rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h, tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c, config/i386/i386.c, stmt.c: Add location argument to the following function definitions and/or function calls: build_decl, objcp_start_struct, objcp_finish_struct, start_struct, finish_struct, PUSH_FIELD, create_artificial_label, cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl, build_compound_literal, parser_xref_tag, resolve_overloaded_builtin, do_case, c_finish_bc_stmt, build_compound_literal, build_function_call. * c-decl.c (build_compound_literal): Add location argument. Make all diagnostic calls use location. (start_struct): Same. (finish_struct): Same. (start_enum): Same. (build_enumerator): Same. (start_function): Same. (grokdeclarator): Make all diagnostic calls use location. (store_parm_decls_oldstyle): Same. * c-typeck.c (build_function_call): Add location argument. Make all diagnostic calls use location. (do_case): Same. (c_finish_bc_stmt): Same. * tree-nested.c (get_trampoline_type): Add argument. Pass location to build_decl. (lookup_tramp_for_decl): Pass location to get_trampoline_type. * rtl.h (RTL_LOCATION): New. * c-common.c (c_add_case_label): Add location argument. Make all diagnostic calls use location. * c-common.h: Add location argument to make_fname_decl, do_case, c_add_case_label, build_function_call, resolve_overloaded_builtin. * c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc. Set it appropriately for every case. Pass enum_loc to start_enum call. Pass value_loc first to build_enumerator. Pass enum_loc to parser_xref_tag. (c_parser_struct_or_union_specifier): Save location. Use it for start_struct, finish_struct, and parser_xref_tag. gcc/testsuite/ * gcc.dg/old-style-prom-3.c: Add column info. * gcc.dg/overflow-warn-1.c * gcc.dg/gomp/pr27415.c * gcc.dg/gomp/for-1.c: Same. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/c99-tag-3.c: Same. * gcc.dg/Wredundant-decls-2.c: Same. * gcc.dg/func-ptr-conv-1.c: Same. * gcc.dg/asm-wide-1.c: Same. * gcc.dg/nofixed-point-2.c: Same. * gcc.dg/cpp/line3.c: Same. * gcc.dg/array-10.c: Same. * gcc.dg/c99-vla-jump-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/Wshadow-3.c: Same. * gcc.dg/c90-const-expr-8.c: Same. * gcc.dg/label-decl-2.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/c90-const-expr-5.c: Same. * gcc.dg/builtins-30.c: Same. * gcc.dg/Warray-bounds.c: Same. * gcc.dg/Wcxx-compat-2.c: Same. * gcc.dg/tree-ssa/col-1.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/cast-function-1.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/vla-8.c: Same. * gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct line. * gcc.dg/label-decl-2.c: Move label diagnostic to correct line. * gcc.dg/old-style-prom-3.c: Check for error on the correct line. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/builtins-30.c: Same. Test for columns. gcc/objcp/ * objcp-decl.h (c_end_compound_stmt): New argument. * objcp-decl.c (objcp_start_struct): Add argument. (objcp_finish_struct): Same. gcc/cp/ * typeck.c (cp_build_binary_op): Pass location to overflow_warning. (build_modify_expr): New arg. * semantics.c (finish_unary_op_expr): Pass location to overflow_warning. (handle_omp_for_class_iterator): Pass location to build_modify_expr. * typeck.c (cxx_sizeof_or_alignof_type): Pass location to c_sizeof_or_alignof_type. (build_array_ref): New argument. (build_compound_expr): Same. (build_const_cast): Same. (build_ptrmemfunc): Pass location to build_c_cast. * init.c (avoid_placement_new_aliasing): Pass location to build_stmt. (build_vec_delete_1): Pass location to cp_build_modify_expr, build_compound_expr. * class.c (build_vtbl_ref_1): Pass location to build_array_ref. * decl.c (poplevel): Pass location to c_build_bind_expr. (finish_case_label): Pass location to build_case_label. (finish_constructor_body): Same. (finish_destructor_body): Pass location to build_stmt. (cxx_maybe_build_cleanup): Same, but to build_compound_expr. * call.c (build_new_op): Pass location to build_array_ref. (build_x_va_arg): Pass location to build_va_arg. * except.c (expand_end_catch_block): Pass location to build_stmt. * cp-tree.h (build_array_ref): New argument. (build_compound_expr): Same. (build_c_cast): Same. * cp-gimplify.c (gimplify_if_stmt): Pass location on down. (gimplify_switch_stmt): Same. * typeck2.c (split_nonconstant_init_1): Same. * pt.c (tsubst_copy): Same. * semantics.c (add_decl_expr): Same. (do_poplevel): Same. (push_cleanup): Same. (finish_goto_stmt): Same. (finish_expr_stmt): Same. (begin_if_stmt): Same. (begin_while_stmt): Same. (begin_do_stmt): Same. (finish_return_stmt): Same. (begin_for_stmt): Same. (finish_break_stmt): Same. (finish_continue_stmt): Same. (begin_switch_stmt): Same. (begin_try_block): Same. (begin_handler): Same. (finish_asm_stmt): Same. (finish_label_stmt): Same. (finish_stmt_expr_expr): Same. (finalize_nrv_r): Same. (finish_omp_atomic): Same. * name-lookup.c (do_using_directive): Same. * decl2.c (grok_array_decl): Same. * parser.c (cp_parser_cast_expression): Same. (cp_parser_selection_statement): Same. (cp_parser_implicitly_scoped_statement): Same. (cp_parser_objc_selector_expression): Same. (cp_parser_objc_synchronized_statement): Same. (cp_parser_objc_throw_statement): Same. (cp_parser_omp_critical): Same. (cp_parser_omp_master): Same. * typeck.c (build_function_call): Add location argument. * init.c: Add location argument to all build_decl calls. * class.c: Same. * method.c: Same. * rtti.c: Same. * tree.c: Same. * pt.c: Same. * semantics.c: Same. * lex.c: Same. * decl2.c: Same. * cp-gimplify.c: Same. * decl.c: Same. (cp_make_fname_decl): Add location argument. Pass location ot build_decl. (finish_case_label): Same. * cp-tree.h (finish_case_label): Add location argument. * parser.c (cp_parser_label_for_labeled_statement): Pass location to finish_case_label. gcc/fortran/ * trans-array.c (gfc_trans_allocate_array_storage): Pass location on down. (gfc_trans_array_constructor_value): Same. (gfc_trans_scalarized_loop_end): Same. (gfc_conv_ss_startstride): Same. (gfc_trans_g77_array): Same. (gfc_trans_dummy_array_bias): Same. (gfc_conv_array_parameter): Same. (structure_alloc_comps): Same. * trans-expr.c (gfc_conv_function_call): Same. (fill_with_spaces): Same. (gfc_trans_string_copy): Same. (gfc_trans_scalar_assign): Same. * trans-stmt.c (gfc_trans_goto): Same. (gfc_trans_if_1): Same. (gfc_trans_simple_do): Same. (gfc_trans_do): Same. (gfc_trans_do_while): Same. (gfc_trans_logical_select): Same. (gfc_trans_select): Same. (gfc_trans_forall_loop): Same. (gfc_trans_nested_forall_loop): Same. (generate_loop_for_temp_to_lhs): Same. (generate_loop_for_rhs_to_temp): Same. (gfc_trans_forall_1): Same. (gfc_trans_where_assign): Same. (gfc_trans_where_3): Same. (gfc_trans_allocate): Same. * trans.c (gfc_finish_block): Same. (gfc_trans_runtime_check): Same. (gfc_call_malloc): Same. (gfc_allocate_with_status): Same. (gfc_call_free): Same. (gfc_deallocate_with_status): Same. (gfc_call_realloc): Same. (gfc_trans_code): Same. * trans-decl.c (gfc_init_default_dt): Same. (gfc_generate_constructors): Same. * trans-io.c (gfc_trans_io_runtime_check): Same. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same. (gfc_conv_intrinsic_fdate): Same. (gfc_conv_intrinsic_ttynam): Same. (gfc_conv_intrinsic_minmax): Same. (gfc_conv_intrinsic_minmax_char): Same. (gfc_conv_intrinsic_anyall): Same. (gfc_conv_intrinsic_count): Same. (gfc_conv_intrinsic_arith): Same. (gfc_conv_intrinsic_minmaxloc): Same. (gfc_conv_intrinsic_minmaxval): Same. (gfc_conv_intrinsic_rrspacing): Same. (gfc_conv_intrinsic_array_transfer): Same. (gfc_conv_intrinsic_trim): Same. (gfc_conv_intrinsic_repeat): Same. From-SVN: r148442
2009-06-13 00:06:47 +02:00
extern tree process_template_parm (tree, location_t, tree,
bool, bool);
extern tree end_template_parm_list (tree);
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
extern void end_template_parm_list (void);
extern void end_template_decl (void);
extern tree maybe_update_decl_type (tree, tree);
extern bool check_default_tmpl_args (tree, tree, bool, bool, int);
extern tree push_template_decl (tree);
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
extern tree push_template_decl_real (tree, bool);
extern tree add_inherited_template_parms (tree, tree);
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
extern bool redeclare_class_template (tree, tree, tree);
extern tree lookup_template_class (tree, tree, tree, tree,
int, tsubst_flags_t);
extern tree lookup_template_function (tree, tree);
extern tree lookup_template_variable (tree, tree);
extern int uses_template_parms (tree);
extern bool uses_template_parms_level (tree, int);
extern bool in_template_function (void);
extern tree instantiate_class_template (tree);
extern tree instantiate_template (tree, tree, tsubst_flags_t);
extern tree fn_type_unification (tree, tree, tree,
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
const tree *, unsigned int,
re PR c++/45329 (When printing a list of candidate functions, explain why each function failed to match.) PR c++/45329 PR c++/48934 * cp-tree.h (fn_type_unification): Add `bool' parameter. * pt.c (enum template_base_result): Define. (unify_success, unify_unknown): Define. (unify_parameter_deduction_failure): Define. (unify_invalid, unify_cv_qual_mismatch, unify_type_mismatch): Define. (unify_parameter_pack_mismatch): Define. (unify_parameter_pack_inconsistent): Define. (unify_ptrmem_cst_mismatch, unify_vla_arg): Define. (unify_expression_unequal, unify_inconsistency): Define. (unify_method_type_error, unify_arity): Likewise. (unify_too_many_parameters, unify_too_few_parameters): Define. (unify_arg_conversion, unify_no_common_base): Define. (unify_illformed_ptrmem_cst_expr): Define. (unify_substitution_failure): Define. (unify_inconsistent_template_template_parameters): Define. (unify_template_deduction_failure): Define. (unify_template_argument_mismatch): Define. (unify_overload_resolution_failure): Define. (comp_template_args_with_info): New function, split out from... (comp_template_args): ...here. Call it. (deduction_tsubst_fntype): Add `complain' parameter'. Pass it to tsubst. (unify): Add `explain_p' parameter. Pass to all relevant calls. Call above status functions when appropriate. (resolve_overloaded_unification, try_one_overload): Likewise. (type_unification, type_unification_real): Likewise. (unify_pack_expansion): Likewise. (get_template_base, try_class_unification): Likewise. (get_bindings, more_specialized_fn): Pass false to unification calls. (get_class_bindings, do_auto_deduction): Likewise. (convert_nontype_argument): Likewise. (fn_type_unification): Likewise. Pass tf_warning_or_error if explain_p. (get_template_base): Add `explain_p' parameter and pass it to try_class_unification. Return an enum template_base_result. * class.c (resolve_address_of_overloaded_function): Pass false to fn_type_unification. * call.c (enum rejection_reason_code): Add new codes. (struct rejection_reason): Add template_unification field. Add template_instantiation field. (template_unification_rejection): Define. (template_unification_error_rejection): Define. (template_instantiation_rejection): Define. (invalid_copy_with_fn_template_rejection): Define. (add_template_candidate): Pass false to unify. Provide more rejection reasons when possible. (print_template_unification_rejection): Define. (print_arity_rejection): Define, split out from... (print_z_candidate): ...here. Add cases for new rejection reasons. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r176365
2011-07-17 04:34:10 +02:00
tree, unification_kind_t, int,
bool, bool);
extern void mark_decl_instantiated (tree, int);
extern int more_specialized_fn (tree, tree, int);
extern void do_decl_instantiation (tree, tree);
extern void do_type_instantiation (tree, tree, tsubst_flags_t);
extern bool always_instantiate_p (tree);
extern void maybe_instantiate_noexcept (tree);
extern tree instantiate_decl (tree, bool, bool);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int comp_template_parms (const_tree, const_tree);
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
extern bool uses_parameter_packs (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern bool template_parameter_pack_p (const_tree);
re PR debug/41266 (Emit DW_TAG_template_parameter_pack and DW_TAG_formal_parameter_pack) Fix for PR debug/41266 ChangeLog: * include/dwarf2.h (enum dwarf_tag): Add DW_TAG_template_parameter_pack and DW_TAG_formal_parameter_pack. gcc/ChangeLog: * dwarf2out.c (template_parameter_pack_die, gen_formal_parameter_pack_die ): New functions. (make_ith_pack_parameter_name): Remove this function. (dwarf_tag_name): Support printing DW_TAG_template_parameter_pack and DW_TAG_formal_parameter_pack. (gen_generic_params_dies): Represent each template parameter pack by a DW_TAG_template_parameter_pack DIE. Argument pack elements are represented by usual DW_TAG_template_*_parameter DIEs that are children of the DW_TAG_template_parameter_pack element DIE. (generic_parameter_die): This doesn't deal with parameter pack names anymore. Don't generate DW_AT_name for some DIEs, e.g. children of parameter pack DIEs. (gen_formal_parameter_die): Add a flag to not emit DW_AT_name in certain cases, e.g. for pack elements. (gen_formal_types_die, gen_decl_die): Adjust usage of gen_formal_parameter_die. (gen_subprogram_die): Represent each function parameter pack by a DW_TAG_formal_parameter_pack DIE. Arguments of of the pack are represented by usual DW_TAG_formal_parameter DIEs that are children of the DW_TAG_formal_parameter_pack DIE. Remove references to ____builtin_va_alist decls as no part of the compiler uses those anymore. * langhooks.h (struct lang_hooks_for_decls): Add function_parm_expanded_from_pack_p, get_generic_function_decl and function_parameter_pack_p hooks. Fix comment for get_innermost_generic_parms hook. * langhooks-def.h (LANG_HOOKS_FUNCTION_PARAMETER_PACK_P, LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P ): Declare new hook macros and use them to initialize lang_hook. gcc/cp/ChangeLog: * cp-lang.c (LANG_HOOKS_FUNCTION_PARAMETER_PACK_P, LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P, LANG_HOOKS_GET_GENERIC_FUNCTION_DECL): Initialize these hooks for the c++ FE. * cp-tree.h (function_parameter_pack_p, get_function_template_decl, function_parameter_expanded_from_pack_p): Declare ... * pt.c (function_parameter_pack_p, get_function_template_decl, function_parameter_expanded_from_pack_p): ... new hooks. (get_template_info): Make this more robust. (template_args_variadic_p, make_ith_pack_parameter_name): Add a new line between comment and function. (get_template_argument_pack_elems): Fix comment. (tsubst_decl): Arguments of function parameter packs are not parameter packs themselves. gcc/testsuite/ChangeLog: * g++.dg/debug/dwarf2/template-func-params-4.C: Adjust. * g++.dg/debug/dwarf2/template-func-params-7.C: Likewise. * g++.dg/debug/dwarf2/template-params-4.C: Likewise. From-SVN: r152043
2009-09-22 22:20:03 +02:00
extern bool function_parameter_pack_p (const_tree);
extern bool function_parameter_expanded_from_pack_p (tree, tree);
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
extern tree make_pack_expansion (tree);
re PR c++/34055 (ICE with invalid specialization of variadic template) 2008-01-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/34055 PR c++/34103 PR c++/34219 PR c++/34606 PR c++/34753 PR c++/34754 PR c++/34755 PR c++/34919 PR c++/34961 * c-pretty-print.c (pp_c_type_qualifier_list): Don't try to print qualifiers for an ERROR_MARK_NODE or a NULL_TREE. 2008-01-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/34055 PR c++/34103 PR c++/34219 PR c++/34606 PR c++/34753 PR c++/34754 PR c++/34755 PR c++/34919 PR c++/34961 * typeck.c (check_return_expr): Tweak call to check_for_bare_parameter_packs. * class.c (add_method): Be careful with error_mark_nodes. * cp-tree.h (check_for_bare_parameter_packs): Remove "*" from signature. * pt.c (struct find_parameter_pack_data): Remove SET_PACKS_TO_ERROR. (find_parameter_packs_r): Don't use SET_PACKS_TO_ERROR. (uses_parameter_packs): Don't set SET_PACKS_TO_ERROR. (make_pack_expansion): Ditto. (check_for_bare_parameter_packs): Parameter is now a tree, not a tree*. (process_template_parm): Tweak call to check_for_bare_parameter_packs. (push_template_decl_real): Tweak calls to check_for_bare_parameter_packs. If bare parameter packs are found in the list of exceptions, clear out that list after giving an error. * semantics.c (finish_cond): Tweak call to check_for_bare_parameter_packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. (finish_member_declaration): Ditto. (finish_static_assert): Check for bare parameter packs in the condition. * decl2.c (cplus_decl_attributes): Check for bare parameter packs in the attributes of a declaration. * parser.c (cp_parser_using_declaration): Tweak call to check_for_bare_parameter_packs. (cp_parser_base_clause): Ditto. 2008-01-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/34055 PR c++/34103 PR c++/34219 PR c++/34606 PR c++/34753 PR c++/34754 PR c++/34755 PR c++/34919 PR c++/34961 * g++.dg/cpp0x/vt-34219-2.C: New. * g++.dg/cpp0x/pr32126.C: Tweak expected error messages. * g++.dg/cpp0x/vt-34961.C: New. * g++.dg/cpp0x/vt-34055.C: Tweak error messages; add new test cases from the re-opened PR. * g++.dg/cpp0x/vt-34753.C: New. * g++.dg/cpp0x/vt-34919.C: New. * g++.dg/cpp0x/vt-34754.C: New. * g++.dg/cpp0x/vt-34606.C: New. * g++.dg/cpp0x/vt-34219.C: New. * g++.dg/cpp0x/pr32125.C: Tweak expected error messages. * g++.dg/cpp0x/vt-34755.C: New. * g++.dg/cpp0x/pr31438.C: Ditto. * g++.dg/cpp0x/variadic81.C: Ditto. From-SVN: r131938
2008-01-29 14:59:59 +01:00
extern bool check_for_bare_parameter_packs (tree);
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01:00
extern tree build_template_info (tree, tree);
Emit DWARF for template parameters (PR debug/30161) ChangeLog: PR debug/30161 * include/dwarf2.h (enum dwarf_tag): Added DW_TAG_GNU_template_template_param (enum dwarf_attribute): Added DW_AT_GNU_template_name. gcc/ChangeLog: PR debug/30161 * cgraph.h (cgraph_get_node): Declare ... * cgraph.c (cgraph_get_node): ... new function. * dwarf2out.c (gen_generic_params_dies, generic_parameter_die, tree_add_const_value_attribute_for_decl, make_ith_pack_parameter_name, append_entry_to_tmpl_value_parm_die_table, gen_remaining_tmpl_value_param_die_attribute): New functions. (gen_subprogram_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_const_die): Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_struct_or_union_type_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. (tree_add_const_value_attribute): Handle integral and pointer constants. Update comment. (dwarf_tag_name): Support DW_TAG_GNU_template_template_param. (dwarf_attr_name): Support DW_AT_GNU_template_name. (reference_to_unused): Fix thinko. Remove redundant predicates from tests. (tree_add_const_value_attribute): Make this work for constant expressions only. tree_add_const_value_attribute_for_decl is to be used for variable DECLs now. (add_location_or_const_value_attribute): Use tree_add_const_value_attribute_for_decl now. (dwarf2out_finish): Emit the DW_AT_const_value attribute of DW_TAG_template_value_param DIEs after function DIEs have been emitted. * langhooks.h (lang_hooks_for_types): Add get_argument_pack_elems. (lang_hooks_for_decls): Add generic_generic_parameter_decl_p. (lang_hooks): Added get_innermost_generic_parms, get_innermost_generic_args. * langhooks-def.h (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P): New language hooks. gcc/cp/ChangeLog: PR debug/30161 * cp-tree.h (get_template_info): Parameter should be const. (CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P): Fix typo. (get_template_argument_pack_elems, get_primary_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): Declare ... * pt.c (get_template_argument_pack_elems, get_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): ... New C++ front end implementation of new language hooks. (primary_template_instantiation_p): New private helper. (make_ith_pack_parameter_name): Use snprintf and strnlen instead of printf and strlen. (get_template_info): Const-ify parameter. * cp-lang.c (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_TYPE_PARAMETER_DECL_P): Initialize these interfaces for the C++ front-end. gcc/testsuite/ChangeLog: PR debug/30161 * g++.dg/debug/dwarf2/template-params-1.C: New test. * g++.dg/debug/dwarf2/template-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-1.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-7.C: Likewise. From-SVN: r151249
2009-08-31 23:48:04 +02:00
extern tree get_template_info (const_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
extern vec<qualified_typedef_usage_t, va_gc> *get_types_needing_access_check (tree);
extern int template_class_depth (tree);
extern int is_specialization_of (tree, tree);
extern bool is_specialization_of_friend (tree, tree);
extern tree get_pattern_parm (tree, tree);
extern int comp_template_args (tree, tree, tree * = NULL,
tree * = NULL, bool = false);
extern int template_args_equal (tree, tree, bool = false);
extern tree maybe_process_partial_specialization (tree);
extern tree most_specialized_instantiation (tree);
extern void print_candidates (tree);
extern void instantiate_pending_templates (int);
extern tree tsubst_default_argument (tree, tree, tree,
tsubst_flags_t);
extern tree tsubst (tree, tree, tsubst_flags_t, tree);
extern tree tsubst_copy_and_build (tree, tree, tsubst_flags_t,
tree, bool, bool);
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
extern tree tsubst_expr (tree, tree, tsubst_flags_t,
tree, bool);
extern tree tsubst_pack_expansion (tree, tree, tsubst_flags_t, tree);
extern tree most_general_template (tree);
extern tree get_mostly_instantiated_function_type (tree);
re PR c++/16564 (g++ seems to go into an infinite loop after errors) cp/ 2014-09-30 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/16564 * error.c (print_instantiation_context): Delete. * typeck2.c (build_x_arrow): Record location when pushing template instantiation. * pt.c (push_tinst_level): Make it a wrapper around ... (push_tinst_level_loc): ... this. New function. Make excessive template instantiation depth a fatal error. Record location. Use bool as return type. (instantiate_pending_templates): Make excessive template instantiation depth a fatal error. (problematic_instantiation_changed): Use bool as return type. * cp-tree.h (print_instantiation_context): Delete. (push_tinst_level): Update declaration. (problematic_instantiation_changed): Likewise. (push_tinst_level_loc): New. testsuite/ 2014-09-30 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/16564 * lib/gcc.exp: Accept "fatal error:" as error prefix. * lib/g++.exp: Likewise. * lib/obj-c++.exp: Likewise. * lib/objc.exp: Likewise. * g++.dg/template/pr16564.C: New test. 2014-09-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/16564 * g++.dg/cpp0x/decltype26.C: Adjust. * g++.dg/cpp0x/decltype28.C: Likewise. * g++.dg/cpp0x/decltype29.C: Likewise. * g++.dg/cpp0x/decltype32.C: Likewise. * g++.dg/cpp0x/enum11.C: Likewise. * g++.dg/template/arrow1.C: Likewise. * g++.dg/template/pr23510.C: Likewise. * g++.dg/template/recurse.C: Likewise. * g++.dg/template/recurse2.C: Likewise. * g++.dg/template/vtable2.C: Likewise. * g++.old-deja/g++.pt/infinite1.C: Likewise. From-SVN: r215733
2014-09-30 19:10:35 +02:00
extern bool problematic_instantiation_changed (void);
extern void record_last_problematic_instantiation (void);
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
extern struct tinst_level *current_instantiation(void);
extern bool instantiating_current_function_p (void);
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
extern tree maybe_get_template_decl_from_type_decl (tree);
extern int processing_template_parmlist;
extern bool dependent_type_p (tree);
extern bool dependent_scope_p (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern bool any_dependent_template_arguments_p (const_tree);
extern bool dependent_template_p (tree);
extern bool dependent_template_id_p (tree, tree);
extern bool type_dependent_expression_p (tree);
extern bool type_dependent_object_expression_p (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
extern bool any_type_dependent_arguments_p (const vec<tree, va_gc> *);
extern bool any_type_dependent_elements_p (const_tree);
extern bool type_dependent_expression_p_push (tree);
extern bool value_dependent_expression_p (tree);
extern bool instantiation_dependent_expression_p (tree);
extern bool instantiation_dependent_uneval_expression_p (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern bool any_value_dependent_elements_p (const_tree);
c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. * langhooks.h (struct lang_hooks_for_decls): Add omp_finish_clause. Add omp_private_outer_ref hook, add another argument to omp_clause_default_ctor hook. * langhooks-def.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define. (LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define. (LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR): Change to hook_tree_tree_tree_tree_null. (LANG_HOOKS_DECLS): Add LANG_HOOKS_OMP_FINISH_CLAUSE and LANG_HOOKS_OMP_PRIVATE_OUTER_REF. * hooks.c (hook_tree_tree_tree_tree_null): New function. * hooks.h (hook_tree_tree_tree_tree_null): New prototype. * tree.def (OMP_TASK): New tree code. * tree.h (OMP_TASK_COPYFN, OMP_TASK_ARG_SIZE, OMP_TASK_ARG_ALIGN, OMP_CLAUSE_PRIVATE_OUTER_REF, OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_COLLAPSE_ITERVAR, OMP_CLAUSE_COLLAPSE_COUNT, OMP_TASKREG_CHECK, OMP_TASKREG_BODY, OMP_TASKREG_CLAUSES, OMP_TASKREG_FN, OMP_TASKREG_DATA_ARG, OMP_TASK_BODY, OMP_TASK_CLAUSES, OMP_TASK_FN, OMP_TASK_DATA_ARG, OMP_CLAUSE_COLLAPSE_EXPR): Define. (enum omp_clause_default_kind): Add OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. (OMP_DIRECTIVE_P): Add OMP_TASK. (OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): New clause codes. (OMP_CLAUSE_SCHEDULE_AUTO): New schedule kind. * tree.c (omp_clause_code_name): Add OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED entries. (omp_clause_num_ops): Likewise. Increase OMP_CLAUSE_LASTPRIVATE num_ops to 2. (walk_tree_1): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Walk OMP_CLAUSE_LASTPRIVATE_STMT. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_SCHEDULE_AUTO, OMP_CLAUSE_UNTIED, OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. (dump_generic_node): Handle OMP_TASK and collapsed OMP_FOR loops. * c-omp.c (c_finish_omp_for): Allow pointer iterators. Remove warning about unsigned iterators. Change decl/init/cond/incr arguments to TREE_VECs, check arguments for all collapsed loops. (c_finish_omp_taskwait): New function. (c_split_parallel_clauses): Put OMP_CLAUSE_COLLAPSE clause to ws_clauses. * c-parser.c (c_parser_omp_for_loop): Parse collapsed loops. Call default_function_array_conversion on init. Add par_clauses argument. If decl is present in parallel's lastprivate clause, change it to shared and add lastprivate clause for decl to OMP_FOR_CLAUSES. Add clauses argument, on success set OMP_FOR_CLAUSES to it. Look up collapse count in clauses. (c_parser_omp_for, c_parser_omp_parallel): Adjust c_parser_omp_for_loop callers. (OMP_FOR_CLAUSE_MASK): Add 1 << PRAGMA_OMP_CLAUSE_COLLAPSE. (c_parser_pragma): Handle PRAGMA_OMP_TASKWAIT. (c_parser_omp_clause_name): Handle collapse and untied clauses. (c_parser_omp_clause_collapse, c_parser_omp_clause_untied): New functions. (c_parser_omp_clause_schedule): Handle schedule(auto). Include correct location in the error message. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE and PRAGMA_OMP_CLAUSE_UNTIED. (OMP_TASK_CLAUSE_MASK): Define. (c_parser_omp_task, c_parser_omp_taskwait): New functions. (c_parser_omp_construct): Handle PRAGMA_OMP_TASK. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Handle OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_REDUCTION_INIT, OMP_CLAUSE_REDUCTION_MERGE, OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Don't handle TREE_STATIC or DECL_EXTERNAL VAR_DECLs in OMP_CLAUSE_DECL. (conver_nonlocal_reference, convert_local_reference, convert_call_expr): Handle OMP_TASK the same as OMP_PARALLEL. Use OMP_TASKREG_* macros rather than OMP_PARALLEL_*. (walk_omp_for): Adjust for OMP_FOR_{INIT,COND,INCR} changes. * tree-gimple.c (is_gimple_stmt): Handle OMP_TASK. * c-tree.h (c_begin_omp_task, c_finish_omp_task): New prototypes. * c-pragma.h (PRAGMA_OMP_TASK, PRAGMA_OMP_TASKWAIT): New. (PRAGMA_OMP_CLAUSE_COLLAPSE, PRAGMA_OMP_CLAUSE_UNTIED): New. * c-typeck.c (c_begin_omp_task, c_finish_omp_task): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. * c-pragma.c (init_pragma): Init omp task and omp taskwait pragmas. * c-common.h (c_finish_omp_taskwait): New prototype. * gimple-low.c (lower_stmt): Handle OMP_TASK. * tree-parloops.c (create_parallel_loop): Create 1 entry vectors for OMP_FOR_{INIT,COND,INCR}. * tree-cfg.c (remove_useless_stmts_1): Handle OMP_* containers. (make_edges): Handle OMP_TASK. * tree-ssa-operands.c (get_expr_operands): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. * tree-inline.c (estimate_num_insns_1): Handle OMP_TASK. * builtin-types.def (BT_PTR_ULONGLONG, BT_PTR_FN_VOID_PTR_PTR, BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New. * omp-builtins.def (BUILT_IN_GOMP_TASK, BUILT_IN_GOMP_TASKWAIT, BUILT_IN_GOMP_LOOP_ULL_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_STATIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_RUNTIME_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): New builtins. * gimplify.c (gimplify_omp_for): Allow pointer type for decl, handle POINTER_PLUS_EXPR. If loop counter has been replaced and original iterator is present in lastprivate clause or if collapse > 1, set OMP_CLAUSE_LASTPRIVATE_STMT. Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. (gimplify_expr): Handle OMP_SECTIONS_SWITCH and OMP_TASK. (enum gimplify_omp_var_data): Add GOVD_PRIVATE_OUTER_REF. (omp_notice_variable): Set GOVD_PRIVATE_OUTER_REF if needed, if it is set, lookup var in outer contexts too. Handle OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. Handle vars that are supposed to be implicitly determined firstprivate for task regions. (gimplify_scan_omp_clauses): Set GOVD_PRIVATE_OUTER_REF if needed, if it is set, lookup var in outer contexts too. Set OMP_CLAUSE_PRIVATE_OUTER_REF if GOVD_PRIVATE_OUTER_REF is set. Handle OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Take region_type as last argument instead of in_parallel and in_combined_parallel. (gimplify_omp_parallel, gimplify_omp_for, gimplify_omp_workshare): Adjust callers. (gimplify_adjust_omp_clauses_1): Set OMP_CLAUSE_PRIVATE_OUTER_REF if GOVD_PRIVATE_OUTER_REF is set. Call omp_finish_clause langhook. (new_omp_context): Set default_kind to OMP_CLAUSE_DEFAULT_UNSPECIFIED for OMP_TASK regions. (omp_region_type): New enum. (struct gimplify_omp_ctx): Remove is_parallel and is_combined_parallel fields, add region_type. (new_omp_context): Take region_type as argument instead of is_parallel and is_combined_parallel. (gimple_add_tmp_var, omp_firstprivatize_variable, omp_notice_variable, omp_is_private, omp_check_private): Adjust ctx->is_parallel and ctx->is_combined_parallel checks. (gimplify_omp_task): New function. (gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. * omp-low.c (extract_omp_for_data): Use schedule(static) for schedule(auto). Handle pointer and unsigned iterators. Compute fd->iter_type. Handle POINTER_PLUS_EXPR increments. Add loops argument. Extract data for collapsed OMP_FOR loops. (expand_parallel_call): Assert sched_kind isn't auto, map runtime schedule to index 3. (struct omp_for_data_loop): New type. (struct omp_for_data): Remove v, n1, n2, step, cond_code fields. Add loop, loops, collapse and iter_type fields. (workshare_safe_to_combine_p): Disallow combined for if iter_type is unsigned long long. Don't combine collapse > 1 loops unless all bounds and steps are constant. Adjust extract_omp_for_data caller. (expand_omp_for_generic): Handle pointer, unsigned and long long iterators. Handle collapsed OMP_FOR loops. Adjust for struct omp_for_data changes. If libgomp function doesn't return boolean_type_node, add comparison of the return value with 0. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle pointer, unsigned and long long iterators. Adjust for struct omp_for_data changes. (expand_omp_for): Assert sched_kind isn't auto, map runtime schedule to index 3. Use GOMP_loop_ull*{start,next} if iter_type is unsigned long long. Allocate loops array, pass it to extract_omp_for_data. For collapse > 1 loops use always expand_omp_for_generic. (omp_context): Add sfield_map and srecord_type fields. (is_task_ctx, lookup_sfield): New functions. (use_pointer_for_field): Use is_task_ctx helper. Change first argument's type from const_tree to tree. Clarify comment. In OMP_TASK disallow copy-in/out sharing. (build_sender_ref): Call lookup_sfield instead of lookup_field. (install_var_field): Add mask argument. Populate both record_type and srecord_type if needed. (delete_omp_context): Destroy sfield_map, clear DECL_ABSTRACT_ORIGIN in srecord_type. (fixup_child_record_type): Also remap FIELD_DECL's DECL_SIZE{,_UNIT} and DECL_FIELD_OFFSET. (scan_sharing_clauses): Adjust install_var_field callers. For firstprivate clauses on explicit tasks allocate the var by value in record_type unconditionally, rather than by reference. Handle OMP_CLAUSE_PRIVATE_OUTER_REF. Scan OMP_CLAUSE_LASTPRIVATE_STMT. Use is_taskreg_ctx instead of is_parallel_ctx. Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. (create_omp_child_function_name): Add task_copy argument, use *_omp_cpyfn* names if it is true. (create_omp_child_function): Add task_copy argument, if true create *_omp_cpyfn* helper function. (scan_omp_parallel): Adjust create_omp_child_function callers. Rename parallel_nesting_level to taskreg_nesting_level. (scan_omp_task): New function. (lower_rec_input_clauses): Don't run constructors for firstprivate explicit task vars which are initialized by *_omp_cpyfn*. Pass outer var ref to omp_clause_default_ctor hook if OMP_CLAUSE_PRIVATE_OUTER_REF or OMP_CLAUSE_LASTPRIVATE. Replace OMP_CLAUSE_REDUCTION_PLACEHOLDER decls in OMP_CLAUSE_REDUCTION_INIT. (lower_send_clauses): Clear DECL_ABSTRACT_ORIGIN if in task to avoid duplicate setting of fields. Handle OMP_CLAUSE_PRIVATE_OUTER_REF. (lower_send_shared_vars): Use srecord_type if non-NULL. Don't copy-out if TREE_READONLY, only copy-in. (expand_task_copyfn): New function. (expand_task_call): New function. (struct omp_taskcopy_context): New type. (task_copyfn_copy_decl, task_copyfn_remap_type, create_task_copyfn): New functions. (lower_omp_parallel): Rename to... (lower_omp_taskreg): ... this. Use OMP_TASKREG_* macros where needed. Call create_task_copyfn if srecord_type is needed. Adjust sender_decl type. (task_shared_vars): New variable. (check_omp_nesting_restrictions): Warn if work-sharing, barrier, master or ordered region is closely nested inside OMP_TASK. Add warnings for barrier if closely nested inside of work-sharing, ordered, or master region. (scan_omp_1): Call check_omp_nesting_restrictions even for GOMP_barrier calls. Rename parallel_nesting_level to taskreg_nesting_level. Handle OMP_TASK. (lower_lastprivate_clauses): Even if some lastprivate is found on a work-sharing construct, continue looking for them on parent parallel construct. (lower_omp_for_lastprivate): Add lastprivate clauses to the beginning of dlist rather than end. Adjust for struct omp_for_data changes. (lower_omp_for): Add rec input clauses before OMP_FOR_PRE_BODY, not after it. Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes, adjust extract_omp_for_data caller. (get_ws_args_for): Adjust extract_omp_for_data caller. (scan_omp_for): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. (lower_omp_single_simple): If libgomp function doesn't return boolean_type_node, add comparison of the return value with 0. (diagnose_sb_1, diagnose_sb_2): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. Handle OMP_TASK. (parallel_nesting_level): Rename to... (taskreg_nesting_level): ... this. (is_taskreg_ctx): New function. (build_outer_var_ref, omp_copy_decl): Use is_taskreg_ctx instead of is_parallel_ctx. (execute_lower_omp): Rename parallel_nesting_level to taskreg_nesting_level. (expand_omp_parallel): Rename to... (expand_omp_taskreg): ... this. Use OMP_TASKREG_* macros where needed. Call omp_task_call for OMP_TASK regions. (expand_omp): Adjust caller, handle OMP_TASK. (lower_omp_1): Adjust lower_omp_taskreg caller, handle OMP_TASK. * bitmap.c (bitmap_default_obstack_depth): New variable. (bitmap_obstack_initialize, bitmap_obstack_release): Do nothing if argument is NULL and bitmap_default_obstack is already initialized. * ipa-struct-reorg.c (do_reorg_1): Call bitmap_obstack_release at the end. * matrix-reorg.c (matrix_reorg): Likewise. cp/ * cp-tree.h (cxx_omp_finish_clause, cxx_omp_create_clause_info, dependent_omp_for_p, begin_omp_task, finish_omp_task, finish_omp_taskwait): New prototypes. (cxx_omp_clause_default_ctor): Add outer argument. (finish_omp_for): Add new clauses argument. * cp-gimplify.c (cxx_omp_finish_clause): New function. (cxx_omp_predetermined_sharing): Moved from semantics.c, rewritten. (cxx_omp_clause_default_ctor): Add outer argument. (cp_genericize_r): Walk OMP_CLAUSE_LASTPRIVATE_STMT. * cp-objcp-common.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define. * parser.c (cp_parser_omp_for_loop): Parse collapsed for loops. Add par_clauses argument. If decl is present in parallel's lastprivate clause, change that clause to shared and add a lastprivate clause for decl to OMP_FOR_CLAUSES. Fix wording of error messages. Adjust finish_omp_for caller. Add clauses argument. Parse loops with random access iterators. (cp_parser_omp_clause_collapse, cp_parser_omp_clause_untied): New functions. (cp_parser_omp_for, cp_parser_omp_parallel): Adjust cp_parser_omp_for_loop callers. (cp_parser_omp_for_cond, cp_parser_omp_for_incr): New helper functions. (cp_parser_omp_clause_name): Handle collapse and untied clauses. (cp_parser_omp_clause_schedule): Handle auto schedule. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE and PRAGMA_OMP_CLAUSE_UNTIED. (OMP_FOR_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_COLLAPSE. (OMP_TASK_CLAUSE_MASK): Define. (cp_parser_omp_task, cp_parser_omp_taskwait): New functions. (cp_parser_omp_construct): Handle PRAGMA_OMP_TASK. (cp_parser_pragma): Handle PRAGMA_OMP_TASK and PRAGMA_OMP_TASKWAIT. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Handle OMP_CLAUSE_LASTPRIVATE_STMT. (tsubst_omp_for_iterator): New function. (dependent_omp_for_p): New function. (tsubst_expr) <case OMP_FOR>: Use it. Handle collapsed OMP_FOR loops. Adjust finish_omp_for caller. Handle loops with random access iterators. Adjust for OMP_FOR_{INIT,COND,INCR} changes. (tsubst_expr): Handle OMP_TASK. * semantics.c (cxx_omp_create_clause_info): New function. (finish_omp_clauses): Call it. Handle OMP_CLAUSE_UNTIED and OMP_CLAUSE_COLLAPSE. (cxx_omp_predetermined_sharing): Removed. * semantics.c (finish_omp_for): Allow pointer iterators. Use handle_omp_for_class_iterator and dependent_omp_for_p. Handle collapsed for loops. Adjust c_finish_omp_for caller. Add new clauses argument. Fix check for type dependent cond or incr. Set OMP_FOR_CLAUSES to clauses. Use cp_convert instead of fold_convert to convert incr amount to difference_type. Only fold if not in template. If decl is mentioned in lastprivate clause, set OMP_CLAUSE_LASTPRIVATE_STMT. Handle loops with random access iterators. Adjust for OMP_FOR_{INIT,COND,INCR} changes. (finish_omp_threadprivate): Allow static class members of the current class. (handle_omp_for_class_iterator, begin_omp_task, finish_omp_task, finish_omp_taskwait): New functions. * parser.c (cp_parser_binary_expression): Add prec argument. (cp_parser_assignment_expression): Adjust caller. * cp-tree.h (outer_curly_brace_block): New prototype. * decl.c (outer_curly_brace_block): No longer static. fortran/ * scanner.c (skip_free_comments, skip_fixed_comments): Handle tabs. * parse.c (next_free): Allow tab after !$omp. (decode_omp_directive): Handle !$omp task, !$omp taskwait and !$omp end task. (case_executable): Add ST_OMP_TASKWAIT. (case_exec_markers): Add ST_OMP_TASK. (gfc_ascii_statement): Handle ST_OMP_TASK, ST_OMP_END_TASK and ST_OMP_TASKWAIT. (parse_omp_structured_block, parse_executable): Handle ST_OMP_TASK. * gfortran.h (gfc_find_sym_in_expr): New prototype. (gfc_statement): Add ST_OMP_TASK, ST_OMP_END_TASK and ST_OMP_TASKWAIT. (gfc_omp_clauses): Add OMP_SCHED_AUTO to sched_kind, OMP_DEFAULT_FIRSTPRIVATE to default_sharing. Add collapse and untied fields. (gfc_exec_op): Add EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * f95-lang.c (LANG_HOOKS_OMP_CLAUSE_COPY_CTOR, LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, LANG_HOOKS_OMP_CLAUSE_DTOR, LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define. * trans.h (gfc_omp_clause_default_ctor): Add another argument. (gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op, gfc_omp_clause_dtor, gfc_omp_private_outer_ref): New prototypes. * types.def (BT_ULONGLONG, BT_PTR_ULONGLONG, BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_VOID_PTR_PTR, BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New. (BT_BOOL): Use integer type with BOOL_TYPE_SIZE rather than boolean_type_node. * dump-parse-tree.c (gfc_show_omp_node): Handle EXEC_OMP_TASK, EXEC_OMP_TASKWAIT, OMP_SCHED_AUTO, OMP_DEFAULT_FIRSTPRIVATE, untied and collapse clauses. (gfc_show_code_node): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * trans.c (gfc_trans_code): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * st.c (gfc_free_statement): Likewise. * resolve.c (gfc_resolve_blocks, resolve_code): Likewise. (find_sym_in_expr): Rename to... (gfc_find_sym_in_expr): ... this. No longer static. (resolve_allocate_expr, resolve_ordinary_assign): Adjust caller. * match.h (gfc_match_omp_task, gfc_match_omp_taskwait): New prototypes. * openmp.c (resolve_omp_clauses): Allow allocatable arrays in firstprivate, lastprivate, reduction, copyprivate and copyin clauses. (omp_current_do_code): Made static. (omp_current_do_collapse): New variable. (gfc_resolve_omp_do_blocks): Compute omp_current_do_collapse, clear omp_current_do_code and omp_current_do_collapse on return. (gfc_resolve_do_iterator): Handle collapsed do loops. (resolve_omp_do): Likewise, diagnose errorneous collapsed do loops. (OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): Define. (gfc_match_omp_clauses): Handle default (firstprivate), schedule (auto), untied and collapse (n) clauses. (OMP_DO_CLAUSES): Add OMP_CLAUSE_COLLAPSE. (OMP_TASK_CLAUSES): Define. (gfc_match_omp_task, gfc_match_omp_taskwait): New functions. * trans-openmp.c (gfc_omp_private_outer_ref): New function. (gfc_omp_clause_default_ctor): Add outer argument. For allocatable arrays allocate them with the bounds of the outer var if outer var is allocated. (gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op, gfc_omp_clause_dtor): New functions. (gfc_trans_omp_array_reduction): If decl is allocatable array, allocate it with outer var's bounds in OMP_CLAUSE_REDUCTION_INIT and deallocate it in OMP_CLAUSE_REDUCTION_MERGE. (gfc_omp_predetermined_sharing): Return OMP_CLAUSE_DEFAULT_SHARED for assumed-size arrays. (gfc_trans_omp_do): Add par_clauses argument. If dovar is present in lastprivate clause and do loop isn't simple, set OMP_CLAUSE_LASTPRIVATE_STMT. If dovar is present in parallel's lastprivate clause, change it to shared and add lastprivate clause to OMP_FOR_CLAUSES. Handle collapsed do loops. (gfc_trans_omp_directive): Adjust gfc_trans_omp_do callers. (gfc_trans_omp_parallel_do): Likewise. Move collapse clause to OMP_FOR from OMP_PARALLEL. (gfc_trans_omp_clauses): Handle OMP_SCHED_AUTO, OMP_DEFAULT_FIRSTPRIVATE, untied and collapse clauses. (gfc_trans_omp_task, gfc_trans_omp_taskwait): New functions. (gfc_trans_omp_directive): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. gcc/testsuite/ * gcc.dg/gomp/collapse-1.c: New test. * gcc.dg/gomp/nesting-1.c: New test. * g++.dg/gomp/task-1.C: New test. * g++.dg/gomp/predetermined-1.C: New test. * g++.dg/gomp/tls-4.C: New test. * gfortran.dg/gomp/collapse1.f90: New test. * gfortran.dg/gomp/sharing-3.f90: New test. * gcc.dg/gomp/pr27499.c (foo): Remove is unsigned dg-warning. * g++.dg/gomp/pr27499.C (foo): Likewise. * g++.dg/gomp/for-16.C (foo): Likewise. * g++.dg/gomp/tls-3.C: Remove dg-error, add S::s definition. * g++.dg/gomp/pr34607.C: Adjust dg-error location. * g++.dg/gomp/for-16.C (foo): Add a new dg-error. * gcc.dg/gomp/appendix-a/a.35.4.c: Add dg-warning. * gcc.dg/gomp/appendix-a/a.35.6.c: Likewise. * gfortran.dg/gomp/appendix-a/a.35.4.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise. * gfortran.dg/gomp/omp_parse1.f90: Remove !$omp tab test. * gfortran.dg/gomp/appendix-a/a.33.4.f90: Remove dg-error about allocatable array. * gfortran.dg/gomp/reduction1.f90: Likewise. libgomp/ * configure.ac (LIBGOMP_GNU_SYMBOL_VERSIONING): New AC_DEFINE. Substitute also OMP_*LOCK_25*. * configure: Regenerated. * config.h.in: Regenerated. * Makefile.am (libgomp_la_SOURCES): Add loop_ull.c, iter_ull.c, ptrlock.c and task.c. * Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * task.c: New file. * loop_ull.c: New file. * iter_ull.c: New file. * libgomp.h: Include ptrlock.h. (enum gomp_task_kind): New type. (struct gomp_team): Add task_lock, task_queue, task_count, task_running_count, single_count fields. Add work_share_list_free_lock ifndef HAVE_SYNC_BUILTINS. Remove work_share_lock, generation_mask, oldest_live_gen, num_live_gen and init_work_shares fields, add work work_share_list_alloc, work_share_list_free and work_share_chunk fields. Change work_shares from pointer to pointers into an array. Change ordered_release field into gomp_sem_t ** from flexible array member. Add implicit_task and initial_work_shares fields. Move close to the end of the struct. (struct gomp_team_state): Add single_count, last_work_share, active_level and level fields, remove work_share_generation. (gomp_barrier_handle_tasks): New prototype. (gomp_finish_task): New inline function. (struct gomp_work_share): Move chunk_size, end, incr into transparent union/struct, add chunk_size_ull, end_ll, incr_ll and next_ll fields. Reshuffle fields. Add next_alloc, next_ws, next_free and inline_ordered_team_ids fields, change ordered_team_ids into pointer from flexible array member. Add mode field. Put lock and next into a different cache line from most of the write-once fields. (gomp_iter_ull_static_next, gomp_iter_ull_dynamic_next_locked, gomp_iter_ull_guided_next_locked, gomp_iter_ull_dynamic_next, gomp_iter_ull_guided_next): New prototypes. (gomp_new_icv): New prototype. (struct gomp_thread): Add thread_pool and task fields. (struct gomp_thread_pool): New type. (gomp_new_team): New prototype. (gomp_team_start): Change type of last argument. (gomp_new_work_share): Removed. (gomp_init_work_share, gomp_fini_work_share): New prototypes. (gomp_work_share_init_done): New static inline. (gomp_throttled_spin_count_var, gomp_available_cpus, gomp_managed_threads): New extern decls. (gomp_init_task): New prototype. (gomp_spin_count_var): New extern var decl. (LIBGOMP_GNU_SYMBOL_VERSIONING): Undef if no visibility or no alias support, or if not PIC. (gomp_init_lock_30, gomp_destroy_lock_30, gomp_set_lock_30, gomp_unset_lock_30, gomp_test_lock_30, gomp_init_nest_lock_30, gomp_destroy_nest_lock_30, gomp_set_nest_lock_30, gomp_unset_nest_lock_30, gomp_test_nest_lock_30, gomp_init_lock_25, gomp_destroy_lock_25, gomp_set_lock_25, gomp_unset_lock_25, gomp_test_lock_25, gomp_init_nest_lock_25, gomp_destroy_nest_lock_25, gomp_set_nest_lock_25, gomp_unset_nest_lock_25, gomp_test_nest_lock_25): New prototypes. (omp_lock_symver, strong_alias): Define. (gomp_remaining_threads_count, gomp_remaining_threads_lock): New decls. (gomp_end_task): New. (struct gomp_task_icv, gomp_global_icv): New. (gomp_thread_limit_var, gomp_max_active_levels_var): New. (struct gomp_task): New. (gomp_nthreads_var, gomp_dyn_var, gomp_nest_var, gomp_run_sched_var, gomp_run_sched_chunk): Remove. (gomp_icv): New. (gomp_schedule_type): Reorder enum to match omp_sched_t. * team.c (struct gomp_thread_start_data): Add thread_pool and task fields. (gomp_thread_start): Add gomp_team_barrier_wait call. For non-nested case remove clearing of docked thread thr fields. Use pool fields instead of global gomp_* variables. Use gomp_barrier_wait_last when needed. Initialize ts.active_level. Create tasks for each member thread. (free_team): Only destroy team barrier, task_lock here and free it. (gomp_free_thread): Free last_team if non-NULL. (gomp_team_end): Call gomp_team_barrier_wait instead of gomp_barrier_wait. For nested case call one extra gomp_barrier_wait. Move here some destruction from free_team. Call free_team on pool->last_team if any, rather than freeing current team. Destroy work_share_list_free_lock ifndef HAVE_SYNC_BUILTINS. (gomp_new_icv): New function. (gomp_threads, gomp_threads_size, gomp_threads_used, gomp_threads_dock): Removed. (gomp_thread_destructor): New variable. (gomp_new_thread_pool, gomp_free_pool_helper, gomp_free_thread): New functions. (gomp_team_start): Create new pool if current thread doesn't have one. Use pool fields instead of global gomp_* variables. Initialize thread_pool field for new threads. Clear single_count. Change last argument from ws to team, don't create new team, set ts.work_share to &team->work_shares[0] and clear ts.last_work_share. Don't clear ts.work_share_generation. If number of threads changed, adjust atomically gomp_managed_threads. Use gomp_init_task instead of gomp_new_task, set thr->task to the corresponding implicit_task array entry. Create tasks for each member thread. Initialize ts.level. (initialize_team): Call pthread_key_create on gomp_thread_destructor. (team_destructor): New function. (new_team): Removed. (gomp_new_team): New function. (free_team): Free gomp_work_share blocks chained through next_alloc, instead of freeing work_shares and destroying work_share_lock. (gomp_team_end): Call gomp_fini_work_share. If number of threads changed, adjust atomically gomp_managed_threads. Use gomp_end_task. * barrier.c (GOMP_barrier): Call gomp_team_barrier_wait instead of gomp_barrier_wait. * single.c (GOMP_single_copy_start): Call gomp_team_barrier_wait instead of gomp_barrier_wait. Call gomp_work_share_init_done if gomp_work_share_start returned true. Don't unlock ws->lock. (GOMP_single_copy_end): Call gomp_team_barrier_wait instead of gomp_barrier_wait. (GOMP_single_start): Rewritten if HAVE_SYNC_BUILTINS. Call gomp_work_share_init_done if gomp_work_share_start returned true. Don't unlock ws->lock. * work.c: Include stddef.h. (free_work_share): Use work_share_list_free_lock instead of atomic chaining ifndef HAVE_SYNC_BUILTINS. Add team argument. Call gomp_fini_work_share and then either free ws if orphaned, or put it into work_share_list_free list of the current team. (alloc_work_share, gomp_init_work_share, gomp_fini_work_share): New functions. (gomp_work_share_start, gomp_work_share_end, gomp_work_share_end_nowait): Rewritten. * omp_lib.f90.in Change some tabs to spaces to prevent warnings. (openmp_version): Set to 200805. (omp_sched_kind, omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): New parameters. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New interfaces. * omp_lib.h.in (openmp_version): Set to 200805. (omp_sched_kind, omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): New parameters. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New externals. * loop.c: Include limits.h. (GOMP_loop_runtime_next, GOMP_loop_ordered_runtime_next): Handle GFS_AUTO. (GOMP_loop_runtime_start, GOMP_loop_ordered_runtime_start): Likewise. Use gomp_icv. (gomp_loop_static_start, gomp_loop_dynamic_start): Clear ts.static_trip here. (gomp_loop_static_start, gomp_loop_ordered_static_start): Call gomp_work_share_init_done after gomp_loop_init. Don't unlock ws->lock. (gomp_loop_dynamic_start, gomp_loop_guided_start): Call gomp_work_share_init_done after gomp_loop_init. If HAVE_SYNC_BUILTINS, don't unlock ws->lock, otherwise lock it. (gomp_loop_ordered_dynamic_start, gomp_loop_ordered_guided_start): Call gomp_work_share_init_done after gomp_loop_init. Lock ws->lock. (gomp_parallel_loop_start): Call gomp_new_team instead of gomp_new_work_share. Call gomp_loop_init on &team->work_shares[0]. Adjust gomp_team_start caller. Pass 0 as second argument to gomp_resolve_num_threads. (gomp_loop_init): For GFS_DYNAMIC, multiply ws->chunk_size by incr. If adding ws->chunk_size nthreads + 1 times after end won't overflow, set ws->mode to 1. * libgomp_g.h (GOMP_loop_ull_static_start, GOMP_loop_ull_dynamic_start, GOMP_loop_ull_guided_start, GOMP_loop_ull_runtime_start, GOMP_loop_ull_ordered_static_start, GOMP_loop_ull_ordered_dynamic_start, GOMP_loop_ull_ordered_guided_start, GOMP_loop_ull_ordered_runtime_start, GOMP_loop_ull_static_next, GOMP_loop_ull_dynamic_next, GOMP_loop_ull_guided_next, GOMP_loop_ull_runtime_next, GOMP_loop_ull_ordered_static_next, GOMP_loop_ull_ordered_dynamic_next, GOMP_loop_ull_ordered_guided_next, GOMP_loop_ull_ordered_runtime_next, GOMP_task, GOMP_taskwait): New prototypes. * libgomp.map: Export lock routines also @@OMP_2.0. (GOMP_loop_ordered_dynamic_first, GOMP_loop_ordered_guided_first, GOMP_loop_ordered_runtime_first, GOMP_loop_ordered_static_first): Remove. (GOMP_loop_ull_dynamic_next, GOMP_loop_ull_dynamic_start, GOMP_loop_ull_guided_next, GOMP_loop_ull_guided_start, GOMP_loop_ull_ordered_dynamic_next, GOMP_loop_ull_ordered_dynamic_start, GOMP_loop_ull_ordered_guided_next, GOMP_loop_ull_ordered_guided_start, GOMP_loop_ull_ordered_runtime_next, GOMP_loop_ull_ordered_runtime_start, GOMP_loop_ull_ordered_static_next, GOMP_loop_ull_ordered_static_start, GOMP_loop_ull_runtime_next, GOMP_loop_ull_runtime_start, GOMP_loop_ull_static_next, GOMP_loop_ull_static_start, GOMP_task, GOMP_taskwait): Export @@GOMP_2.0. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_, omp_set_max_active_levels_, omp_set_max_active_levels_8_, omp_get_max_active_levels_, omp_get_level_, omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_, omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_): New exports @@OMP_3.0. * omp.h.in (omp_sched_t): New type. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New prototypes. * env.c (gomp_spin_count_var, gomp_throttled_spin_count_var, gomp_available_cpus, gomp_managed_threads, gomp_max_active_levels_var, gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): New variables. (parse_spincount): New function. (initialize_env): Call gomp_init_num_threads unconditionally. Initialize gomp_available_cpus. Call parse_spincount, initialize gomp_{,throttled_}spin_count_var depending on presence and value of OMP_WAIT_POLICY and GOMP_SPINCOUNT env vars. Handle GOMP_BLOCKTIME env var. Handle OMP_WAIT_POLICY, OMP_MAX_ACTIVE_LEVELS, OMP_THREAD_LIMIT, OMP_STACKSIZE env vars. Handle unit specification for GOMP_STACKSIZE. Initialize gomp_remaining_threads_count and gomp_remaining_threads_lock if needed. Use gomp_global_icv. (gomp_nthreads_var, gomp_dyn_var, gomp_nest_var, gomp_run_sched_var, gomp_run_sched_chunk): Remove. (gomp_global_icv): New. (parse_schedule): Use it. Parse "auto". (omp_set_num_threads): Use gomp_icv. (omp_set_dynamic, omp_get_dynamic, omp_set_nested, omp_get_nested): Likewise. (omp_get_max_threads): Move from parallel.c. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels): New functions, add ialias. (parse_stacksize, parse_wait_policy): New functions. * fortran.c: Rewrite lock wrappers, if symbol versioning provide both wrappers for compatibility and new locks. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New ialias_redirect. (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_, omp_set_max_active_levels_, omp_set_max_active_levels_8_, omp_get_max_active_levels_, omp_get_level_, omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_, omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_): New functions. * parallel.c: Include limits.h. (gomp_resolve_num_threads): Add count argument. Rewritten. (GOMP_parallel_start): Call gomp_new_team and pass that as last argument to gomp_team_start. Pass 0 as second argument to gomp_resolve_num_threads. (GOMP_parallel_end): Decrease gomp_remaining_threads_count if gomp_thread_limit_var != ULONG_MAX. (omp_in_parallel): Implement using ts.active_level. (omp_get_max_threads): Move to env.c. (omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New functions, add ialias. * sections.c (GOMP_sections_start): Call gomp_work_share_init_done after gomp_sections_init. If HAVE_SYNC_BUILTINS, call gomp_iter_dynamic_next instead of the _locked variant and don't take lock around it, otherwise acquire it before calling gomp_iter_dynamic_next_locked. (GOMP_sections_next): If HAVE_SYNC_BUILTINS, call gomp_iter_dynamic_next instead of the _locked variant and don't take lock around it. (GOMP_parallel_sections_start): Call gomp_new_team instead of gomp_new_work_share. Call gomp_sections_init on &team->work_shares[0]. Adjust gomp_team_start caller. Pass count as second argument to gomp_resolve_num_threads, don't adjust num_threads after the call. Use gomp_icv. * iter.c (gomp_iter_dynamic_next_locked): Don't multiply ws->chunk_size by incr. (gomp_iter_dynamic_next): Likewise. If ws->mode, use more efficient code. * libgomp_f.h.in (omp_lock_25_arg_t, omp_nest_lock_25_arg_t): New types. (omp_lock_25_arg, omp_nest_lock_25_arg): New macros. (omp_check_defines): Check even the compat defines. * config/linux/ptrlock.c: New file. * config/linux/ptrlock.h: New file. * config/linux/wait.h: New file. * config/posix/ptrlock.c: New file. * config/posix/ptrlock.h: New file. * config/linux/bar.h (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes. (gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): New inlines. (gomp_barrier_t): Rewritten. (gomp_barrier_state_t): New typedef. (gomp_barrier_init, gomp_barrier_reinit, gomp_barrier_destroy, gomp_barrier_wait_start): Rewritten. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_barrier_last_thread, gomp_barrier_wait_last): New static inlines. * config/linux/bar.c: Include wait.h instead of libgomp.h and futex.h. (gomp_barrier_wait_end): Rewritten. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake, gomp_barrier_wait_last): New functions. * config/posix/bar.h (gomp_barrier_t): Add generation field. (gomp_barrier_state_t): New typedef. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes. (gomp_barrier_wait_start): Or all but low 2 bits from generation into the return value. Return gomp_barrier_state_t. (gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): New inlines. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_barrier_last_thread, gomp_barrier_wait_last): New static inlines. * config/posix/bar.c (gomp_barrier_init): Clear generation field. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New functions. * config/linux/mutex.c: Include wait.h instead of libgomp.h and futex.h. (gomp_futex_wake, gomp_futex_wait): New variables. (gomp_mutex_lock_slow): Call do_wait instead of futex_wait. * config/linux/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. Include wait.h instead of libgomp.h and futex.h. (gomp_set_nest_lock_25): Call do_wait instead of futex_wait. * config/posix95/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. * config/posix/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. * config/linux/proc.c (gomp_init_num_threads): Use gomp_global_icv. (get_num_procs, gomp_dynamic_max_threads): Use gomp_icv. * config/posix/proc.c, config/mingw32/proc.c: Similarly. * config/linux/powerpc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/alpha/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/x86/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/s390/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/ia64/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/sparc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/sem.c: Include wait.h instead of libgomp.h and futex.h. (gomp_sem_wait_slow): Call do_wait instead of futex_wait. * config/linux/affinity.c: Assume HAVE_SYNC_BUILTINS. * config/linux/omp-lock.h (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_nest_lock_t): Change owner into void *, add lock field. * config/posix95/omp-lock.h: Include semaphore.h. (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_lock_t): Use sem_t instead of mutex if semaphores aren't broken. (omp_nest_lock_t): Likewise. Change owner to void *. * config/posix/omp-lock.h: Include semaphore.h. (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_lock_t): Use sem_t instead of mutex if semaphores aren't broken. (omp_nest_lock_t): Likewise. Add owner field. * testsuite/libgomp.c/collapse-1.c: New test. * testsuite/libgomp.c/collapse-2.c: New test. * testsuite/libgomp.c/collapse-3.c: New test. * testsuite/libgomp.c/icv-1.c: New test. * testsuite/libgomp.c/icv-2.c: New test. * testsuite/libgomp.c/lib-2.c: New test. * testsuite/libgomp.c/lock-1.c: New test. * testsuite/libgomp.c/lock-2.c: New test. * testsuite/libgomp.c/lock-3.c: New test. * testsuite/libgomp.c/loop-4.c: New test. * testsuite/libgomp.c/loop-5.c: New test. * testsuite/libgomp.c/loop-6.c: New test. * testsuite/libgomp.c/loop-7.c: New test. * testsuite/libgomp.c/loop-8.c: New test. * testsuite/libgomp.c/loop-9.c: New test. * testsuite/libgomp.c/nested-3.c: New test. * testsuite/libgomp.c/nestedfn-6.c: New test. * testsuite/libgomp.c/sort-1.c: New test. * testsuite/libgomp.c/task-1.c: New test. * testsuite/libgomp.c/task-2.c: New test. * testsuite/libgomp.c/task-3.c: New test. * testsuite/libgomp.c/task-4.c: New test. * testsuite/libgomp.c++/c++.exp: Add libstdc++-v3 build includes to C++ testsuite default compiler options. * testsuite/libgomp.c++/collapse-1.C: New test. * testsuite/libgomp.c++/collapse-2.C: New test. * testsuite/libgomp.c++/ctor-10.C: New test. * testsuite/libgomp.c++/for-1.C: New test. * testsuite/libgomp.c++/for-2.C: New test. * testsuite/libgomp.c++/for-3.C: New test. * testsuite/libgomp.c++/for-4.C: New test. * testsuite/libgomp.c++/for-5.C: New test. * testsuite/libgomp.c++/loop-8.C: New test. * testsuite/libgomp.c++/loop-9.C: New test. * testsuite/libgomp.c++/loop-10.C: New test. * testsuite/libgomp.c++/task-1.C: New test. * testsuite/libgomp.c++/task-2.C: New test. * testsuite/libgomp.c++/task-3.C: New test. * testsuite/libgomp.c++/task-4.C: New test. * testsuite/libgomp.c++/task-5.C: New test. * testsuite/libgomp.c++/task-6.C: New test. * testsuite/libgomp.fortran/allocatable1.f90: New test. * testsuite/libgomp.fortran/allocatable2.f90: New test. * testsuite/libgomp.fortran/allocatable3.f90: New test. * testsuite/libgomp.fortran/allocatable4.f90: New test. * testsuite/libgomp.fortran/collapse1.f90: New test. * testsuite/libgomp.fortran/collapse2.f90: New test. * testsuite/libgomp.fortran/collapse3.f90: New test. * testsuite/libgomp.fortran/collapse4.f90: New test. * testsuite/libgomp.fortran/lastprivate1.f90: New test. * testsuite/libgomp.fortran/lastprivate2.f90: New test. * testsuite/libgomp.fortran/lib4.f90: New test. * testsuite/libgomp.fortran/lock-1.f90: New test. * testsuite/libgomp.fortran/lock-2.f90: New test. * testsuite/libgomp.fortran/nested1.f90: New test. * testsuite/libgomp.fortran/nestedfn4.f90: New test. * testsuite/libgomp.fortran/strassen.f90: New test. * testsuite/libgomp.fortran/tabs1.f90: New test. * testsuite/libgomp.fortran/tabs2.f: New test. * testsuite/libgomp.fortran/task1.f90: New test. * testsuite/libgomp.fortran/task2.f90: New test. * testsuite/libgomp.fortran/vla4.f90: Add dg-warning. * testsuite/libgomp.fortran/vla5.f90: Likewise. * testsuite/libgomp.c/pr26943-2.c: Likewise. * testsuite/libgomp.c/pr26943-3.c: Likewise. * testsuite/libgomp.c/pr26943-4.c: Likewise. Co-Authored-By: Jakob Blomer <jakob.blomer@ira.uka.de> Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Ulrich Drepper <drepper@redhat.com> From-SVN: r136433
2008-06-06 15:01:54 +02:00
extern bool dependent_omp_for_p (tree, tree, tree, tree);
extern tree resolve_typename_type (tree, bool);
extern tree template_for_substitution (tree);
extern tree build_non_dependent_expr (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
extern void make_args_non_dependent (vec<tree, va_gc> *);
extern bool reregister_specialization (tree, tree, tree);
semantics.c (end_maybe_infinite_loop): Use fold_non_dependent_expr. 2014-11-14 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (end_maybe_infinite_loop): Use fold_non_dependent_expr. * parser.c (cp_parser_omp_clause_collapse): Likewise. (cp_parser_enumerator_definition): Don't call instantiate_non_dependent_expr... * decl.c (build_enumerator): ... call fold_non_dependent_expr here. * typeck2.c (massage_init_elt): Use fold_non_dependent_expr. * constexpr.c (maybe_constant_value): Allow VIEW_CONVERT_EXPR in the final gcc_assert. * constexpr.c (fold_non_dependent_expr): Add. * cp-tree.h (fold_non_dependent_expr): Declare it. * call.c (null_ptr_cst_p): Use it. * pt.c (tsubst_copy_and_build, build_non_dependent_expr): Likewise. * semantics.c (begin_maybe_infinite_loop): Likewise. * typeck.c (cp_build_binary_op): Likewise. * typeck2.c (check_narrowing): Likewise. * pt.c (fold_non_dependent_expr): Rename to instantiate_non_dependent_expr. (fold_non_dependent_expr_sfinae): Rename to instantiate_non_dependent_expr_sfinae. (convert_nontype_argument, build_non_dependent_expr): Adjust. * decl.c (compute_array_index_type): Likewise. * parser.c (cp_parser_parenthesized_expression_list, cp_parser_enumerator_definition, cp_parser_omp_clause_collapse): Likewise. * semantics.c (end_maybe_infinite_loop, finish_static_assert): Likewise. * typeck.c (cxx_alignas_expr): Likewise. * typeck2.c (store_init_value, massage_init_elt): Likewise. * call.c: Adjust comments. * class.c: Likewise. * constexpr.c: Likewise. * decl2.c: Likewise. * tree.c: Likewise. From-SVN: r217577
2014-11-14 17:59:52 +01:00
extern tree instantiate_non_dependent_expr (tree);
extern tree instantiate_non_dependent_expr_sfinae (tree, tsubst_flags_t);
extern tree instantiate_non_dependent_expr_internal (tree, tsubst_flags_t);
extern tree instantiate_non_dependent_or_null (tree);
extern bool variable_template_specialization_p (tree);
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
extern bool alias_type_or_template_p (tree);
extern bool alias_template_specialization_p (const_tree);
extern bool dependent_alias_template_spec_p (const_tree);
extern bool explicit_class_specialization_p (tree);
re PR c++/16564 (g++ seems to go into an infinite loop after errors) cp/ 2014-09-30 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/16564 * error.c (print_instantiation_context): Delete. * typeck2.c (build_x_arrow): Record location when pushing template instantiation. * pt.c (push_tinst_level): Make it a wrapper around ... (push_tinst_level_loc): ... this. New function. Make excessive template instantiation depth a fatal error. Record location. Use bool as return type. (instantiate_pending_templates): Make excessive template instantiation depth a fatal error. (problematic_instantiation_changed): Use bool as return type. * cp-tree.h (print_instantiation_context): Delete. (push_tinst_level): Update declaration. (problematic_instantiation_changed): Likewise. (push_tinst_level_loc): New. testsuite/ 2014-09-30 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/16564 * lib/gcc.exp: Accept "fatal error:" as error prefix. * lib/g++.exp: Likewise. * lib/obj-c++.exp: Likewise. * lib/objc.exp: Likewise. * g++.dg/template/pr16564.C: New test. 2014-09-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/16564 * g++.dg/cpp0x/decltype26.C: Adjust. * g++.dg/cpp0x/decltype28.C: Likewise. * g++.dg/cpp0x/decltype29.C: Likewise. * g++.dg/cpp0x/decltype32.C: Likewise. * g++.dg/cpp0x/enum11.C: Likewise. * g++.dg/template/arrow1.C: Likewise. * g++.dg/template/pr23510.C: Likewise. * g++.dg/template/recurse.C: Likewise. * g++.dg/template/recurse2.C: Likewise. * g++.dg/template/vtable2.C: Likewise. * g++.old-deja/g++.pt/infinite1.C: Likewise. From-SVN: r215733
2014-09-30 19:10:35 +02:00
extern bool push_tinst_level (tree);
extern bool push_tinst_level_loc (tree, location_t);
extern void pop_tinst_level (void);
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
extern struct tinst_level *outermost_tinst_level(void);
extern void init_template_processing (void);
extern void print_template_statistics (void);
Emit DWARF for template parameters (PR debug/30161) ChangeLog: PR debug/30161 * include/dwarf2.h (enum dwarf_tag): Added DW_TAG_GNU_template_template_param (enum dwarf_attribute): Added DW_AT_GNU_template_name. gcc/ChangeLog: PR debug/30161 * cgraph.h (cgraph_get_node): Declare ... * cgraph.c (cgraph_get_node): ... new function. * dwarf2out.c (gen_generic_params_dies, generic_parameter_die, tree_add_const_value_attribute_for_decl, make_ith_pack_parameter_name, append_entry_to_tmpl_value_parm_die_table, gen_remaining_tmpl_value_param_die_attribute): New functions. (gen_subprogram_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_const_die): Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_struct_or_union_type_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. (tree_add_const_value_attribute): Handle integral and pointer constants. Update comment. (dwarf_tag_name): Support DW_TAG_GNU_template_template_param. (dwarf_attr_name): Support DW_AT_GNU_template_name. (reference_to_unused): Fix thinko. Remove redundant predicates from tests. (tree_add_const_value_attribute): Make this work for constant expressions only. tree_add_const_value_attribute_for_decl is to be used for variable DECLs now. (add_location_or_const_value_attribute): Use tree_add_const_value_attribute_for_decl now. (dwarf2out_finish): Emit the DW_AT_const_value attribute of DW_TAG_template_value_param DIEs after function DIEs have been emitted. * langhooks.h (lang_hooks_for_types): Add get_argument_pack_elems. (lang_hooks_for_decls): Add generic_generic_parameter_decl_p. (lang_hooks): Added get_innermost_generic_parms, get_innermost_generic_args. * langhooks-def.h (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P): New language hooks. gcc/cp/ChangeLog: PR debug/30161 * cp-tree.h (get_template_info): Parameter should be const. (CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P): Fix typo. (get_template_argument_pack_elems, get_primary_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): Declare ... * pt.c (get_template_argument_pack_elems, get_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): ... New C++ front end implementation of new language hooks. (primary_template_instantiation_p): New private helper. (make_ith_pack_parameter_name): Use snprintf and strnlen instead of printf and strlen. (get_template_info): Const-ify parameter. * cp-lang.c (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_TYPE_PARAMETER_DECL_P): Initialize these interfaces for the C++ front-end. gcc/testsuite/ChangeLog: PR debug/30161 * g++.dg/debug/dwarf2/template-params-1.C: New test. * g++.dg/debug/dwarf2/template-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-1.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-7.C: Likewise. From-SVN: r151249
2009-08-31 23:48:04 +02:00
bool template_template_parameter_p (const_tree);
bool template_type_parameter_p (const_tree);
extern bool primary_template_instantiation_p (const_tree);
Emit DWARF for template parameters (PR debug/30161) ChangeLog: PR debug/30161 * include/dwarf2.h (enum dwarf_tag): Added DW_TAG_GNU_template_template_param (enum dwarf_attribute): Added DW_AT_GNU_template_name. gcc/ChangeLog: PR debug/30161 * cgraph.h (cgraph_get_node): Declare ... * cgraph.c (cgraph_get_node): ... new function. * dwarf2out.c (gen_generic_params_dies, generic_parameter_die, tree_add_const_value_attribute_for_decl, make_ith_pack_parameter_name, append_entry_to_tmpl_value_parm_die_table, gen_remaining_tmpl_value_param_die_attribute): New functions. (gen_subprogram_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_const_die): Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_struct_or_union_type_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. (tree_add_const_value_attribute): Handle integral and pointer constants. Update comment. (dwarf_tag_name): Support DW_TAG_GNU_template_template_param. (dwarf_attr_name): Support DW_AT_GNU_template_name. (reference_to_unused): Fix thinko. Remove redundant predicates from tests. (tree_add_const_value_attribute): Make this work for constant expressions only. tree_add_const_value_attribute_for_decl is to be used for variable DECLs now. (add_location_or_const_value_attribute): Use tree_add_const_value_attribute_for_decl now. (dwarf2out_finish): Emit the DW_AT_const_value attribute of DW_TAG_template_value_param DIEs after function DIEs have been emitted. * langhooks.h (lang_hooks_for_types): Add get_argument_pack_elems. (lang_hooks_for_decls): Add generic_generic_parameter_decl_p. (lang_hooks): Added get_innermost_generic_parms, get_innermost_generic_args. * langhooks-def.h (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P): New language hooks. gcc/cp/ChangeLog: PR debug/30161 * cp-tree.h (get_template_info): Parameter should be const. (CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P): Fix typo. (get_template_argument_pack_elems, get_primary_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): Declare ... * pt.c (get_template_argument_pack_elems, get_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): ... New C++ front end implementation of new language hooks. (primary_template_instantiation_p): New private helper. (make_ith_pack_parameter_name): Use snprintf and strnlen instead of printf and strlen. (get_template_info): Const-ify parameter. * cp-lang.c (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_TYPE_PARAMETER_DECL_P): Initialize these interfaces for the C++ front-end. gcc/testsuite/ChangeLog: PR debug/30161 * g++.dg/debug/dwarf2/template-params-1.C: New test. * g++.dg/debug/dwarf2/template-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-1.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-7.C: Likewise. From-SVN: r151249
2009-08-31 23:48:04 +02:00
extern tree get_primary_template_innermost_parameters (const_tree);
extern tree get_template_parms_at_level (tree, int);
Emit DWARF for template parameters (PR debug/30161) ChangeLog: PR debug/30161 * include/dwarf2.h (enum dwarf_tag): Added DW_TAG_GNU_template_template_param (enum dwarf_attribute): Added DW_AT_GNU_template_name. gcc/ChangeLog: PR debug/30161 * cgraph.h (cgraph_get_node): Declare ... * cgraph.c (cgraph_get_node): ... new function. * dwarf2out.c (gen_generic_params_dies, generic_parameter_die, tree_add_const_value_attribute_for_decl, make_ith_pack_parameter_name, append_entry_to_tmpl_value_parm_die_table, gen_remaining_tmpl_value_param_die_attribute): New functions. (gen_subprogram_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_const_die): Use tree_add_const_value_attribute_for_decl instead of tree_add_const_value_attribute. (gen_struct_or_union_type_die): Generate debug info for template parameters if debug info level is higher than DINFO_LEVEL_TERSE. (tree_add_const_value_attribute): Handle integral and pointer constants. Update comment. (dwarf_tag_name): Support DW_TAG_GNU_template_template_param. (dwarf_attr_name): Support DW_AT_GNU_template_name. (reference_to_unused): Fix thinko. Remove redundant predicates from tests. (tree_add_const_value_attribute): Make this work for constant expressions only. tree_add_const_value_attribute_for_decl is to be used for variable DECLs now. (add_location_or_const_value_attribute): Use tree_add_const_value_attribute_for_decl now. (dwarf2out_finish): Emit the DW_AT_const_value attribute of DW_TAG_template_value_param DIEs after function DIEs have been emitted. * langhooks.h (lang_hooks_for_types): Add get_argument_pack_elems. (lang_hooks_for_decls): Add generic_generic_parameter_decl_p. (lang_hooks): Added get_innermost_generic_parms, get_innermost_generic_args. * langhooks-def.h (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P): New language hooks. gcc/cp/ChangeLog: PR debug/30161 * cp-tree.h (get_template_info): Parameter should be const. (CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P): Fix typo. (get_template_argument_pack_elems, get_primary_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): Declare ... * pt.c (get_template_argument_pack_elems, get_template_innermost_parameters, get_template_innermost_arguments, template_template_parameter_p): ... New C++ front end implementation of new language hooks. (primary_template_instantiation_p): New private helper. (make_ith_pack_parameter_name): Use snprintf and strnlen instead of printf and strlen. (get_template_info): Const-ify parameter. * cp-lang.c (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, LANG_HOOKS_GENERIC_TYPE_PARAMETER_DECL_P): Initialize these interfaces for the C++ front-end. gcc/testsuite/ChangeLog: PR debug/30161 * g++.dg/debug/dwarf2/template-params-1.C: New test. * g++.dg/debug/dwarf2/template-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-1.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-2.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-3.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-4.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-5.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-6.C: Likewise. * g++.dg/debug/dwarf2/template-func-params-7.C: Likewise. From-SVN: r151249
2009-08-31 23:48:04 +02:00
extern tree get_template_innermost_arguments (const_tree);
extern tree get_template_argument_pack_elems (const_tree);
extern tree get_function_template_decl (const_tree);
extern tree resolve_nondeduced_context (tree, tsubst_flags_t);
extern hashval_t iterative_hash_template_arg (tree arg, hashval_t val);
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
extern tree coerce_template_parms (tree, tree, tree);
extern tree coerce_template_parms (tree, tree, tree, tsubst_flags_t);
extern void register_local_specialization (tree, tree);
extern tree retrieve_local_specialization (tree);
extern tree extract_fnparm_pack (tree, tree *);
extern tree template_parm_to_arg (tree);
extern tree dguide_name (tree);
extern bool dguide_name_p (tree);
extern bool deduction_guide_p (const_tree);
extern bool copy_guide_p (const_tree);
extern bool template_guide_p (const_tree);
/* in repo.c */
extern void init_repo (void);
extern int repo_emit_p (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern bool repo_export_class_p (const_tree);
extern void finish_repo (void);
/* in rtti.c */
/* A vector of all tinfo decls that haven't been emitted yet. */
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
extern GTY(()) vec<tree, va_gc> *unemitted_tinfo_decls;
extern void init_rtti_processing (void);
extern tree build_typeid (tree, tsubst_flags_t);
extern tree get_tinfo_decl (tree);
extern tree get_typeid (tree, tsubst_flags_t);
extern tree build_headof (tree);
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
extern tree build_dynamic_cast (tree, tree, tsubst_flags_t);
extern void emit_support_tinfos (void);
extern bool emit_tinfo_decl (tree);
1994-02-24 02:02:37 +01:00
/* in search.c */
extern bool accessible_base_p (tree, tree, bool);
extern tree lookup_base (tree, tree, base_access,
base_kind *, tsubst_flags_t);
extern tree dcast_base_hint (tree, tree);
extern int accessible_p (tree, tree, bool);
extern int accessible_in_template_p (tree, tree);
extern tree lookup_field_1 (tree, tree, bool);
extern tree lookup_field (tree, tree, int, bool);
extern int lookup_fnfields_1 (tree, tree);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
extern tree lookup_fnfields_slot (tree, tree);
extern tree lookup_fnfields_slot_nolazy (tree, tree);
extern int class_method_index_for_fn (tree, tree);
extern tree lookup_fnfields (tree, tree, int);
extern tree lookup_member (tree, tree, int, bool,
tsubst_flags_t);
extern tree lookup_member_fuzzy (tree, tree, bool);
extern int look_for_overrides (tree, tree);
extern void get_pure_virtuals (tree);
extern void maybe_suppress_debug_info (tree);
extern void note_debug_info_needed (tree);
extern void print_search_statistics (void);
extern void reinit_search_statistics (void);
extern tree current_scope (void);
extern int at_function_scope_p (void);
extern bool at_class_scope_p (void);
extern bool at_namespace_scope_p (void);
extern tree context_for_name_lookup (tree);
extern tree lookup_conversions (tree);
extern tree binfo_from_vbase (tree);
extern tree binfo_for_vbase (tree, tree);
extern tree look_for_overrides_here (tree, tree);
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
#define dfs_skip_bases ((tree)1)
extern tree dfs_walk_all (tree, tree (*) (tree, void *),
tree (*) (tree, void *), void *);
extern tree dfs_walk_once (tree, tree (*) (tree, void *),
tree (*) (tree, void *), void *);
extern tree binfo_via_virtual (tree, tree);
extern bool binfo_direct_p (tree);
extern tree build_baselink (tree, tree, tree, tree);
extern tree adjust_result_of_qualified_name_lookup
(tree, tree, tree);
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
extern tree copied_binfo (tree, tree);
extern tree original_binfo (tree, tree);
extern int shared_member_p (tree);
extern bool any_dependent_bases_p (tree = current_nonlambda_class_type ());
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
re PR c++/29475 (incomplete template diagnostics.) 2006-12-16 Simon Martin <simartin@users.sourceforge.net> PR c++/29475 * cp-tree.h (struct deferred_access_check): New structure to represent a deferred access check. It replaces the previous representation as a tree. (get_deferred_access_checks): Return a vector of struct deferred_access_check instead of a tree list. (perform_access_checks): Take a vector of struct deferred_access_check instead of a tree list. * semantics.c (struct deferred_access): Store the deferred access checks as a vector of struct deferred_access_check instead of a tree list. (push_deferring_access_checks): Handle the change in struct deferred_access. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_or_defer_access_check): Likewise. (perform_access_checks): Take a vector of struct deferred_access_check instead of a tree list. * parser.c (struct tree_check): New structure to store various data associated with a CPP_NESTED_NAME_SPECIFIER or CPP_TEMPLATE_ID token. (struct cp_token): Changed the value field to be a union with a pointer to a struct tree_check for CPP_NESTED_NAME_SPECIFIER or CPP_TEMPLATE_ID tokens and a tree field for all other tokens. (eof_token): Adjusted due to the change in struct cp_token. (cp_lexer_get_preprocessor_token): Likewise. (cp_lexer_purge_token): Likewise. (cp_lexer_purge_tokens_after): Likewise. (cp_lexer_print_token): Likewise. (cp_parser_error): Likewise. (cp_parser_identifier): Likewise. (cp_parser_string_literal): Likewise. (cp_parser_primary_expression): Likewise. (cp_parser_unqualified_id): Likewise. (cp_parser_parenthesized_expression_list): Likewise. (cp_parser_storage_class_specifier_opt): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_member_specification_opt): Likewise. (cp_parser_attribute_list): Likewise. (cp_parser_objc_expression): Likewise. (cp_parser_objc_protocol_qualifiers): Likewise. (cp_parser_objc_selector): Likewise. (cp_parser_objc_declaration): Likewise. (cp_parser_objc_statement): Likewise. (cp_parser_omp_clause_name): Likewise. (cp_parser_omp_clause_default): Likewise. (cp_parser_omp_clause_schedule): Likewise. (cp_parser_omp_parallel): Likewise. (cp_parser_initial_pragma): Likewise. (pragma_lex): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. Use cp_token::u::tree_check_value to save the token's value, the associated deferred checks and its qualifying scope. (cp_parser_template_id): Likewise. (cp_parser_template_declaration_after_export): Adjusted the call to get_deferred_access_checks. (cp_parser_init_declarator): Take the access checks as a vector of struct deferred_access_check instead of a tree list. (cp_parser_single_declaration): Likewise. (cp_parser_perform_template_parameter_access_checks): Likewise. (cp_parser_simple_declaration): Adjusted the call to cp_parser_init_declarator. (cp_parser_explicit_specialization): Adjusted the call to cp_parser_single_declaration. From-SVN: r119961
2006-12-16 09:51:42 +01:00
/* The representation of a deferred access check. */
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
struct GTY(()) deferred_access_check {
re PR c++/29475 (incomplete template diagnostics.) 2006-12-16 Simon Martin <simartin@users.sourceforge.net> PR c++/29475 * cp-tree.h (struct deferred_access_check): New structure to represent a deferred access check. It replaces the previous representation as a tree. (get_deferred_access_checks): Return a vector of struct deferred_access_check instead of a tree list. (perform_access_checks): Take a vector of struct deferred_access_check instead of a tree list. * semantics.c (struct deferred_access): Store the deferred access checks as a vector of struct deferred_access_check instead of a tree list. (push_deferring_access_checks): Handle the change in struct deferred_access. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_or_defer_access_check): Likewise. (perform_access_checks): Take a vector of struct deferred_access_check instead of a tree list. * parser.c (struct tree_check): New structure to store various data associated with a CPP_NESTED_NAME_SPECIFIER or CPP_TEMPLATE_ID token. (struct cp_token): Changed the value field to be a union with a pointer to a struct tree_check for CPP_NESTED_NAME_SPECIFIER or CPP_TEMPLATE_ID tokens and a tree field for all other tokens. (eof_token): Adjusted due to the change in struct cp_token. (cp_lexer_get_preprocessor_token): Likewise. (cp_lexer_purge_token): Likewise. (cp_lexer_purge_tokens_after): Likewise. (cp_lexer_print_token): Likewise. (cp_parser_error): Likewise. (cp_parser_identifier): Likewise. (cp_parser_string_literal): Likewise. (cp_parser_primary_expression): Likewise. (cp_parser_unqualified_id): Likewise. (cp_parser_parenthesized_expression_list): Likewise. (cp_parser_storage_class_specifier_opt): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_member_specification_opt): Likewise. (cp_parser_attribute_list): Likewise. (cp_parser_objc_expression): Likewise. (cp_parser_objc_protocol_qualifiers): Likewise. (cp_parser_objc_selector): Likewise. (cp_parser_objc_declaration): Likewise. (cp_parser_objc_statement): Likewise. (cp_parser_omp_clause_name): Likewise. (cp_parser_omp_clause_default): Likewise. (cp_parser_omp_clause_schedule): Likewise. (cp_parser_omp_parallel): Likewise. (cp_parser_initial_pragma): Likewise. (pragma_lex): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. Use cp_token::u::tree_check_value to save the token's value, the associated deferred checks and its qualifying scope. (cp_parser_template_id): Likewise. (cp_parser_template_declaration_after_export): Adjusted the call to get_deferred_access_checks. (cp_parser_init_declarator): Take the access checks as a vector of struct deferred_access_check instead of a tree list. (cp_parser_single_declaration): Likewise. (cp_parser_perform_template_parameter_access_checks): Likewise. (cp_parser_simple_declaration): Adjusted the call to cp_parser_init_declarator. (cp_parser_explicit_specialization): Adjusted the call to cp_parser_single_declaration. From-SVN: r119961
2006-12-16 09:51:42 +01:00
/* The base class in which the declaration is referenced. */
tree binfo;
/* The declaration whose access must be checked. */
tree decl;
/* The declaration that should be used in the error message. */
tree diag_decl;
/* The location of this access. */
location_t loc;
remove more useless typedefs gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-08-19 04:48:48 +02:00
};
re PR c++/29475 (incomplete template diagnostics.) 2006-12-16 Simon Martin <simartin@users.sourceforge.net> PR c++/29475 * cp-tree.h (struct deferred_access_check): New structure to represent a deferred access check. It replaces the previous representation as a tree. (get_deferred_access_checks): Return a vector of struct deferred_access_check instead of a tree list. (perform_access_checks): Take a vector of struct deferred_access_check instead of a tree list. * semantics.c (struct deferred_access): Store the deferred access checks as a vector of struct deferred_access_check instead of a tree list. (push_deferring_access_checks): Handle the change in struct deferred_access. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_or_defer_access_check): Likewise. (perform_access_checks): Take a vector of struct deferred_access_check instead of a tree list. * parser.c (struct tree_check): New structure to store various data associated with a CPP_NESTED_NAME_SPECIFIER or CPP_TEMPLATE_ID token. (struct cp_token): Changed the value field to be a union with a pointer to a struct tree_check for CPP_NESTED_NAME_SPECIFIER or CPP_TEMPLATE_ID tokens and a tree field for all other tokens. (eof_token): Adjusted due to the change in struct cp_token. (cp_lexer_get_preprocessor_token): Likewise. (cp_lexer_purge_token): Likewise. (cp_lexer_purge_tokens_after): Likewise. (cp_lexer_print_token): Likewise. (cp_parser_error): Likewise. (cp_parser_identifier): Likewise. (cp_parser_string_literal): Likewise. (cp_parser_primary_expression): Likewise. (cp_parser_unqualified_id): Likewise. (cp_parser_parenthesized_expression_list): Likewise. (cp_parser_storage_class_specifier_opt): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_type_specifier): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_member_specification_opt): Likewise. (cp_parser_attribute_list): Likewise. (cp_parser_objc_expression): Likewise. (cp_parser_objc_protocol_qualifiers): Likewise. (cp_parser_objc_selector): Likewise. (cp_parser_objc_declaration): Likewise. (cp_parser_objc_statement): Likewise. (cp_parser_omp_clause_name): Likewise. (cp_parser_omp_clause_default): Likewise. (cp_parser_omp_clause_schedule): Likewise. (cp_parser_omp_parallel): Likewise. (cp_parser_initial_pragma): Likewise. (pragma_lex): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. Use cp_token::u::tree_check_value to save the token's value, the associated deferred checks and its qualifying scope. (cp_parser_template_id): Likewise. (cp_parser_template_declaration_after_export): Adjusted the call to get_deferred_access_checks. (cp_parser_init_declarator): Take the access checks as a vector of struct deferred_access_check instead of a tree list. (cp_parser_single_declaration): Likewise. (cp_parser_perform_template_parameter_access_checks): Likewise. (cp_parser_simple_declaration): Adjusted the call to cp_parser_init_declarator. (cp_parser_explicit_specialization): Adjusted the call to cp_parser_single_declaration. From-SVN: r119961
2006-12-16 09:51:42 +01:00
/* in semantics.c */
extern void push_deferring_access_checks (deferring_kind);
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
extern void resume_deferring_access_checks (void);
extern void stop_deferring_access_checks (void);
extern void pop_deferring_access_checks (void);
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
extern vec<deferred_access_check, va_gc> *get_deferred_access_checks (void);
extern void reopen_deferring_access_checks (vec<deferred_access_check, va_gc> *);
extern void pop_to_parent_deferring_access_checks (void);
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
extern bool perform_access_checks (vec<deferred_access_check, va_gc> *,
tsubst_flags_t);
extern bool perform_deferred_access_checks (tsubst_flags_t);
extern bool perform_or_defer_access_check (tree, tree, tree,
tsubst_flags_t);
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
/* RAII sentinel to ensures that deferred access checks are popped before
a function returns. */
struct deferring_access_check_sentinel
{
deferring_access_check_sentinel ()
{
push_deferring_access_checks (dk_deferred);
}
~deferring_access_check_sentinel ()
{
pop_deferring_access_checks ();
}
};
extern int stmts_are_full_exprs_p (void);
extern void init_cp_semantics (void);
extern tree do_poplevel (tree);
extern void break_maybe_infinite_loop (void);
extern void add_decl_expr (tree);
extern tree maybe_cleanup_point_expr_void (tree);
extern tree finish_expr_stmt (tree);
extern tree begin_if_stmt (void);
extern tree finish_if_stmt_cond (tree, tree);
extern tree finish_then_clause (tree);
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
extern void begin_else_clause (tree);
extern void finish_else_clause (tree);
extern void finish_if_stmt (tree);
extern tree begin_while_stmt (void);
extern void finish_while_stmt_cond (tree, tree, bool);
extern void finish_while_stmt (tree);
extern tree begin_do_stmt (void);
extern void finish_do_body (tree);
extern void finish_do_stmt (tree, tree, bool);
extern tree finish_return_stmt (tree);
extern tree begin_for_scope (tree *);
extern tree begin_for_stmt (tree, tree);
Implement P0305R1, Selection statements with initializer. * cp-array-notation.c (create_an_loop): Call finish_init_stmt instead of finish_for_init_stmt. * cp-tree.h (finish_for_init_stmt): Rename to finish_init_stmt. * decl.c (poplevel): Adjust a comment. * init.c (build_vec_init): Call finish_init_stmt instead of finish_for_init_stmt. * name-lookup.c (pushdecl_maybe_friend_1): Adjust a comment. * name-lookup.h (enum scope_kind): Likewise. * parser.c (cp_parser_statement): Update commentary. (cp_parser_init_statement_p): New function. (cp_parser_selection_statement): Parse the optional init-statement. (cp_parser_for): Call finish_init_stmt instead of finish_for_init_stmt. (cp_parser_c_for): Likewise. (cp_convert_range_for): Call finish_init_stmt instead of finish_for_init_stmt. (cp_parser_range_for_member_function): Update commentary. (cp_parser_iteration_statement): (cp_parser_for_init_statement): Rename to cp_parser_init_statement. * pt.c (tsubst_omp_for_iterator): Update commentary. (tsubst_expr): Call finish_init_stmt instead of finish_for_init_stmt. * semantics.c (finish_for_init_stmt): Rename to finish_init_stmt. Update commentary. * g++.dg/cpp1z/init-statement1.C: New test. * g++.dg/cpp1z/init-statement2.C: New test. * g++.dg/cpp1z/init-statement3.C: New test. * g++.dg/cpp1z/init-statement4.C: New test. * g++.dg/cpp1z/init-statement5.C: New test. * g++.dg/cpp1z/init-statement6.C: New test. * g++.dg/cpp1z/init-statement7.C: New test. * g++.dg/cpp1z/init-statement8.C: New test. From-SVN: r240798
2016-10-05 20:02:06 +02:00
extern void finish_init_stmt (tree);
extern void finish_for_cond (tree, tree, bool);
extern void finish_for_expr (tree, tree);
extern void finish_for_stmt (tree);
extern tree begin_range_for_stmt (tree, tree);
extern void finish_range_for_decl (tree, tree, tree);
extern void finish_range_for_stmt (tree);
extern tree finish_break_stmt (void);
extern tree finish_continue_stmt (void);
extern tree begin_switch_stmt (void);
extern void finish_switch_cond (tree, tree);
extern void finish_switch_stmt (tree);
extern tree finish_goto_stmt (tree);
extern tree begin_try_block (void);
extern void finish_try_block (tree);
extern void finish_handler_sequence (tree);
extern tree begin_function_try_block (tree *);
extern void finish_function_try_block (tree);
extern void finish_function_handler_sequence (tree, tree);
extern void finish_cleanup_try_block (tree);
extern tree begin_handler (void);
extern void finish_handler_parms (tree, tree);
extern void finish_handler (tree);
extern void finish_cleanup (tree, tree);
semantics.c (is_instantiation_of_constexpr, [...]): Moved definitions... 2014-10-15 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (is_instantiation_of_constexpr, literal_type_p, ensure_literal_type_for_constexpr_object, constexpr_fundef_hasher::equal, constexpr_fundef_hasher::hash, retrieve_constexpr_fundef, is_valid_constexpr_fn, build_anon_member_initialization, build_data_member_initialization, check_constexpr_bind_expr_vars, check_constexpr_ctor_body_1, check_constexpr_ctor_body, sort_constexpr_mem_initializers, build_constexpr_constructor_member_initializers, constexpr_fn_retval, massage_constexpr_body, cx_check_missing_mem_inits, register_constexpr_fundef, explain_invalid_constexpr_fn, constexpr_call_hasher::hash, constexpr_call_hasher::equal, maybe_initialize_constexpr_call_table, get_function_named_in_call, get_nth_callarg, lookup_parameter_binding, cxx_eval_builtin_function_call, adjust_temp_type, cxx_bind_parameters_in_call, push_cx_call_context, pop_cx_call_context, cx_error_context, cxx_eval_call_expression, reduced_constant_expression_p, verify_constant, cxx_eval_unary_expression, cxx_eval_binary_expression, cxx_eval_conditional_expression, cxx_eval_array_reference, cxx_eval_component_reference, cxx_eval_bit_field_ref, cxx_eval_logical_expression, base_field_constructor_elt, cxx_eval_bare_aggregate, cxx_eval_vec_init_1, cxx_eval_vec_init, cxx_fold_indirect_ref, cxx_eval_indirect_ref, non_const_var_error, cxx_eval_trinary_expression, var_in_constexpr_fn, cxx_eval_constant_expression, cxx_eval_outermost_constant_expr, is_sub_constant_expr, cxx_constant_value, maybe_constant_value, maybe_constant_init, potential_constant_expression_1, potential_constant_expression, potential_rvalue_constant_expression, require_potential_constant_expression, require_potential_rvalue_constant_expression): Moved definitions... * constexpr.c: ... here, new file. * Make-lang.in: Update. * config-lang.in: Likewise. From-SVN: r216263
2014-10-15 16:40:54 +02:00
extern bool is_this_parameter (tree);
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
enum {
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
BCS_NORMAL = 0,
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
BCS_NO_SCOPE = 1,
BCS_TRY_BLOCK = 2,
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
BCS_FN_BODY = 4,
BCS_TRANSACTION = 8
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
};
extern tree begin_compound_stmt (unsigned int);
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
extern void finish_compound_stmt (tree);
builtins.c (expand_builtin_synchronize): Use gimple_build_asm_vec. * builtins.c (expand_builtin_synchronize): Use gimple_build_asm_vec. * cfgbuild.c (make_edges): Handle asm goto. * cfglayout.c (fixup_reorder_chain): Likewise. * cfgrtl.c (patch_jump_insn): Likewise. * gimple-pretty-print.c (dump_gimple_asm): Likewise. * gimple.c (gimple_build_asm_1): Add and use nlabels parameter. (gimple_build_asm_vec): Add and use labels parameter. (gimple_build_asm): Remove. (walk_gimple_asm): Walk labels too. * gimple.def (GIMPLE_ASM): Update docs. * gimple.h: Update decls. (struct gimple_statement_asm): Change nc to use unsigned char; add nl member. (gimple_asm_nlabels): New. (gimple_asm_label_op, gimple_asm_set_label_op): New. * gimplify.c (gimplify_asm_expr): Copy labels from ASM_EXPR into gimple_build_asm_vec. * jump.c (mark_jump_label_asm): New. (mark_jump_label): Use it. (redirect_jump_1): Handle asm goto. (invert_jump_1): Soft fail if X is null. * recog.c (extract_asm_operands): New. (asm_noperands): Use it; handle asm labels. (decode_asm_operands): Use extract_asm_operands. (asm_operand_ok): Properly handle empty string. * reg-stack.c (get_asm_operands_in_out): Rename from get_asm_operand_n_inputs; use extract_asm_operands; return both inputs and outputs by reference; update all callers. * rtl.def (ASM_OPERANDS): Add label vector as operand 6. * rtl.h (ASM_OPERANDS_LABEL_VEC): New. (ASM_OPERANDS_LABEL_LENGTH, ASM_OPERANDS_LABEL): New. (ASM_OPERANDS_SOURCE_LOCATION): Renumber. (extract_asm_operands): Declare. * stmt.c (expand_asm_operands): Add and use labels parameter. (check_unique_operand_names): Likewise. (resolve_asm_operand_names, resolve_operand_name_1): Likewise. (expand_asm_stmt): Handle asm labels. * tree-cfg.c (make_gimple_asm_edges): New. (make_edges): Use it. (cleanup_dead_labels): Handle asm labels. (is_ctrl_altering_stmt): Likewise. (gimple_redirect_edge_and_branch): Likewise. * tree.def (ASM_EXPR): Add 5th operand. * tree.h (ASM_LABELS): New. (resolve_asm_operand_names): Update decl. * c-parser.c (c_parser_asm_statement): Parse asm goto. (c_parser_asm_goto_operands): New. * c-tree.h (build_asm_expr): Update decl. * c-typeck.c (build_asm_expr): Add and use labels parameter. * doc/extend.texi: Document asm goto. gcc/ada/ * gcc-interface/trans.c (Pragma_to_gnu): Use build5 for ASM_EXPR. gcc/cp/ * cp-tree.h (finish_asm_stmt): Update decl. * parser.c (cp_parser_asm_definition): Parse asm goto. (cp_parser_asm_label_list): New. * pt.c (tsubst_copy_asm_operands): Don't recurse on labels. (tsubst_expr): Handle asm labels. * semantics.c (finish_asm_stmt): Add and use labels parameter. gcc/testsuite/ * c-c++-common/asmgoto-1.c, c-c++-common/asmgoto-2.c, c-c++-common/asmgoto-3.c, gcc.c-torture/compile/asmgoto-1.c, gcc.dg/tree-ssa/asmgoto-1.c: New files. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r151701
2009-09-14 22:17:24 +02:00
extern tree finish_asm_stmt (int, tree, tree, tree, tree,
tree);
extern tree finish_label_stmt (tree);
extern void finish_label_decl (tree);
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
extern cp_expr finish_parenthesized_expr (cp_expr);
extern tree force_paren_expr (tree);
extern tree maybe_undo_parenthesized_ref (tree);
extern tree finish_non_static_data_member (tree, tree, tree);
extern tree begin_stmt_expr (void);
extern tree finish_stmt_expr_expr (tree, tree);
extern tree finish_stmt_expr (tree, bool);
extern tree stmt_expr_value_expr (tree);
bool empty_expr_stmt_p (tree);
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
extern cp_expr perform_koenig_lookup (cp_expr, vec<tree, va_gc> *,
re PR c++/24163 (dependent Base class scope examined during unqualified name lookup in template) PR c++/24163 PR c++/29131 gcc/cp/ * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Avoid repeating unqualified lookup. * semantics.c (perform_koenig_lookup): Add complain parm. * cp-tree.h: Adjust. * parser.c (cp_parser_postfix_expression): Adjust. (cp_parser_perform_range_for_lookup): Adjust. libstdc++-v3/ * include/ext/pb_ds/assoc_container.hpp: Explicitly qualify calls to functions from dependent bases. * include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/rb_tree_map_/ split_join_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/splay_tree_/ split_join_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/tree_policy/ order_statistics_imp.hpp: Likewise. * include/ext/pb_ds/detail/trie_policy/ prefix_search_node_update_imp.hpp: Likewise. * include/ext/rc_string_base.h: Likewise. * include/ext/rope: Likewise. * include/ext/ropeimpl.h: Likewise. * testsuite/util/exception/safety.h: Likewise. * testsuite/util/native_type/native_priority_queue.hpp: Likewise. * testsuite/util/testsuite_io.h: Likewise. * include/std/functional: Declare mem_fn earlier. * include/tr1/functional: Likewise. * include/tr1/exp_integral.tcc: Declare __expint_E1 earlier. From-SVN: r173965
2011-05-20 20:01:22 +02:00
tsubst_flags_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
extern tree finish_call_expr (tree, vec<tree, va_gc> **, bool,
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
bool, tsubst_flags_t);
extern tree lookup_and_finish_template_variable (tree, tree, tsubst_flags_t = tf_warning_or_error);
extern tree finish_template_variable (tree, tsubst_flags_t = tf_warning_or_error);
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
extern cp_expr finish_increment_expr (cp_expr, enum tree_code);
extern tree finish_this_expr (void);
extern tree finish_pseudo_destructor_expr (tree, tree, tree, location_t);
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
extern cp_expr finish_unary_op_expr (location_t, enum tree_code, cp_expr,
tsubst_flags_t);
extern tree finish_compound_literal (tree, tree, tsubst_flags_t);
extern tree finish_fname (tree);
extern void finish_translation_unit (void);
extern tree finish_template_type_parm (tree, tree);
extern tree finish_template_template_parm (tree, tree);
extern tree begin_class_definition (tree);
extern void finish_template_decl (tree);
extern tree finish_template_type (tree, tree, int);
extern tree finish_base_specifier (tree, tree, bool);
extern void finish_member_declaration (tree);
extern bool outer_automatic_var_p (tree);
extern tree process_outer_var_ref (tree, tsubst_flags_t);
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
extern cp_expr finish_id_expression (tree, tree, tree,
re PR c++/22137 (Internal error: Segmentation fault (program cc1plus)) PR c++/22137 * cp-tree.h (QUALIFIED_NAME_IS_TEMPLATE): New macro. (check_template_keyword): New function. (finish_id_expression): Change prototoype. (finish_qualified_id_expr): Change prototype. (build_qualified_name): New function. (finish_class_member_access_expr): Change prototype. * init.c (build_offset_ref): Use build_qualified_name. * mangle.c (write_expression): Likewise. * parser.c (cp_parser_primary_expression): Remove qualifying_class parameter. Add address_p and template_arg_p. Use build_qualified_name. (cp_parser_id_expression): Default *template_p to template_keyword_p. Check for invalid uses of the template keyword. (cp_parser_postfix_expression): Eliminate special handling for qualified names. Adjust call to cp_parser_primary_expression. (cp_parser_postfix_dot_deref_expression): Adjust call to cp_parser_id_expression and finish_class_member_access_expr. (cp_parser_template_argument_list): Add comment. (cp_parser_template_argument): Adjust use of cp_parser_primary_expression. Remove call to finish_qualified_id_expr. (cp_parser_lookup_name): Use build_qualified_name. * pt.c (tsubst): Use build_qualified_name. (tsubst_qualified_id): Likewise. Adjust call to finish_qualified_id_expr. (tsubst_copy): Use build_qualified_name. (tsubst_copy_and_build): Adjusts call to finish_id_expression and finish_class_member_access_expr. * semantics.c (finish_non_static_data_member): Use build_qualified_name. (finish_qualified_id_expr): Add template_p and template_arg_p parameters. (finish_id_expression): Remove qualifiying_class parameter. Add template_p, done, address_p, and template_arg_p. Use build_qualified_name. Adjust calls to finish_class_member_acess_expr. * tree.c (build_qualified_name): New function. * typeck.c (check_template_keyword): New function. (finish_class_member_access_expr): Add template_p argument. Check for invalid uses of the template keyword. PR c++/22137 * g++.dg/parse/template18.C: New test. * g++.dg/template/nontype15.C: Likewise. From-SVN: r105463
2005-10-16 21:38:57 +02:00
cp_id_kind *,
bool, bool, bool *,
re PR c++/22137 (Internal error: Segmentation fault (program cc1plus)) PR c++/22137 * cp-tree.h (QUALIFIED_NAME_IS_TEMPLATE): New macro. (check_template_keyword): New function. (finish_id_expression): Change prototoype. (finish_qualified_id_expr): Change prototype. (build_qualified_name): New function. (finish_class_member_access_expr): Change prototype. * init.c (build_offset_ref): Use build_qualified_name. * mangle.c (write_expression): Likewise. * parser.c (cp_parser_primary_expression): Remove qualifying_class parameter. Add address_p and template_arg_p. Use build_qualified_name. (cp_parser_id_expression): Default *template_p to template_keyword_p. Check for invalid uses of the template keyword. (cp_parser_postfix_expression): Eliminate special handling for qualified names. Adjust call to cp_parser_primary_expression. (cp_parser_postfix_dot_deref_expression): Adjust call to cp_parser_id_expression and finish_class_member_access_expr. (cp_parser_template_argument_list): Add comment. (cp_parser_template_argument): Adjust use of cp_parser_primary_expression. Remove call to finish_qualified_id_expr. (cp_parser_lookup_name): Use build_qualified_name. * pt.c (tsubst): Use build_qualified_name. (tsubst_qualified_id): Likewise. Adjust call to finish_qualified_id_expr. (tsubst_copy): Use build_qualified_name. (tsubst_copy_and_build): Adjusts call to finish_id_expression and finish_class_member_access_expr. * semantics.c (finish_non_static_data_member): Use build_qualified_name. (finish_qualified_id_expr): Add template_p and template_arg_p parameters. (finish_id_expression): Remove qualifiying_class parameter. Add template_p, done, address_p, and template_arg_p. Use build_qualified_name. Adjust calls to finish_class_member_acess_expr. * tree.c (build_qualified_name): New function. * typeck.c (check_template_keyword): New function. (finish_class_member_access_expr): Add template_p argument. Check for invalid uses of the template keyword. PR c++/22137 * g++.dg/parse/template18.C: New test. * g++.dg/template/nontype15.C: Likewise. From-SVN: r105463
2005-10-16 21:38:57 +02:00
bool, bool, bool, bool,
re PR c++/31754 (Improve column number accuracy in error messages) 2008-07-11 Dodji Seketeli <dseketel@redhat.com> PR c++/31754 * pt.c, semantic.c: * semantic.c (qualified_name_lookup_error, finish_id_expression): add a location_t parameter so that error message can have a more accurate location. * cp-tree.h: updated prototype * pt.c (tsubst_qualified_id): use location in error messages. * parser.c (cp_parser_postfix_expression, cp_parser_objc_statement, cp_parser_trait_expr, cp_parser_token_is_class_key, cp_parser_uncommitted_to_tentative_parse_p, cp_parser_check_for_invalid_template_id, cp_parser_is_string_literal, cp_parser_error, cp_parser_name_lookup_error, cp_parser_simulate_error, cp_parser_check_decl_spec, cp_parser_check_decl_spec, cp_parser_non_integral_constant_expression, cp_parser_diagnose_invalid_type_name, cp_parser_parse_and_diagnose_invalid_type_name, cp_parser_require_pragma_eol, cp_parser_make_typename_type, cp_parser_string_literal, cp_parser_primary_expression, cp_parser_primary_expression, cp_parser_unqualified_id, cp_parser_nested_name_specifier_opt, cp_parser_postfix_expression, cp_parser_postfix_dot_deref_expression, cp_parser_new_expression, cp_parser_direct_new_declarator, cp_parser_builtin_offsetof, cp_parser_label_for_labeled_statement, cp_parser_statement_seq_opt, cp_parser_jump_statement, cp_parser_block_declaration, cp_parser_simple_declaration, cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt, cp_parser_decltype, cp_parser_mem_initializer_list, cp_parser_mem_initializer, cp_parser_mem_initializer_id, cp_parser_template_parameter, cp_parser_type_parameter, cp_parser_template_id, cp_parser_template_name, cp_parser_template_argument): likewise. From-SVN: r137716
2008-07-11 14:54:22 +02:00
const char **,
location_t);
extern tree finish_typeof (tree);
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
extern tree finish_underlying_type (tree);
[multiple changes] 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * gcc/c-family/c-common.c (c_common_reswords): Add __bases, __direct_bases. * gcc/c-family/c-common.h: Add RID_BASES and RID_DIRECT_BASES. 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * cp-tree.def: Add BASES as a new tree code. * cp-tree.h (enum cp_trait_kind): Add CPTK_BASES, CPTK_DIRECT_BASES. (BASES_TYPE, BASES_DIRECT): Define. (calculate_bases, finish_bases, calculate_direct_bases): Declare. * parser.c (cp_parser_trait_expr, cp_parser_template_argument_list, (cp_parser_simple_type_specifier, cp_parser_save_nsdmi): Use them. * pt.c (find_parameter_packs_r, tsubst_pack_expansion): Likewise. * semantics.c (calculate_bases, finish_bases, calculate_direct_bases, dfs_calculate_bases_pre, dfs_calculate_bases_post, calculate_bases_helper): Define. 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * g++.dg/ext/bases.C: New test. 2011-10-17 Michael Spertus <mike_spertus@symantec.com> * include/tr2/type_traits (bases, direct_bases, typelist): New. 2011-10-17 Benjamin Kosnik <bkoz@redhat.com> * libstdc++-v3/include/Makefile.am: Add tr2 directory and includes. * libstdc++-v3/include/Makefile.in: Regenerate. * scripts/create_testsuite_files: Search tr2 directory. * testsuite/libstdc++-dg/conformance.exp: Same. * testsuite/tr2/bases/requirements/explicit_instantiation.cc: New. * testsuite/tr2/bases/requirements/typedefs.cc: New. * testsuite/tr2/bases/value.cc: New. * testsuite/tr2/direct_bases/requirements/ explicit_instantiation.cc: New. * testsuite/tr2/direct_bases/requirements/typedefs.cc: New. * testsuite/tr2/direct_bases/value.cc: New. From-SVN: r180121
2011-10-18 04:58:06 +02:00
extern tree calculate_bases (tree);
extern tree finish_bases (tree, bool);
extern tree calculate_direct_bases (tree);
extern tree finish_offsetof (tree, tree, location_t);
extern void finish_decl_cleanup (tree, tree);
extern void finish_eh_cleanup (tree);
extern void emit_associated_thunks (tree);
extern void finish_mem_initializers (tree);
extern tree check_template_template_default_arg (tree);
re PR c++/3187 (gcc lays down two copies of constructors) PR c++/3187 * cgraph.h (struct cgraph_node): Add same_body and same_body_alias fields. (cgraph_same_body_alias, cgraph_remove_same_body_alias): New prototypes. * cgraphunit.c (cgraph_expand_function, cgraph_emit_thunks, cgraph_materialize_all_clones): Handle same_body aliases. * cgraph.c (cgraph_allocate_node): New function. (cgraph_create_node): Use it. (cgraph_node_for_decl, cgraph_node, cgraph_get_node, cgraph_node_for_asm, cgraph_remove_node): Handle same_body aliases. (cgraph_same_body_alias, cgraph_remove_same_body_alias): New functions. * lto-cgraph.c (lto_output_node): Stream out same_body aliases. (input_node): Stream in same_body aliases. * lto-symtab.c (lto_cgraph_replace_node): Clear node pointers for same_body aliases. (lto_symtab_merge_cgraph_nodes_1): Handle same_body aliases. * cp-tree.h (expand_or_defer_fn_1): New prototype. * decl2.c (cp_write_global_declarations): Mark as !DECL_EXTERNAL also all same_body aliases. * semantics.c (expand_or_defer_fn): Move most of the function except registering with cgraph to ... (expand_or_defer_fn_1): ... here. New function. * optimize.c: Include cgraph.h. (maybe_clone_body): If in charge parm is not used and both base and complete clones are created and are not comdat, tell cgraph they have the same body. * Make-lang.in (cp/optimize.o): Depend on $(CGRAPH_H). * g++.dg/abi/mangle26.C: Also match *C2* definition. * g++.dg/abi/mangle27.C: Likewise. * g++.dg/abi/mangle28.C: Likewise. * g++.dg/abi/mangle29.C: Likewise. From-SVN: r154284
2009-11-18 10:53:52 +01:00
extern bool expand_or_defer_fn_1 (tree);
extern void expand_or_defer_fn (tree);
re PR c++/14777 (typedef doesn't fully expose base class type) Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-23 14:29:50 +01:00
extern void add_typedef_to_current_template_for_access_check (tree, tree,
location_t);
cp-tree.h (build_scoped_method_call): Remove. * cp-tree.h (build_scoped_method_call): Remove. (lookup_qualified_name): Remove parameter. (tsubst_copy_and_build): Declare. (finish_qualified_object_call_expr): Remove. (check_accessibility_of_qualified_id): New function. (finish_qualified_id_expr): Likewise. (non_reference): Likewise. (build_expr_from-tree): Remove. * call.c (non_reference): Remove. (build_scoped_method_call): Likewise. (build_method_call): Use error_operand_p. Assert that we are not processing a template. (standard_conversion): Use non_reference. * class.c (build_vtbl_entry_ref): Likewise. (build_vtbl_ref_1): Likewise. * cvt.c (build_expr_type_conversion): Use non_reference. * decl.c (lookup_qualified_name): Remove flags parameter. (grok_op_properties): Use non_reference. * decl2.c (grok_array_decl): Likewise. (build_expr_from_tree): Remove. (build_offset_ref_call_from_tree): Update comment. * error.c (parm_to_string): Call reinit_global_formatting_buffer. * except.c (prepare_eh_types): Use non_reference. (can_convert_eh): Likewise. * init.c (build_dtor_call): Avoid using build_method_call. * mangle.c (write_template_param): Remove misleading comment. * method.c (locate_copy): Use non_reference. * parser.c (cp_parser_scope_through_which_access_occurs): Remove. (cp_parser_primary_expression): Do not create SCOPE_REFs is non-dependent contexts. (cp_parser_postfix_expression): Use finish_qualified_id_expr. (cp_parser_direct_declarator): Use tsubst_copy_and_build, not build_expr_from_tree. (cp_parser_lookup_name): Adjust call to lookup_qualified_name. Use check_accessibility_of_qualified_id. * pt.c (maybe_fold_nontype_arg): Use tsubst_copy_and_build, not build_expr_from_tree. (tsubst_baselink): New function. (tsubst_qualified_id): Likewise. (tsubst_copy): Use them. Remove support for METHOD_CALL_EXPR. (tsubst_expr): Adjust call to lookup_qualified_name. (tsubst_copy_and_build): Handle SCOPE_REFs specially. Adjust handling of CALL_EXPRs. (value_dependent_expression_p): Use INTEGRAL_OR_ENUMERATION_TYPE_P. * rtti.c (get_tinfo_decl_dynamic): Use non_reference. * search.c (check_final_overrider): Likewise. * semantics.c (check_accessibility_of_qualified_id): New function. (finish_qualified_object_call_expr): Remove. * typeck.c (target_type): Use non_reference. (cxx_sizeof_or_alignof_type): Likewise. (dubious_conversion_warnings): Likewise. (convert_for_initialization): Likewise. (non_reference): New function. From-SVN: r69063
2003-07-08 03:38:44 +02:00
extern void check_accessibility_of_qualified_id (tree, tree, tree);
re PR c++/22137 (Internal error: Segmentation fault (program cc1plus)) PR c++/22137 * cp-tree.h (QUALIFIED_NAME_IS_TEMPLATE): New macro. (check_template_keyword): New function. (finish_id_expression): Change prototoype. (finish_qualified_id_expr): Change prototype. (build_qualified_name): New function. (finish_class_member_access_expr): Change prototype. * init.c (build_offset_ref): Use build_qualified_name. * mangle.c (write_expression): Likewise. * parser.c (cp_parser_primary_expression): Remove qualifying_class parameter. Add address_p and template_arg_p. Use build_qualified_name. (cp_parser_id_expression): Default *template_p to template_keyword_p. Check for invalid uses of the template keyword. (cp_parser_postfix_expression): Eliminate special handling for qualified names. Adjust call to cp_parser_primary_expression. (cp_parser_postfix_dot_deref_expression): Adjust call to cp_parser_id_expression and finish_class_member_access_expr. (cp_parser_template_argument_list): Add comment. (cp_parser_template_argument): Adjust use of cp_parser_primary_expression. Remove call to finish_qualified_id_expr. (cp_parser_lookup_name): Use build_qualified_name. * pt.c (tsubst): Use build_qualified_name. (tsubst_qualified_id): Likewise. Adjust call to finish_qualified_id_expr. (tsubst_copy): Use build_qualified_name. (tsubst_copy_and_build): Adjusts call to finish_id_expression and finish_class_member_access_expr. * semantics.c (finish_non_static_data_member): Use build_qualified_name. (finish_qualified_id_expr): Add template_p and template_arg_p parameters. (finish_id_expression): Remove qualifiying_class parameter. Add template_p, done, address_p, and template_arg_p. Use build_qualified_name. Adjust calls to finish_class_member_acess_expr. * tree.c (build_qualified_name): New function. * typeck.c (check_template_keyword): New function. (finish_class_member_access_expr): Add template_p argument. Check for invalid uses of the template keyword. PR c++/22137 * g++.dg/parse/template18.C: New test. * g++.dg/template/nontype15.C: Likewise. From-SVN: r105463
2005-10-16 21:38:57 +02:00
extern tree finish_qualified_id_expr (tree, tree, bool, bool,
bool, bool, tsubst_flags_t);
extern void simplify_aggr_init_expr (tree *);
extern void finalize_nrv (tree *, tree, tree);
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
extern tree omp_reduction_id (enum tree_code, tree, tree);
extern tree cp_remove_omp_priv_cleanup_stmt (tree *, int *, void *);
extern void cp_check_omp_declare_reduction (tree);
builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, [...]): New. gcc/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. * cgraph.h (enum cgraph_simd_clone_arg_type): Add SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP, SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP. (struct cgraph_simd_clone_arg): Adjust comment. * coretypes.h (struct gomp_ordered): New forward decl. * gimple.c (gimple_build_omp_critical): Add CLAUSES argument, set critical clauses to it. (gimple_build_omp_ordered): Return gomp_ordered * instead of gimple *. Add CLAUSES argument, set ordered clauses to it. (gimple_copy): Unshare clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimple.def (GIMPLE_OMP_ORDERED): Change from GSS_OMP to GSS_OMP_SINGLE_LAYOUT, move it after GIMPLE_OMP_TEAMS. * gimple.h (enum gf_mask): Add GF_OMP_TASK_TASKLOOP. Add another bit to GF_OMP_FOR_KIND_MASK mask. Add GF_OMP_FOR_KIND_TASKLOOP, renumber GF_OMP_FOR_KIND_CILKFOR and GF_OMP_FOR_KIND_OACC_LOOP. Adjust GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED and GF_OMP_FOR_COMBINED_INTO. Add another bit to GF_OMP_TARGET_KIND_MASK mask. Add GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, renumber GF_OMP_TARGET_KIND_OACC_{PARALLEL,KERNELS,DATA,UPDATE,ENTER_EXIT_DATA}. (gomp_critical): Add clauses field. (gomp_ordered): New struct. (is_a_helper <gomp_ordered *>::test): New inline. (gimple_build_omp_critical): Add CLAUSES argument. (gimple_build_omp_ordered): Likewise. Return gomp_ordered * instead of gimple *. (gimple_omp_critical_clauses, gimple_omp_critical_clauses_ptr, gimple_omp_critical_set_clauses, gimple_omp_ordered_clauses, gimple_omp_ordered_clauses_ptr, gimple_omp_ordered_set_clauses, gimple_omp_task_taskloop_p, gimple_omp_task_set_taskloop_p): New inline functions. * gimple-pretty-print.c (dump_gimple_omp_for): Handle taskloop. (dump_gimple_omp_target): Handle enter data and exit data. (dump_gimple_omp_block): Don't handle GIMPLE_OMP_ORDERED here. (dump_gimple_omp_critical): Print clauses. (dump_gimple_omp_ordered): New function. (dump_gimple_omp_task): Handle taskloop. (pp_gimple_stmt_1): Use dump_gimple_omp_ordered for GIMPLE_OMP_ORDERED. * gimple-walk.c (walk_gimple_op): Walk clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_0LEN_ARRAY. (enum omp_region_type): Add ORT_COMBINED_TARGET and ORT_NONE. (struct gimplify_omp_ctx): Add loop_iter_var, target_map_scalars_firstprivate, target_map_pointers_as_0len_arrays and target_firstprivatize_array_bases fields. (delete_omp_context): Release loop_iter_var. (gimplify_bind_expr): Handle ORT_NONE. (maybe_fold_stmt): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (is_gimple_stmt): Return true for OMP_TASKLOOP, OMP_TEAMS and OMP_TARGET{,_DATA,_UPDATE,_ENTER_DATA,_EXIT_DATA}. (omp_firstprivatize_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle ctx->target_map_scalars_firstprivate. (omp_add_variable): Handle ORT_NONE. Allow map clause together with data sharing clauses. For data sharing clause with VLA decl on omp target/target data don't add firstprivate for the pointer. Call omp_notice_variable on TYPE_SIZE_UNIT only if it is a DECL_P. (omp_notice_threadprivate_variable): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (omp_notice_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle implicit mapping of pointers as zero length array sections and ctx->target_map_scalars_firstprivate mapping of scalars as firstprivate data sharing. (omp_check_private): Handle omp_member_access_dummy_var vars. (find_decl_expr): New function. (gimplify_scan_omp_clauses): Add CODE argument. For OMP_CLAUSE_IF complain if OMP_CLAUSE_IF_MODIFIER is present and does not match code. Handle OMP_CLAUSE_GANG separately. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. Diagnose linear clause on combined distribute {, parallel for} simd construct, unless it is the loop iterator. Handle struct element GOMP_MAP_FIRSTPRIVATE_POINTER. Handle map clauses with COMPONENT_REF. Initialize ctx->target_map_scalars_firstprivate, ctx->target_firstprivatize_array_bases and ctx->target_map_pointers_as_0len_arrays. Add firstprivate for linear clause even to target region if combined. Remove map clauses with GOMP_MAP_FIRSTPRIVATE_POINTER kind from OMP_TARGET_{,ENTER_,EXIT_}DATA. For GOMP_MAP_FIRSTPRIVATE_POINTER map kind with non-INTEGER_CST OMP_CLAUSE_SIZE firstprivatize the bias. Handle OMP_CLAUSE_DEPEND_{SINK,SOURCE}. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. For linear clause on worksharing loop combined with parallel add shared clause on the parallel. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set DECL_NAME on omp_member_access_dummy_var vars. Add lastprivate clause to outer taskloop if needed. (gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_0LEN_ARRAY. If gimplify_omp_ctxp->target_firstprivatize_array_bases, use GOMP_MAP_FIRSTPRIVATE_POINTER map kind instead of GOMP_MAP_POINTER. (gimplify_adjust_omp_clauses): Add CODE argument. Handle removal of GOMP_MAP_FIRSTPRIVATE_POINTER struct elements for struct not seen in target body. Handle removal of struct mapping if struct is not seen in target body. Remove GOMP_MAP_STRUCT map clause on OMP_TARGET_EXIT_DATA. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Use GOMP_MAP_FIRSTPRIVATE_POINTER instead of GOMP_MAP_POINTER if ctx->target_firstprivatize_array_bases for VLAs. Set OMP_CLAUSE_MAP_PRIVATE if both data sharing and map clause appear together. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. Don't remove map clause if it has map-type-modifier always. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. (gimplify_oacc_cache, gimplify_omp_parallel, gimplify_omp_task): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. (gimplify_omp_for): Likewise. Handle OMP_TASKLOOP. Initialize loop_iter_var. Use OMP_FOR_ORIG_DECLS. Fix handling of lastprivate iterators in doacross loops. (gimplify_omp_workshare): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Use ORT_COMBINED_TARGET for OMP_TARGET_COMBINED. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (gimplify_omp_target_update): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Handle OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. (gimplify_omp_ordered): New function. (gimplify_expr): Handle OMP_TASKLOOP, OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. Use gimplify_omp_ordered for OMP_ORDERED. Gimplify clauses on OMP_CRITICAL. * internal-fn.c (expand_GOMP_SIMD_ORDERED_START, expand_GOMP_SIMD_ORDERED_END): New functions. * internal-fn.def (GOMP_SIMD_ORDERED_START, GOMP_SIMD_ORDERED_END): New internal functions. * omp-builtins.def (BUILT_IN_GOMP_LOOP_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_DOACROSS_POST, BUILT_IN_GOMP_DOACROSS_WAIT, BUILT_IN_GOMP_DOACROSS_ULL_POST, BUILT_IN_GOMP_DOACROSS_ULL_WAIT, BUILT_IN_GOMP_TARGET_ENTER_EXIT_DATA, BUILT_IN_GOMP_TASKLOOP, BUILT_IN_GOMP_TASKLOOP_ULL): New built-ins. (BUILT_IN_GOMP_TASK): Add INT argument to the end. (BUILT_IN_GOMP_TARGET): Rename from GOMP_target to GOMP_target_41, adjust type. (BUILT_IN_GOMP_TARGET_DATA): Rename from GOMP_target_data to GOMP_target_data_41, adjust type. (BUILT_IN_GOMP_TARGET_UPDATE): Rename from GOMP_target_update to GOMP_target_update_41, adjust type. * omp-low.c (struct omp_region): Adjust comments, add ord_stmt field. (struct omp_for_data): Add ordered and simd_schedule fields. (omp_member_access_dummy_var, unshare_and_remap_1, unshare_and_remap, is_taskloop_ctx): New functions. (is_taskreg_ctx): Use is_parallel_ctx and is_task_ctx. (extract_omp_for_data): Handle taskloops and doacross loops and simd schedule modifier. (omp_adjust_chunk_size): New function. (get_ws_args_for): Use it. (lookup_sfield): Change first argument to splay_tree_key, add overload with first argument tree. (maybe_lookup_field): Likewise. (use_pointer_for_field): Handle omp_member_access_dummy_var. (omp_copy_decl_2): If var is TREE_ADDRESSABLE listed in task_shared_vars, clear TREE_ADDRESSABLE on the copy. (build_outer_var_ref): Add LASTPRIVATE argument, handle taskloops and omp_member_access_dummy_var vars. (build_sender_ref): Change first argument to splay_tree_key, add overload with first argument tree. (install_var_field): For mask & 8 use &DECL_UID as key instead of the tree itself. (fixup_child_record_type): Const qualify *.omp_data_i. (scan_sharing_clauses): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE, C/C++ array reductions, OMP_CLAUSE_{IS,USE}_DEVICE_PTR clauses, OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,SIMDLEN,THREADS,SIMD} and OMP_CLAUSE_{NOGROUP,DEFAULTMAP} clauses, OMP_CLAUSE__LOOPTEMP_ clause on taskloop, GOMP_MAP_FIRSTPRIVATE_POINTER, OMP_CLAUSE_MAP_PRIVATE. (create_omp_child_function): Set TREE_READONLY on .omp_data_i. (find_combined_for): Allow searching for different GIMPLE_OMP_FOR kinds. (add_taskreg_looptemp_clauses): New function. (scan_omp_parallel): Use it. (scan_omp_task): Likewise. (finish_taskreg_scan): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. For taskloop, move fields for the first two _LOOPTEMP_ clauses first. (check_omp_nesting_restrictions): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Formatting fixes. Allow the sandwiched taskloop constructs. Type check OMP_CLAUSE_DEPEND_{KIND,SOURCE}. Allow ordered simd inside of simd region. Diagnose depend(source) or depend(sink:...) on target constructs or task/taskloop. (handle_simd_reference): Use get_name. (lower_rec_input_clauses): Likewise. Ignore all OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses on taskloop construct. Allow _LOOPTEMP_ clause on GOMP_TASK. Unshare new_var before passing it to omp_clause_{default,copy}_ctor. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set lastprivate_firstprivate flag for linear that needs copyin and copyout. Use BUILT_IN_ALLOCA_WITH_ALIGN instead of BUILT_IN_ALLOCA. (lower_lastprivate_clauses): For OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE on taskloop lookup decl in outer context. Pass true to build_outer_var_ref lastprivate argument. Handle OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV lastprivate if the decl is global outside of outer taskloop for. (lower_reduction_clauses): Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. (lower_send_clauses): Ignore first two _LOOPTEMP_ clauses in taskloop GOMP_TASK. Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. Handle omp_member_access_dummy_var vars. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Use new lookup_sfield overload. (lower_send_shared_vars): Ignore fields with NULL or FIELD_DECL abstract origin. Handle omp_member_access_dummy_var vars. (expand_parallel_call): Use expand_omp_build_assign. (expand_task_call): Handle taskloop construct expansion. Add REGION argument. Use GOMP_TASK_* defines instead of hardcoded integers. Add priority argument to GOMP_task* calls. Or in GOMP_TASK_FLAG_PRIORITY into flags if priority is present for GOMP_task call. (expand_omp_build_assign): Add prototype. Add AFTER argument, if true emit statements after *GSI_P and continue linking. (expand_omp_taskreg): Adjust expand_task_call caller. (expand_omp_for_init_counts): Rename zero_iter_bb argument to zero_iter1_bb and first_zero_iter to first_zero_iter1, add zero_iter2_bb and first_zero_iter2 arguments, handle computation of counts even for ordered loops. (expand_omp_for_init_vars): Handle GOMP_TASK inner_stmt. (expand_omp_ordered_source, expand_omp_ordered_sink, expand_omp_ordered_source_sink, expand_omp_for_ordered_loops): New functions. (expand_omp_for_generic): Use omp_adjust_chunk_size. Handle linear clauses on worksharing loop. Handle DOACROSS loop expansion. (expand_omp_for_static_nochunk): Handle linear clauses on worksharing loop. Adjust expand_omp_for_init_counts callers. (expand_omp_for_static_chunk): Likewise. Use omp_adjust_chunk_size. (expand_omp_simd): Handle addressable fd->loop.v. Adjust expand_omp_for_init_counts callers. (expand_omp_taskloop_for_outer, expand_omp_taskloop_for_inner): New functions. (expand_omp_for): Call expand_omp_taskloop_for_* for taskloop. Handle doacross loops. (expand_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Pass flags and depend arguments to GOMP_target_{41,update_41,enter_exit_data} libcalls. (expand_omp): Don't expand ordered depend constructs here, record ord_stmt instead for later expand_omp_for_generic. (build_omp_regions_1): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (lower_omp_ordered_clauses): New function. (lower_omp_ordered): Handle OMP_CLAUSE_SIMD, for OMP_CLAUSE_DEPEND don't lower anything. (lower_omp_for_lastprivate): Use last _looptemp_ clause on taskloop for comparison. (lower_omp_for): Handle taskloop constructs. Adjust OMP_CLAUSE_DECL and OMP_CLAUSE_LINEAR_STEP so that expand_omp_for_* can use it during expansion for linear adjustments. (create_task_copyfn): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. (lower_depend_clauses): Assert not seeing sink/source depend kinds. Set TREE_ADDRESSABLE on array. Change first argument from gimple * to tree * pointing to the stmt's clauses. (lower_omp_taskreg): Adjust lower_depend_clauses caller. (lower_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, depend clauses, GOMP_MAP_{RELEASE,ALWAYS_{TO,FROM,TOFROM},FIRSTPRIVATE_POINTER,STRUCT} map kinds, OMP_CLAUSE_{FIRSTPRIVATE,PRIVATE,{IS,USE}_DEVICE_PTR clauses. Always use short kind and 8-bit align shift. (lower_omp_regimplify_p): Use IS_TYPE_OR_DECL_P macro. (struct lower_omp_regimplify_operands_data): New type. (lower_omp_regimplify_operands_p, lower_omp_regimplify_operands): New functions. (lower_omp_1): Use lower_omp_regimplify_operands instead of gimple_regimplify_operands. (make_gimple_omp_edges): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (simd_clone_clauses_extract): Honor OMP_CLAUSE_LINEAR_KIND. (simd_clone_mangle): Mangle the various linear kinds per the new ABI. (simd_clone_adjust_argument_types): Handle SIMD_CLONE_ARG_TYPE_LINEAR_*_CONSTANT_STEP. (simd_clone_init_simd_arrays): Don't do anything for uval. (simd_clone_adjust): Handle SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP. Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP. * omp-low.h (omp_member_access_dummy_var): New prototype. * passes.def (pass_simduid_cleanup): Schedule another copy of the pass after all optimizations. * tree.c (omp_clause_code_name): Add entries for OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (omp_clause_num_ops): Likewise. Bump number of OMP_CLAUSE_REDUCTION arguments to 5 and for OMP_CLAUSE_ORDERED to 1. (walk_tree_1): Adjust for OMP_CLAUSE_ORDERED having 1 argument and OMP_CLAUSE_REDUCTION 5 arguments. Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD} clauses. * tree-core.h (enum omp_clause_linear_kind): New. (struct tree_omp_clause): Change type of map_kind from unsigned char to unsigned int. Add subcode.if_modifier and subcode.linear_kind fields. (enum omp_clause_code): Add OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (OMP_CLAUSE_REDUCTION): Document OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_{SOURCE,SINK}. * tree.def (OMP_FOR): Add OMP_FOR_ORIG_DECLS operand. (OMP_CRITICAL): Move before OMP_SINGLE. Add OMP_CRITICAL_CLAUSES operand. (OMP_ORDERED): Move before OMP_SINGLE. Add OMP_ORDERED_CLAUSES operand. (OMP_TASKLOOP, OMP_TARGET_ENTER_DATA, OMP_TARGET_EXIT_DATA): New tree codes. * tree.h (OMP_BODY): Replace OMP_CRITICAL with OMP_TASKGROUP. (OMP_CLAUSE_SET_MAP_KIND): Cast to unsigned int rather than unsigned char. (OMP_CRITICAL_NAME): Adjust to be 3rd operand instead of 2nd. (OMP_CLAUSE_NUM_TASKS_EXPR): Formatting fix. (OMP_STANDALONE_CLAUSES): Adjust to cover OMP_TARGET_{ENTER,EXIT}_DATA. (OMP_CLAUSE_DEPEND_SINK_NEGATIVE, OMP_TARGET_COMBINED, OMP_CLAUSE_MAP_PRIVATE, OMP_FOR_ORIG_DECLS, OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION, OMP_CRITICAL_CLAUSES, OMP_CLAUSE_PRIVATE_TASKLOOP_IV, OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, OMP_CLAUSE_HINT_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER, OMP_CLAUSE_SHARED_FIRSTPRIVATE, OMP_ORDERED_CLAUSES, OMP_TARGET_ENTER_DATA_CLAUSES, OMP_TARGET_EXIT_DATA_CLAUSES, OMP_CLAUSE_NUM_TASKS_EXPR, OMP_CLAUSE_GRAINSIZE_EXPR, OMP_CLAUSE_PRIORITY_EXPR, OMP_CLAUSE_ORDERED_EXPR): Define. * tree-inline.c (remap_gimple_stmt): Handle clauses on GIMPLE_OMP_ORDERED and GIMPLE_OMP_CRITICAL. For IFN_GOMP_SIMD_ORDERED_{START,END} set has_simduid_loops. * tree-nested.c (convert_nonlocal_omp_clauses): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (convert_local_omp_clauses): Likewise. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_ORDERED_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_DEPEND_{SOURCE,SINK}. Use "delete" for GOMP_MAP_FORCE_DEALLOC. Handle GOMP_MAP_{ALWAYS_{TO,FROM,TOFROM},RELEASE,FIRSTPRIVATE_POINTER,STRUCT}. (dump_generic_node): Handle OMP_TASKLOOP, OMP_TARGET_{ENTER,EXIT}_DATA and clauses on OMP_ORDERED and OMP_CRITICAL. * tree-vectorizer.c (adjust_simduid_builtins): Adjust comment. Remove IFN_GOMP_SIMD_ORDERED_{START,END}. (vectorize_loops): Adjust comments. (pass_simduid_cleanup::execute): Likewise. * tree-vect-stmts.c (vectorizable_simd_clone_call): Handle SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_CONSTANT_STEP. * wide-int.h (wi::gcd): New. gcc/c-family/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-common.c (enum c_builtin_type): Define DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10 and DEF_FUNCTION_TYPE_11. (c_define_builtins): Likewise. * c-common.h (enum c_omp_clause_split): Add C_OMP_CLAUSE_SPLIT_TASKLOOP. (c_finish_omp_critical, c_finish_omp_ordered): Add CLAUSES argument. (c_finish_omp_for): Add ORIG_DECLV argument. * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP as 201511 instead of 201307. * c-omp.c (c_finish_omp_critical): Add CLAUSES argument, set OMP_CRITICAL_CLAUSES to it. (c_finish_omp_ordered): Add CLAUSES argument, set OMP_ORDERED_CLAUSES to it. (c_finish_omp_for): Add ORIG_DECLV argument, set OMP_FOR_ORIG_DECLS to it if OMP_FOR. Clear DECL_INITIAL on the IVs. (c_omp_split_clauses): Handle OpenMP 4.5 combined/composite constructs and new OpenMP 4.5 clauses. Clear OMP_CLAUSE_SCHEDULE_SIMD if not combined with OMP_SIMD. Add verification code. * c-pragma.c (omp_pragmas_simd): Add taskloop. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKLOOP. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_{DEFAULTMAP,GRAINSIZE,HINT,{IS,USE}_DEVICE_PTR} and PRAGMA_OMP_CLAUSE_{LINK,NOGROUP,NUM_TASKS,PRIORITY,SIMD,THREADS}. gcc/c/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-parser.c (c_parser_pragma): Handle PRAGMA_OMP_ORDERED here. (c_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (c_parser_omp_variable_list): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Formatting fixes. (c_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize, c_parser_omp_clause_priority, c_parser_omp_clause_hint, c_parser_omp_clause_defaultmap, c_parser_omp_clause_use_device_ptr, c_parser_omp_clause_is_device_ptr): New functions. (c_parser_omp_clause_ordered): Parse optional parameter. (c_parser_omp_clause_reduction): Handle array reductions. (c_parser_omp_clause_schedule): Parse optional simd modifier. (c_parser_omp_clause_nogroup, c_parser_omp_clause_orderedkind): New functions. (c_parser_omp_clause_linear): Parse linear clause modifiers. (c_parser_omp_clause_depend_sink): New function. (c_parser_omp_clause_depend): Parse source/sink depend kinds. (c_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (c_parser_oacc_all_clauses): Adjust c_parser_omp_clause_if and c_finish_omp_clauses callers. (c_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (c_parser_oacc_cache): Adjust c_finish_omp_clauses caller. (OMP_CRITICAL_CLAUSE_MASK): Define. (c_parser_omp_critical): Parse critical clauses. (c_parser_omp_for_loop): Handle doacross loops, adjust c_finish_omp_for and c_finish_omp_clauses callers. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (c_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (c_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (c_parser_omp_ordered): Add CONTEXT argument, remove LOC argument, parse clauses and if depend clause is found, don't parse a body. (c_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (c_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (c_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (c_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (c_parser_omp_declare_reduction): Use STRIP_NOPS when checking for &omp_priv. (OMP_TASKLOOP_CLAUSE_MASK): Define. (c_parser_omp_taskloop): New function. (c_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (c_parser_cilk_for): Adjust c_finish_omp_clauses callers. * c-tree.h (c_finish_omp_clauses): Add two new arguments. * c-typeck.c (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (c_finish_omp_clauses): Add IS_OMP and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones. gcc/cp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * class.c (finish_struct_1): Call finish_omp_declare_simd_methods. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_TASKLOOP. (cp_genericize_r): Likewise. (cxx_omp_finish_clause): Don't diagnose references. (cxx_omp_disregard_value_expr): New function. * cp-objcp-common.h (LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR): Redefine. * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Document for OMP_TASKLOOP. (DECL_OMP_PRIVATIZED_MEMBER): Define. (finish_omp_declare_simd_methods, push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses, omp_privatize_field, cxx_omp_disregard_value_expr): New prototypes. (finish_omp_clauses): Add two new arguments. (finish_omp_for): Add ORIG_DECLV argument. * parser.c (cp_parser_lambda_body): Call save_omp_privatization_clauses and restore_omp_privatization_clauses. (cp_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (cp_parser_omp_var_list_no_open): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Parse this keyword. Formatting fixes. (cp_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority, cp_parser_omp_clause_hint, cp_parser_omp_clause_defaultmap): New functions. (cp_parser_omp_clause_ordered): Parse optional parameter. (cp_parser_omp_clause_reduction): Handle array reductions. (cp_parser_omp_clause_schedule): Parse optional simd modifier. (cp_parser_omp_clause_nogroup, cp_parser_omp_clause_orderedkind): New functions. (cp_parser_omp_clause_linear): Parse linear clause modifiers. (cp_parser_omp_clause_depend_sink): New function. (cp_parser_omp_clause_depend): Parse source/sink depend kinds. (cp_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_if and finish_omp_clauses callers. (cp_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (OMP_CRITICAL_CLAUSE_MASK): Define. (cp_parser_omp_critical): Parse critical clauses. (cp_parser_omp_for_incr): Use cp_tree_equal if processing_template_decl. (cp_parser_omp_for_loop_init): Return tree instead of bool. Handle non-static data member iterators. (cp_parser_omp_for_loop): Handle doacross loops, adjust finish_omp_for and finish_omp_clauses callers. (cp_omp_split_clauses): Adjust finish_omp_clauses caller. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (cp_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (cp_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (cp_parser_omp_ordered): Add CONTEXT argument, return bool instead of tree, parse clauses and if depend clause is found, don't parse a body. (cp_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (cp_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (cp_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (cp_parser_oacc_cache): Adjust finish_omp_clauses caller. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (cp_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (OMP_TASKLOOP_CLAUSE_MASK): Define. (cp_parser_omp_taskloop): New function. (cp_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (cp_parser_pragma): Handle PRAGMA_OMP_ORDERED here directly, handle PRAGMA_OMP_TASKLOOP, call push_omp_privatization_clauses and pop_omp_privatization_clauses around parsing calls. (cp_parser_cilk_for): Adjust finish_omp_clauses caller. * pt.c (apply_late_template_attributes): Adjust tsubst_omp_clauses and finish_omp_clauses callers. (tsubst_omp_clause_decl): Return NULL if decl is NULL. For TREE_LIST, copy over OMP_CLAUSE_DEPEND_SINK_NEGATIVE bit. Use tsubst_expr instead of tsubst_copy, undo convert_from_reference effects. (tsubst_omp_clauses): Add ALLOW_FIELDS argument. Handle new OpenMP 4.5 clauses. Use tsubst_omp_clause_decl for more clauses. If ALLOW_FIELDS, handle non-static data members in the clauses. Clear OMP_CLAUSE_LINEAR_STEP if it has been cleared before. (omp_parallel_combined_clauses): New variable. (tsubst_omp_for_iterator): Add ORIG_DECLV argument, recur on OMP_FOR_ORIG_DECLS, handle non-static data member iterators. Improve handling of clauses on combined constructs. (tsubst_expr): Call push_omp_privatization_clauses and pop_omp_privatization_clauses around instantiation of certain OpenMP constructs, improve handling of clauses on combined constructs, handle OMP_TASKLOOP, adjust tsubst_omp_for_iterator, tsubst_omp_clauses and finish_omp_for callers, handle clauses on critical and ordered, handle OMP_TARGET_{ENTER,EXIT}_DATA. (instantiate_decl): Call save_omp_privatization_clauses and restore_omp_privatization_clauses around instantiation. (dependent_omp_for_p): Fix up comment typo. Handle SCOPE_REF. * semantics.c (omp_private_member_map, omp_private_member_vec, omp_private_member_ignore_next): New variables. (finish_non_static_data_member): Return dummy decl for privatized non-static data members. (omp_clause_decl_field, omp_clause_printable_decl, omp_note_field_privatization, omp_privatize_field): New functions. (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (finish_omp_reduction_clause): Handle array sections and arrays. Use omp_clause_printable_decl. (finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink): New functions. (finish_omp_clauses): Add ALLOW_FIELDS and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones, handle non-static data members, reject this keyword when not allowed. (push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses): New functions. (handle_omp_for_class_iterator): Handle OMP_TASKLOOP class iterators. Add collapse and ordered arguments. Fix handling of lastprivate iterators in doacross loops. (finish_omp_for): Add ORIG_DECLV argument, handle doacross loops, adjust c_finish_omp_for, handle_omp_for_class_iterator and finish_omp_clauses callers. Fill in OMP_CLAUSE_LINEAR_STEP on simd loops with non-static data member iterators. gcc/fortran/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * f95-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11, DEF_FUNCTION_TYPE_VAR_1): Define. * trans-openmp.c (gfc_trans_omp_clauses): Set OMP_CLAUSE_IF_MODIFIER to ERROR_MARK, OMP_CLAUSE_ORDERED_EXPR to NULL. (gfc_trans_omp_critical): Adjust for addition of clauses. (gfc_trans_omp_ordered): Likewise. * types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. gcc/lto/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * lto-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/jit/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/ada/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * gcc-interface/utils.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/testsuite/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-c++-common/gomp/cancel-1.c (f2): Add map clause to target data. * c-c++-common/gomp/clauses-1.c: New test. * c-c++-common/gomp/clauses-2.c: New test. * c-c++-common/gomp/clauses-3.c: New test. * c-c++-common/gomp/clauses-4.c: New test. * c-c++-common/gomp/declare-target-1.c: New test. * c-c++-common/gomp/declare-target-2.c: New test. * c-c++-common/gomp/depend-3.c: New test. * c-c++-common/gomp/depend-4.c: New test. * c-c++-common/gomp/doacross-1.c: New test. * c-c++-common/gomp/if-1.c: New test. * c-c++-common/gomp/if-2.c: New test. * c-c++-common/gomp/linear-1.c: New test. * c-c++-common/gomp/map-2.c: New test. * c-c++-common/gomp/map-3.c: New test. * c-c++-common/gomp/nesting-1.c (f_omp_parallel, f_omp_target_data): Add map clause to target data. * c-c++-common/gomp/nesting-warn-1.c (f_omp_target): Likewise. * c-c++-common/gomp/ordered-1.c: New test. * c-c++-common/gomp/ordered-2.c: New test. * c-c++-common/gomp/ordered-3.c: New test. * c-c++-common/gomp/pr61486-1.c (foo): Remove linear clause on non-iterator. * c-c++-common/gomp/pr61486-2.c (test, test2): Remove ordered clause and ordered construct where no longer allowed. * c-c++-common/gomp/priority-1.c: New test. * c-c++-common/gomp/reduction-1.c: New test. * c-c++-common/gomp/schedule-simd-1.c: New test. * c-c++-common/gomp/sink-1.c: New test. * c-c++-common/gomp/sink-2.c: New test. * c-c++-common/gomp/sink-3.c: New test. * c-c++-common/gomp/sink-4.c: New test. * c-c++-common/gomp/udr-1.c: New test. * c-c++-common/taskloop-1.c: New test. * c-c++-common/cpp/openmp-define-3.c: Adjust for the new value of _OPENMP macro. * c-c++-common/cilk-plus/PS/body.c (foo): Adjust expected diagnostics. * c-c++-common/goacc-gomp/nesting-fail-1.c (f_acc_parallel, f_acc_kernels, f_acc_data, f_acc_loop): Add map clause to target data. * gcc.dg/gomp/clause-1.c: * gcc.dg/gomp/reduction-1.c: New test. * gcc.dg/gomp/sink-fold-1.c: New test. * gcc.dg/gomp/sink-fold-2.c: New test. * gcc.dg/gomp/sink-fold-3.c: New test. * gcc.dg/vect/vect-simd-clone-15.c: New test. * g++.dg/gomp/clause-1.C (T::test): Remove dg-error on privatization of non-static data members. * g++.dg/gomp/clause-3.C (foo): Remove one dg-error directive. Add some linear clause tests. * g++.dg/gomp/declare-simd-3.C: New test. * g++.dg/gomp/linear-1.C: New test. * g++.dg/gomp/member-1.C: New test. * g++.dg/gomp/member-2.C: New test. * g++.dg/gomp/pr66571-2.C: New test. * g++.dg/gomp/pr67504.C (foo): Add test for ordered clause with dependent argument. * g++.dg/gomp/pr67522.C (foo): Add test for invalid array section in reduction clause. * g++.dg/gomp/reference-1.C: New test. * g++.dg/gomp/sink-1.C: New test. * g++.dg/gomp/sink-2.C: New test. * g++.dg/gomp/sink-3.C: New test. * g++.dg/gomp/task-1.C: Remove both dg-error directives. * g++.dg/gomp/this-1.C: New test. * g++.dg/gomp/this-2.C: New test. * g++.dg/vect/simd-clone-2.cc: New test. * g++.dg/vect/simd-clone-2.h: New test. * g++.dg/vect/simd-clone-3.cc: New test. * g++.dg/vect/simd-clone-4.cc: New test. * g++.dg/vect/simd-clone-4.h: New test. * g++.dg/vect/simd-clone-5.cc: New test. include/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define. (enum gomp_map_kind): Add GOMP_MAP_FIRSTPRIVATE, GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_DELETE, GOMP_MAP_RELEASE, GOMP_MAP_FIRSTPRIVATE_POINTER. (GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Define. (GOMP_TASK_FLAG_UNTIED, GOMP_TASK_FLAG_FINAL, GOMP_TASK_FLAG_MERGEABLE, GOMP_TASK_FLAG_DEPEND, GOMP_TASK_FLAG_PRIORITY, GOMP_TASK_FLAG_UP, GOMP_TASK_FLAG_GRAINSIZE, GOMP_TASK_FLAG_IF, GOMP_TASK_FLAG_NOGROUP, GOMP_TARGET_FLAG_NOWAIT, GOMP_TARGET_FLAG_EXIT_DATA, GOMP_TARGET_FLAG_UPDATE): Define. libgomp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * config/linux/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/linux/doacross.h: New file. * config/posix/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/posix/doacross.h: New file. * env.c: Include gomp-constants.h. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (gomp_max_task_priority_var): New variable. (parse_schedule): Rename run_sched_modifier to run_sched_chunk_size. (handle_omp_display_env): Change _OPENMP value from 201307 to 201511. Print OMP_MAX_TASK_PRIORITY. (initialize_env): Parse OMP_MAX_TASK_PRIORITY. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size and run_sched_modifier to run_sched_chunk_size. (omp_get_max_task_priority, omp_get_initial_device, omp_get_num_places, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums): New functions. * fortran.c (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_): Rename modifier argument to chunk_size. (omp_get_num_places_, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num_, omp_get_partition_num_places_, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device_, omp_get_max_task_priority_): New functions. * libgomp_g.h (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_doacross_ull_post, GOMP_doacross_wait, GOMP_taskloop, GOMP_taskloop_ull, GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data): New prototypes. (GOMP_task): Add prototype argument. * libgomp.h (_LIBGOMP_CHECKING_): Define to 0 if not yet defined. (struct gomp_doacross_work_share): New type. (struct gomp_work_share): Add doacross field. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (enum gomp_task_kind): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. Add comments. (struct gomp_task_depend_entry): Add comments. (struct gomp_task): Likewise. (struct gomp_taskgroup): Likewise. (struct gomp_target_task): New type. (struct gomp_team): Add comment. (gomp_get_place_proc_ids_8, gomp_doacross_init, gomp_doacross_ull_init, gomp_task_maybe_wait_for_dependencies, gomp_create_target_task, gomp_target_task_fn): New prototypes. (struct target_var_desc): New type. (struct target_mem_desc): Adjust comment. Use struct target_var_desc instead of splay_tree_key for list. (REFCOUNT_INFINITY): Define. (struct splay_tree_key_s): Remove copy_from field. (struct gomp_device_descr): Add dev2dev_func field. (enum gomp_map_vars_kind): New enum. (gomp_map_vars): Add one argument. * libgomp.map (OMP_4.5): Export omp_get_max_task_priority, omp_get_max_task_priority_, omp_get_num_places, omp_get_num_places_, omp_get_place_num_procs, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num, omp_get_place_num_, omp_get_partition_num_places, omp_get_partition_num_places_, omp_get_partition_place_nums, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device, omp_get_initial_device_, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr and omp_target_disassociate_ptr. (GOMP_4.0.2): Renamed to ... (GOMP_4.5): ... this. Export GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data, GOMP_taskloop, GOMP_taskloop_ull, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_doacross_static_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_doacross_ull_post and GOMP_doacross_ull_wait. * libgomp.texi: Document omp_get_max_task_priority. Rename modifier argument to chunk_size for omp_set_schedule and omp_get_schedule. Document OMP_MAX_TASK_PRIORITY env var. * loop.c (GOMP_loop_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ordered_runtime_start): Likewise. (gomp_loop_doacross_static_start, gomp_loop_doacross_dynamic_start, gomp_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_parallel_loop_runtime_start): New functions. (GOMP_parallel_loop_runtime): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start): New functions or aliases. * loop_ull.c (GOMP_loop_ull_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ull_ordered_runtime_start): Likewise. (gomp_loop_ull_doacross_static_start, gomp_loop_ull_doacross_dynamic_start, gomp_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start): New functions. (GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start): New functions or aliases. * oacc-mem.c (acc_map_data, present_create_copy, gomp_acc_insert_pointer): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (gomp_acc_remove_pointer): Use copy_from from target_var_desc. * oacc-parallel.c (GOACC_data_start): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (GOACC_parallel_keyed): Likewise. Use copy_from from target_var_desc. * omp.h.in (omp_lock_hint_t): New type. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr): New prototypes. * omp_lib.f90.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New interfaces. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size. * omp_lib.h.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New functions and subroutines. * ordered.c: Include stdarg.h and string.h. (MAX_COLLAPSED_BITS): Define. (gomp_doacross_init, GOMP_doacross_post, GOMP_doacross_wait, gomp_doacross_ull_init, GOMP_doacross_ull_post, GOMP_doacross_ull_wait): New functions. * target.c: Include errno.h. (resolve_device): If device is not initialized, call gomp_init_device on it. (gomp_map_lookup): New function. (gomp_map_vars_existing): Add tgt_var argument, fill it in. Don't bump refcount if REFCOUNT_INFINITY. Handle GOMP_MAP_ALWAYS_TO_P. (get_kind): Rename is_openacc argument to short_mapkind. (gomp_map_pointer): Use gomp_map_lookup. (gomp_map_fields_existing): New function. (gomp_map_vars): Rename is_openacc argument to short_mapkind and is_target to pragma_kind. Handle GOMP_MAP_VARS_ENTER_DATA, handle GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_STRUCT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION. Adjust for tgt->list changed type and copy_from living in there. (gomp_copy_from_async): Adjust for tgt->list changed type and copy_from living in there. (gomp_unmap_vars): Likewise. (gomp_update): Likewise. Rename is_openacc argument to short_mapkind. Don't fail if object is not mapped. (gomp_load_image_to_device): Initialize refcount to REFCOUNT_INFINITY. (gomp_target_fallback): New function. (gomp_get_target_fn_addr): Likewise. (GOMP_target): Adjust gomp_map_vars caller, use gomp_get_target_fn_addr and gomp_target_fallback. (GOMP_target_41): New function. (gomp_target_data_fallback): New function. (GOMP_target_data): Use it, adjust gomp_map_vars caller. (GOMP_target_data_41): New function. (GOMP_target_update): Adjust gomp_update caller. (GOMP_target_update_41): New function. (gomp_exit_data, GOMP_target_enter_exit_data, gomp_target_task_fn, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect_worker, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr, gomp_load_plugin_for_device): New functions. * task.c: Include gomp-constants.h. Include taskloop.c twice to get GOMP_taskloop and GOMP_taskloop_ull definitions. (gomp_task_handle_depend): New function. (GOMP_task): Use it. Add priority argument. Use gomp-constant.h constants instead of hardcoded numbers. Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (gomp_create_target_task): New function. (verify_children_queue, verify_taskgroup_queue, verify_task_queue): New functions. (gomp_task_run_pre): Call verify_*_queue functions. If an upcoming tied task is about to leave the sibling or taskgroup queues in an invalid state, adjust appropriately. Remove taskgroup argument. Add comments. (gomp_task_run_post_handle_dependers): Add comments. (gomp_task_run_post_remove_parent): Likewise. (gomp_barrier_handle_tasks): Adjust gomp_task_run_pre caller. (GOMP_taskwait): Likewise. Add comments. (gomp_task_maybe_wait_for_dependencies): Fix scheduling problem such that the first non parent_depends_on task does not end up at the end of the children queue. (GOMP_taskgroup_start): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (GOMP_taskgroup_end): Adjust gomp_task_run_pre caller. * taskloop.c: New file. * testsuite/lib/libgomp.exp (check_effective_target_offload_device_nonshared_as): New proc. * testsuite/libgomp.c/affinity-2.c: New test. * testsuite/libgomp.c/doacross-1.c: New test. * testsuite/libgomp.c/doacross-2.c: New test. * testsuite/libgomp.c/examples-4/declare_target-1.c (fib_wrapper): Add map clause to target. * testsuite/libgomp.c/examples-4/declare_target-4.c (accum): Likewise. * testsuite/libgomp.c/examples-4/declare_target-5.c (accum): Likewise. * testsuite/libgomp.c/examples-4/device-1.c (main): Likewise. * testsuite/libgomp.c/examples-4/device-3.c (main): Likewise. * testsuite/libgomp.c/examples-4/target_data-3.c (gramSchmidt): Likewise. * testsuite/libgomp.c/examples-4/teams-2.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-3.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-4.c (dotprod): Likewise. * testsuite/libgomp.c/for-2.h (OMPTGT, OMPTO, OMPFROM): Define if not defined. Use those where needed. * testsuite/libgomp.c/for-4.c: New test. * testsuite/libgomp.c/for-5.c: New test. * testsuite/libgomp.c/for-6.c: New test. * testsuite/libgomp.c/linear-1.c: New test. * testsuite/libgomp.c/ordered-4.c: New test. * testsuite/libgomp.c/pr66199-2.c (f2): Adjust for linear clause only allowed on the loop iterator. * testsuite/libgomp.c/pr66199-3.c: New test. * testsuite/libgomp.c/pr66199-4.c: New test. * testsuite/libgomp.c/reduction-7.c: New test. * testsuite/libgomp.c/reduction-8.c: New test. * testsuite/libgomp.c/reduction-9.c: New test. * testsuite/libgomp.c/reduction-10.c: New test. * testsuite/libgomp.c/target-1.c (fn2, fn3, fn4): Add map(tofrom:s). * testsuite/libgomp.c/target-2.c (fn2, fn3, fn4): Likewise. * testsuite/libgomp.c/target-7.c (foo): Add map(h) where needed. * testsuite/libgomp.c/target-11.c: New test. * testsuite/libgomp.c/target-12.c: New test. * testsuite/libgomp.c/target-13.c: New test. * testsuite/libgomp.c/target-14.c: New test. * testsuite/libgomp.c/target-15.c: New test. * testsuite/libgomp.c/target-16.c: New test. * testsuite/libgomp.c/target-17.c: New test. * testsuite/libgomp.c/target-18.c: New test. * testsuite/libgomp.c/target-19.c: New test. * testsuite/libgomp.c/target-20.c: New test. * testsuite/libgomp.c/target-21.c: New test. * testsuite/libgomp.c/target-22.c: New test. * testsuite/libgomp.c/target-23.c: New test. * testsuite/libgomp.c/target-24.c: New test. * testsuite/libgomp.c/target-25.c: New test. * testsuite/libgomp.c/target-26.c: New test. * testsuite/libgomp.c/target-27.c: New test. * testsuite/libgomp.c/taskloop-1.c: New test. * testsuite/libgomp.c/taskloop-2.c: New test. * testsuite/libgomp.c/taskloop-3.c: New test. * testsuite/libgomp.c/taskloop-4.c: New test. * testsuite/libgomp.c++/ctor-13.C: New test. * testsuite/libgomp.c++/doacross-1.C: New test. * testsuite/libgomp.c++/examples-4/declare_target-2.C: Replace offload_device with offload_device_nonshared_as. * testsuite/libgomp.c++/for-12.C: New test. * testsuite/libgomp.c++/for-13.C: New test. * testsuite/libgomp.c++/for-14.C: New test. * testsuite/libgomp.c++/linear-1.C: New test. * testsuite/libgomp.c++/member-1.C: New test. * testsuite/libgomp.c++/member-2.C: New test. * testsuite/libgomp.c++/member-3.C: New test. * testsuite/libgomp.c++/member-4.C: New test. * testsuite/libgomp.c++/member-5.C: New test. * testsuite/libgomp.c++/ordered-1.C: New test. * testsuite/libgomp.c++/reduction-5.C: New test. * testsuite/libgomp.c++/reduction-6.C: New test. * testsuite/libgomp.c++/reduction-7.C: New test. * testsuite/libgomp.c++/reduction-8.C: New test. * testsuite/libgomp.c++/reduction-9.C: New test. * testsuite/libgomp.c++/reduction-10.C: New test. * testsuite/libgomp.c++/reference-1.C: New test. * testsuite/libgomp.c++/simd14.C: New test. * testsuite/libgomp.c++/target-2.C (fn2): Add map(tofrom: s) clause. * testsuite/libgomp.c++/target-5.C: New test. * testsuite/libgomp.c++/target-6.C: New test. * testsuite/libgomp.c++/target-7.C: New test. * testsuite/libgomp.c++/target-8.C: New test. * testsuite/libgomp.c++/target-9.C: New test. * testsuite/libgomp.c++/target-10.C: New test. * testsuite/libgomp.c++/target-11.C: New test. * testsuite/libgomp.c++/target-12.C: New test. * testsuite/libgomp.c++/taskloop-1.C: New test. * testsuite/libgomp.c++/taskloop-2.C: New test. * testsuite/libgomp.c++/taskloop-3.C: New test. * testsuite/libgomp.c++/taskloop-4.C: New test. * testsuite/libgomp.c++/taskloop-5.C: New test. * testsuite/libgomp.c++/taskloop-6.C: New test. * testsuite/libgomp.c++/taskloop-7.C: New test. * testsuite/libgomp.c++/taskloop-8.C: New test. * testsuite/libgomp.c++/taskloop-9.C: New test. * testsuite/libgomp.fortran/affinity1.f90: New test. * testsuite/libgomp.fortran/affinity2.f90: New test. liboffloadmic/ 2015-10-13 Ilya Verbin <ilya.verbin@intel.com> * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New function. * plugin/offload_target_main.cpp (__offload_target_tgt2tgt): New static function, register it in liboffloadmic. From-SVN: r228777
2015-10-13 21:06:23 +02:00
extern void finish_omp_declare_simd_methods (tree);
c-common.h (enum c_omp_region_type): Define. gcc/c-family/ * c-common.h (enum c_omp_region_type): Define. gcc/c/ * c-parser.c (c_parser_oacc_all_clauses): Update call to c_finish_omp_clauses. (c_parser_omp_all_clauses): Likewise. (c_parser_oacc_cache): Likewise. (c_parser_oacc_loop): Likewise. (omp_split_clauses): Likewise. (c_parser_omp_declare_target): Likewise. (c_parser_cilk_all_clauses): Likewise. (c_parser_cilk_for): Likewise. * c-typeck.c (c_finish_omp_clauses): Replace bool arguments is_omp, declare_simd, and is_cilk with enum c_omp_region_type ort. gcc/cp/ * cp-tree.h (finish_omp_clauses): Update prototype. * parser.c (cp_parser_oacc_all_clauses): Update call to finish_omp_clauses. (cp_parser_omp_all_clauses): Likewise. (cp_parser_omp_for_loop): Likewise. (cp_omp_split_clauses): Likewise. (cp_parser_oacc_cache): Likewise. (cp_parser_oacc_loop): Likewise. (cp_parser_omp_declare_target): (cp_parser_cilk_simd_all_clauses): Likewise. (cp_parser_cilk_for): Likewise. * pt.c (tsubst_omp_clauses): Replace allow_fields and declare_simd arguments with enum c_omp_region_type ort. (tsubst_omp_clauses): Update calls to finish_omp_clauses. (tsubst_omp_attribute): Update calls to tsubst_omp_clauses. (tsubst_omp_for_iterator): Update calls to finish_omp_clauses. (tsubst_expr): Update calls to tsubst_omp_clauses. * semantics.c (finish_omp_clauses): Replace bool arguments allow_fields, declare_simd, and is_cilk with bitmask ort. (finish_omp_for): Update call to finish_omp_clauses. From-SVN: r235780
2016-05-02 20:49:15 +02:00
extern tree finish_omp_clauses (tree, enum c_omp_region_type);
builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, [...]): New. gcc/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. * cgraph.h (enum cgraph_simd_clone_arg_type): Add SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP, SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP. (struct cgraph_simd_clone_arg): Adjust comment. * coretypes.h (struct gomp_ordered): New forward decl. * gimple.c (gimple_build_omp_critical): Add CLAUSES argument, set critical clauses to it. (gimple_build_omp_ordered): Return gomp_ordered * instead of gimple *. Add CLAUSES argument, set ordered clauses to it. (gimple_copy): Unshare clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimple.def (GIMPLE_OMP_ORDERED): Change from GSS_OMP to GSS_OMP_SINGLE_LAYOUT, move it after GIMPLE_OMP_TEAMS. * gimple.h (enum gf_mask): Add GF_OMP_TASK_TASKLOOP. Add another bit to GF_OMP_FOR_KIND_MASK mask. Add GF_OMP_FOR_KIND_TASKLOOP, renumber GF_OMP_FOR_KIND_CILKFOR and GF_OMP_FOR_KIND_OACC_LOOP. Adjust GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED and GF_OMP_FOR_COMBINED_INTO. Add another bit to GF_OMP_TARGET_KIND_MASK mask. Add GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, renumber GF_OMP_TARGET_KIND_OACC_{PARALLEL,KERNELS,DATA,UPDATE,ENTER_EXIT_DATA}. (gomp_critical): Add clauses field. (gomp_ordered): New struct. (is_a_helper <gomp_ordered *>::test): New inline. (gimple_build_omp_critical): Add CLAUSES argument. (gimple_build_omp_ordered): Likewise. Return gomp_ordered * instead of gimple *. (gimple_omp_critical_clauses, gimple_omp_critical_clauses_ptr, gimple_omp_critical_set_clauses, gimple_omp_ordered_clauses, gimple_omp_ordered_clauses_ptr, gimple_omp_ordered_set_clauses, gimple_omp_task_taskloop_p, gimple_omp_task_set_taskloop_p): New inline functions. * gimple-pretty-print.c (dump_gimple_omp_for): Handle taskloop. (dump_gimple_omp_target): Handle enter data and exit data. (dump_gimple_omp_block): Don't handle GIMPLE_OMP_ORDERED here. (dump_gimple_omp_critical): Print clauses. (dump_gimple_omp_ordered): New function. (dump_gimple_omp_task): Handle taskloop. (pp_gimple_stmt_1): Use dump_gimple_omp_ordered for GIMPLE_OMP_ORDERED. * gimple-walk.c (walk_gimple_op): Walk clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_0LEN_ARRAY. (enum omp_region_type): Add ORT_COMBINED_TARGET and ORT_NONE. (struct gimplify_omp_ctx): Add loop_iter_var, target_map_scalars_firstprivate, target_map_pointers_as_0len_arrays and target_firstprivatize_array_bases fields. (delete_omp_context): Release loop_iter_var. (gimplify_bind_expr): Handle ORT_NONE. (maybe_fold_stmt): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (is_gimple_stmt): Return true for OMP_TASKLOOP, OMP_TEAMS and OMP_TARGET{,_DATA,_UPDATE,_ENTER_DATA,_EXIT_DATA}. (omp_firstprivatize_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle ctx->target_map_scalars_firstprivate. (omp_add_variable): Handle ORT_NONE. Allow map clause together with data sharing clauses. For data sharing clause with VLA decl on omp target/target data don't add firstprivate for the pointer. Call omp_notice_variable on TYPE_SIZE_UNIT only if it is a DECL_P. (omp_notice_threadprivate_variable): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (omp_notice_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle implicit mapping of pointers as zero length array sections and ctx->target_map_scalars_firstprivate mapping of scalars as firstprivate data sharing. (omp_check_private): Handle omp_member_access_dummy_var vars. (find_decl_expr): New function. (gimplify_scan_omp_clauses): Add CODE argument. For OMP_CLAUSE_IF complain if OMP_CLAUSE_IF_MODIFIER is present and does not match code. Handle OMP_CLAUSE_GANG separately. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. Diagnose linear clause on combined distribute {, parallel for} simd construct, unless it is the loop iterator. Handle struct element GOMP_MAP_FIRSTPRIVATE_POINTER. Handle map clauses with COMPONENT_REF. Initialize ctx->target_map_scalars_firstprivate, ctx->target_firstprivatize_array_bases and ctx->target_map_pointers_as_0len_arrays. Add firstprivate for linear clause even to target region if combined. Remove map clauses with GOMP_MAP_FIRSTPRIVATE_POINTER kind from OMP_TARGET_{,ENTER_,EXIT_}DATA. For GOMP_MAP_FIRSTPRIVATE_POINTER map kind with non-INTEGER_CST OMP_CLAUSE_SIZE firstprivatize the bias. Handle OMP_CLAUSE_DEPEND_{SINK,SOURCE}. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. For linear clause on worksharing loop combined with parallel add shared clause on the parallel. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set DECL_NAME on omp_member_access_dummy_var vars. Add lastprivate clause to outer taskloop if needed. (gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_0LEN_ARRAY. If gimplify_omp_ctxp->target_firstprivatize_array_bases, use GOMP_MAP_FIRSTPRIVATE_POINTER map kind instead of GOMP_MAP_POINTER. (gimplify_adjust_omp_clauses): Add CODE argument. Handle removal of GOMP_MAP_FIRSTPRIVATE_POINTER struct elements for struct not seen in target body. Handle removal of struct mapping if struct is not seen in target body. Remove GOMP_MAP_STRUCT map clause on OMP_TARGET_EXIT_DATA. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Use GOMP_MAP_FIRSTPRIVATE_POINTER instead of GOMP_MAP_POINTER if ctx->target_firstprivatize_array_bases for VLAs. Set OMP_CLAUSE_MAP_PRIVATE if both data sharing and map clause appear together. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. Don't remove map clause if it has map-type-modifier always. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. (gimplify_oacc_cache, gimplify_omp_parallel, gimplify_omp_task): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. (gimplify_omp_for): Likewise. Handle OMP_TASKLOOP. Initialize loop_iter_var. Use OMP_FOR_ORIG_DECLS. Fix handling of lastprivate iterators in doacross loops. (gimplify_omp_workshare): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Use ORT_COMBINED_TARGET for OMP_TARGET_COMBINED. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (gimplify_omp_target_update): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Handle OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. (gimplify_omp_ordered): New function. (gimplify_expr): Handle OMP_TASKLOOP, OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. Use gimplify_omp_ordered for OMP_ORDERED. Gimplify clauses on OMP_CRITICAL. * internal-fn.c (expand_GOMP_SIMD_ORDERED_START, expand_GOMP_SIMD_ORDERED_END): New functions. * internal-fn.def (GOMP_SIMD_ORDERED_START, GOMP_SIMD_ORDERED_END): New internal functions. * omp-builtins.def (BUILT_IN_GOMP_LOOP_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_DOACROSS_POST, BUILT_IN_GOMP_DOACROSS_WAIT, BUILT_IN_GOMP_DOACROSS_ULL_POST, BUILT_IN_GOMP_DOACROSS_ULL_WAIT, BUILT_IN_GOMP_TARGET_ENTER_EXIT_DATA, BUILT_IN_GOMP_TASKLOOP, BUILT_IN_GOMP_TASKLOOP_ULL): New built-ins. (BUILT_IN_GOMP_TASK): Add INT argument to the end. (BUILT_IN_GOMP_TARGET): Rename from GOMP_target to GOMP_target_41, adjust type. (BUILT_IN_GOMP_TARGET_DATA): Rename from GOMP_target_data to GOMP_target_data_41, adjust type. (BUILT_IN_GOMP_TARGET_UPDATE): Rename from GOMP_target_update to GOMP_target_update_41, adjust type. * omp-low.c (struct omp_region): Adjust comments, add ord_stmt field. (struct omp_for_data): Add ordered and simd_schedule fields. (omp_member_access_dummy_var, unshare_and_remap_1, unshare_and_remap, is_taskloop_ctx): New functions. (is_taskreg_ctx): Use is_parallel_ctx and is_task_ctx. (extract_omp_for_data): Handle taskloops and doacross loops and simd schedule modifier. (omp_adjust_chunk_size): New function. (get_ws_args_for): Use it. (lookup_sfield): Change first argument to splay_tree_key, add overload with first argument tree. (maybe_lookup_field): Likewise. (use_pointer_for_field): Handle omp_member_access_dummy_var. (omp_copy_decl_2): If var is TREE_ADDRESSABLE listed in task_shared_vars, clear TREE_ADDRESSABLE on the copy. (build_outer_var_ref): Add LASTPRIVATE argument, handle taskloops and omp_member_access_dummy_var vars. (build_sender_ref): Change first argument to splay_tree_key, add overload with first argument tree. (install_var_field): For mask & 8 use &DECL_UID as key instead of the tree itself. (fixup_child_record_type): Const qualify *.omp_data_i. (scan_sharing_clauses): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE, C/C++ array reductions, OMP_CLAUSE_{IS,USE}_DEVICE_PTR clauses, OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,SIMDLEN,THREADS,SIMD} and OMP_CLAUSE_{NOGROUP,DEFAULTMAP} clauses, OMP_CLAUSE__LOOPTEMP_ clause on taskloop, GOMP_MAP_FIRSTPRIVATE_POINTER, OMP_CLAUSE_MAP_PRIVATE. (create_omp_child_function): Set TREE_READONLY on .omp_data_i. (find_combined_for): Allow searching for different GIMPLE_OMP_FOR kinds. (add_taskreg_looptemp_clauses): New function. (scan_omp_parallel): Use it. (scan_omp_task): Likewise. (finish_taskreg_scan): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. For taskloop, move fields for the first two _LOOPTEMP_ clauses first. (check_omp_nesting_restrictions): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Formatting fixes. Allow the sandwiched taskloop constructs. Type check OMP_CLAUSE_DEPEND_{KIND,SOURCE}. Allow ordered simd inside of simd region. Diagnose depend(source) or depend(sink:...) on target constructs or task/taskloop. (handle_simd_reference): Use get_name. (lower_rec_input_clauses): Likewise. Ignore all OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses on taskloop construct. Allow _LOOPTEMP_ clause on GOMP_TASK. Unshare new_var before passing it to omp_clause_{default,copy}_ctor. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set lastprivate_firstprivate flag for linear that needs copyin and copyout. Use BUILT_IN_ALLOCA_WITH_ALIGN instead of BUILT_IN_ALLOCA. (lower_lastprivate_clauses): For OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE on taskloop lookup decl in outer context. Pass true to build_outer_var_ref lastprivate argument. Handle OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV lastprivate if the decl is global outside of outer taskloop for. (lower_reduction_clauses): Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. (lower_send_clauses): Ignore first two _LOOPTEMP_ clauses in taskloop GOMP_TASK. Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. Handle omp_member_access_dummy_var vars. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Use new lookup_sfield overload. (lower_send_shared_vars): Ignore fields with NULL or FIELD_DECL abstract origin. Handle omp_member_access_dummy_var vars. (expand_parallel_call): Use expand_omp_build_assign. (expand_task_call): Handle taskloop construct expansion. Add REGION argument. Use GOMP_TASK_* defines instead of hardcoded integers. Add priority argument to GOMP_task* calls. Or in GOMP_TASK_FLAG_PRIORITY into flags if priority is present for GOMP_task call. (expand_omp_build_assign): Add prototype. Add AFTER argument, if true emit statements after *GSI_P and continue linking. (expand_omp_taskreg): Adjust expand_task_call caller. (expand_omp_for_init_counts): Rename zero_iter_bb argument to zero_iter1_bb and first_zero_iter to first_zero_iter1, add zero_iter2_bb and first_zero_iter2 arguments, handle computation of counts even for ordered loops. (expand_omp_for_init_vars): Handle GOMP_TASK inner_stmt. (expand_omp_ordered_source, expand_omp_ordered_sink, expand_omp_ordered_source_sink, expand_omp_for_ordered_loops): New functions. (expand_omp_for_generic): Use omp_adjust_chunk_size. Handle linear clauses on worksharing loop. Handle DOACROSS loop expansion. (expand_omp_for_static_nochunk): Handle linear clauses on worksharing loop. Adjust expand_omp_for_init_counts callers. (expand_omp_for_static_chunk): Likewise. Use omp_adjust_chunk_size. (expand_omp_simd): Handle addressable fd->loop.v. Adjust expand_omp_for_init_counts callers. (expand_omp_taskloop_for_outer, expand_omp_taskloop_for_inner): New functions. (expand_omp_for): Call expand_omp_taskloop_for_* for taskloop. Handle doacross loops. (expand_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Pass flags and depend arguments to GOMP_target_{41,update_41,enter_exit_data} libcalls. (expand_omp): Don't expand ordered depend constructs here, record ord_stmt instead for later expand_omp_for_generic. (build_omp_regions_1): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (lower_omp_ordered_clauses): New function. (lower_omp_ordered): Handle OMP_CLAUSE_SIMD, for OMP_CLAUSE_DEPEND don't lower anything. (lower_omp_for_lastprivate): Use last _looptemp_ clause on taskloop for comparison. (lower_omp_for): Handle taskloop constructs. Adjust OMP_CLAUSE_DECL and OMP_CLAUSE_LINEAR_STEP so that expand_omp_for_* can use it during expansion for linear adjustments. (create_task_copyfn): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. (lower_depend_clauses): Assert not seeing sink/source depend kinds. Set TREE_ADDRESSABLE on array. Change first argument from gimple * to tree * pointing to the stmt's clauses. (lower_omp_taskreg): Adjust lower_depend_clauses caller. (lower_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, depend clauses, GOMP_MAP_{RELEASE,ALWAYS_{TO,FROM,TOFROM},FIRSTPRIVATE_POINTER,STRUCT} map kinds, OMP_CLAUSE_{FIRSTPRIVATE,PRIVATE,{IS,USE}_DEVICE_PTR clauses. Always use short kind and 8-bit align shift. (lower_omp_regimplify_p): Use IS_TYPE_OR_DECL_P macro. (struct lower_omp_regimplify_operands_data): New type. (lower_omp_regimplify_operands_p, lower_omp_regimplify_operands): New functions. (lower_omp_1): Use lower_omp_regimplify_operands instead of gimple_regimplify_operands. (make_gimple_omp_edges): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (simd_clone_clauses_extract): Honor OMP_CLAUSE_LINEAR_KIND. (simd_clone_mangle): Mangle the various linear kinds per the new ABI. (simd_clone_adjust_argument_types): Handle SIMD_CLONE_ARG_TYPE_LINEAR_*_CONSTANT_STEP. (simd_clone_init_simd_arrays): Don't do anything for uval. (simd_clone_adjust): Handle SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP. Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP. * omp-low.h (omp_member_access_dummy_var): New prototype. * passes.def (pass_simduid_cleanup): Schedule another copy of the pass after all optimizations. * tree.c (omp_clause_code_name): Add entries for OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (omp_clause_num_ops): Likewise. Bump number of OMP_CLAUSE_REDUCTION arguments to 5 and for OMP_CLAUSE_ORDERED to 1. (walk_tree_1): Adjust for OMP_CLAUSE_ORDERED having 1 argument and OMP_CLAUSE_REDUCTION 5 arguments. Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD} clauses. * tree-core.h (enum omp_clause_linear_kind): New. (struct tree_omp_clause): Change type of map_kind from unsigned char to unsigned int. Add subcode.if_modifier and subcode.linear_kind fields. (enum omp_clause_code): Add OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (OMP_CLAUSE_REDUCTION): Document OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_{SOURCE,SINK}. * tree.def (OMP_FOR): Add OMP_FOR_ORIG_DECLS operand. (OMP_CRITICAL): Move before OMP_SINGLE. Add OMP_CRITICAL_CLAUSES operand. (OMP_ORDERED): Move before OMP_SINGLE. Add OMP_ORDERED_CLAUSES operand. (OMP_TASKLOOP, OMP_TARGET_ENTER_DATA, OMP_TARGET_EXIT_DATA): New tree codes. * tree.h (OMP_BODY): Replace OMP_CRITICAL with OMP_TASKGROUP. (OMP_CLAUSE_SET_MAP_KIND): Cast to unsigned int rather than unsigned char. (OMP_CRITICAL_NAME): Adjust to be 3rd operand instead of 2nd. (OMP_CLAUSE_NUM_TASKS_EXPR): Formatting fix. (OMP_STANDALONE_CLAUSES): Adjust to cover OMP_TARGET_{ENTER,EXIT}_DATA. (OMP_CLAUSE_DEPEND_SINK_NEGATIVE, OMP_TARGET_COMBINED, OMP_CLAUSE_MAP_PRIVATE, OMP_FOR_ORIG_DECLS, OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION, OMP_CRITICAL_CLAUSES, OMP_CLAUSE_PRIVATE_TASKLOOP_IV, OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, OMP_CLAUSE_HINT_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER, OMP_CLAUSE_SHARED_FIRSTPRIVATE, OMP_ORDERED_CLAUSES, OMP_TARGET_ENTER_DATA_CLAUSES, OMP_TARGET_EXIT_DATA_CLAUSES, OMP_CLAUSE_NUM_TASKS_EXPR, OMP_CLAUSE_GRAINSIZE_EXPR, OMP_CLAUSE_PRIORITY_EXPR, OMP_CLAUSE_ORDERED_EXPR): Define. * tree-inline.c (remap_gimple_stmt): Handle clauses on GIMPLE_OMP_ORDERED and GIMPLE_OMP_CRITICAL. For IFN_GOMP_SIMD_ORDERED_{START,END} set has_simduid_loops. * tree-nested.c (convert_nonlocal_omp_clauses): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (convert_local_omp_clauses): Likewise. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_ORDERED_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_DEPEND_{SOURCE,SINK}. Use "delete" for GOMP_MAP_FORCE_DEALLOC. Handle GOMP_MAP_{ALWAYS_{TO,FROM,TOFROM},RELEASE,FIRSTPRIVATE_POINTER,STRUCT}. (dump_generic_node): Handle OMP_TASKLOOP, OMP_TARGET_{ENTER,EXIT}_DATA and clauses on OMP_ORDERED and OMP_CRITICAL. * tree-vectorizer.c (adjust_simduid_builtins): Adjust comment. Remove IFN_GOMP_SIMD_ORDERED_{START,END}. (vectorize_loops): Adjust comments. (pass_simduid_cleanup::execute): Likewise. * tree-vect-stmts.c (vectorizable_simd_clone_call): Handle SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_CONSTANT_STEP. * wide-int.h (wi::gcd): New. gcc/c-family/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-common.c (enum c_builtin_type): Define DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10 and DEF_FUNCTION_TYPE_11. (c_define_builtins): Likewise. * c-common.h (enum c_omp_clause_split): Add C_OMP_CLAUSE_SPLIT_TASKLOOP. (c_finish_omp_critical, c_finish_omp_ordered): Add CLAUSES argument. (c_finish_omp_for): Add ORIG_DECLV argument. * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP as 201511 instead of 201307. * c-omp.c (c_finish_omp_critical): Add CLAUSES argument, set OMP_CRITICAL_CLAUSES to it. (c_finish_omp_ordered): Add CLAUSES argument, set OMP_ORDERED_CLAUSES to it. (c_finish_omp_for): Add ORIG_DECLV argument, set OMP_FOR_ORIG_DECLS to it if OMP_FOR. Clear DECL_INITIAL on the IVs. (c_omp_split_clauses): Handle OpenMP 4.5 combined/composite constructs and new OpenMP 4.5 clauses. Clear OMP_CLAUSE_SCHEDULE_SIMD if not combined with OMP_SIMD. Add verification code. * c-pragma.c (omp_pragmas_simd): Add taskloop. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKLOOP. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_{DEFAULTMAP,GRAINSIZE,HINT,{IS,USE}_DEVICE_PTR} and PRAGMA_OMP_CLAUSE_{LINK,NOGROUP,NUM_TASKS,PRIORITY,SIMD,THREADS}. gcc/c/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-parser.c (c_parser_pragma): Handle PRAGMA_OMP_ORDERED here. (c_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (c_parser_omp_variable_list): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Formatting fixes. (c_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize, c_parser_omp_clause_priority, c_parser_omp_clause_hint, c_parser_omp_clause_defaultmap, c_parser_omp_clause_use_device_ptr, c_parser_omp_clause_is_device_ptr): New functions. (c_parser_omp_clause_ordered): Parse optional parameter. (c_parser_omp_clause_reduction): Handle array reductions. (c_parser_omp_clause_schedule): Parse optional simd modifier. (c_parser_omp_clause_nogroup, c_parser_omp_clause_orderedkind): New functions. (c_parser_omp_clause_linear): Parse linear clause modifiers. (c_parser_omp_clause_depend_sink): New function. (c_parser_omp_clause_depend): Parse source/sink depend kinds. (c_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (c_parser_oacc_all_clauses): Adjust c_parser_omp_clause_if and c_finish_omp_clauses callers. (c_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (c_parser_oacc_cache): Adjust c_finish_omp_clauses caller. (OMP_CRITICAL_CLAUSE_MASK): Define. (c_parser_omp_critical): Parse critical clauses. (c_parser_omp_for_loop): Handle doacross loops, adjust c_finish_omp_for and c_finish_omp_clauses callers. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (c_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (c_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (c_parser_omp_ordered): Add CONTEXT argument, remove LOC argument, parse clauses and if depend clause is found, don't parse a body. (c_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (c_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (c_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (c_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (c_parser_omp_declare_reduction): Use STRIP_NOPS when checking for &omp_priv. (OMP_TASKLOOP_CLAUSE_MASK): Define. (c_parser_omp_taskloop): New function. (c_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (c_parser_cilk_for): Adjust c_finish_omp_clauses callers. * c-tree.h (c_finish_omp_clauses): Add two new arguments. * c-typeck.c (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (c_finish_omp_clauses): Add IS_OMP and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones. gcc/cp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * class.c (finish_struct_1): Call finish_omp_declare_simd_methods. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_TASKLOOP. (cp_genericize_r): Likewise. (cxx_omp_finish_clause): Don't diagnose references. (cxx_omp_disregard_value_expr): New function. * cp-objcp-common.h (LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR): Redefine. * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Document for OMP_TASKLOOP. (DECL_OMP_PRIVATIZED_MEMBER): Define. (finish_omp_declare_simd_methods, push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses, omp_privatize_field, cxx_omp_disregard_value_expr): New prototypes. (finish_omp_clauses): Add two new arguments. (finish_omp_for): Add ORIG_DECLV argument. * parser.c (cp_parser_lambda_body): Call save_omp_privatization_clauses and restore_omp_privatization_clauses. (cp_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (cp_parser_omp_var_list_no_open): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Parse this keyword. Formatting fixes. (cp_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority, cp_parser_omp_clause_hint, cp_parser_omp_clause_defaultmap): New functions. (cp_parser_omp_clause_ordered): Parse optional parameter. (cp_parser_omp_clause_reduction): Handle array reductions. (cp_parser_omp_clause_schedule): Parse optional simd modifier. (cp_parser_omp_clause_nogroup, cp_parser_omp_clause_orderedkind): New functions. (cp_parser_omp_clause_linear): Parse linear clause modifiers. (cp_parser_omp_clause_depend_sink): New function. (cp_parser_omp_clause_depend): Parse source/sink depend kinds. (cp_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_if and finish_omp_clauses callers. (cp_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (OMP_CRITICAL_CLAUSE_MASK): Define. (cp_parser_omp_critical): Parse critical clauses. (cp_parser_omp_for_incr): Use cp_tree_equal if processing_template_decl. (cp_parser_omp_for_loop_init): Return tree instead of bool. Handle non-static data member iterators. (cp_parser_omp_for_loop): Handle doacross loops, adjust finish_omp_for and finish_omp_clauses callers. (cp_omp_split_clauses): Adjust finish_omp_clauses caller. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (cp_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (cp_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (cp_parser_omp_ordered): Add CONTEXT argument, return bool instead of tree, parse clauses and if depend clause is found, don't parse a body. (cp_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (cp_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (cp_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (cp_parser_oacc_cache): Adjust finish_omp_clauses caller. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (cp_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (OMP_TASKLOOP_CLAUSE_MASK): Define. (cp_parser_omp_taskloop): New function. (cp_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (cp_parser_pragma): Handle PRAGMA_OMP_ORDERED here directly, handle PRAGMA_OMP_TASKLOOP, call push_omp_privatization_clauses and pop_omp_privatization_clauses around parsing calls. (cp_parser_cilk_for): Adjust finish_omp_clauses caller. * pt.c (apply_late_template_attributes): Adjust tsubst_omp_clauses and finish_omp_clauses callers. (tsubst_omp_clause_decl): Return NULL if decl is NULL. For TREE_LIST, copy over OMP_CLAUSE_DEPEND_SINK_NEGATIVE bit. Use tsubst_expr instead of tsubst_copy, undo convert_from_reference effects. (tsubst_omp_clauses): Add ALLOW_FIELDS argument. Handle new OpenMP 4.5 clauses. Use tsubst_omp_clause_decl for more clauses. If ALLOW_FIELDS, handle non-static data members in the clauses. Clear OMP_CLAUSE_LINEAR_STEP if it has been cleared before. (omp_parallel_combined_clauses): New variable. (tsubst_omp_for_iterator): Add ORIG_DECLV argument, recur on OMP_FOR_ORIG_DECLS, handle non-static data member iterators. Improve handling of clauses on combined constructs. (tsubst_expr): Call push_omp_privatization_clauses and pop_omp_privatization_clauses around instantiation of certain OpenMP constructs, improve handling of clauses on combined constructs, handle OMP_TASKLOOP, adjust tsubst_omp_for_iterator, tsubst_omp_clauses and finish_omp_for callers, handle clauses on critical and ordered, handle OMP_TARGET_{ENTER,EXIT}_DATA. (instantiate_decl): Call save_omp_privatization_clauses and restore_omp_privatization_clauses around instantiation. (dependent_omp_for_p): Fix up comment typo. Handle SCOPE_REF. * semantics.c (omp_private_member_map, omp_private_member_vec, omp_private_member_ignore_next): New variables. (finish_non_static_data_member): Return dummy decl for privatized non-static data members. (omp_clause_decl_field, omp_clause_printable_decl, omp_note_field_privatization, omp_privatize_field): New functions. (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (finish_omp_reduction_clause): Handle array sections and arrays. Use omp_clause_printable_decl. (finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink): New functions. (finish_omp_clauses): Add ALLOW_FIELDS and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones, handle non-static data members, reject this keyword when not allowed. (push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses): New functions. (handle_omp_for_class_iterator): Handle OMP_TASKLOOP class iterators. Add collapse and ordered arguments. Fix handling of lastprivate iterators in doacross loops. (finish_omp_for): Add ORIG_DECLV argument, handle doacross loops, adjust c_finish_omp_for, handle_omp_for_class_iterator and finish_omp_clauses callers. Fill in OMP_CLAUSE_LINEAR_STEP on simd loops with non-static data member iterators. gcc/fortran/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * f95-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11, DEF_FUNCTION_TYPE_VAR_1): Define. * trans-openmp.c (gfc_trans_omp_clauses): Set OMP_CLAUSE_IF_MODIFIER to ERROR_MARK, OMP_CLAUSE_ORDERED_EXPR to NULL. (gfc_trans_omp_critical): Adjust for addition of clauses. (gfc_trans_omp_ordered): Likewise. * types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. gcc/lto/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * lto-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/jit/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/ada/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * gcc-interface/utils.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/testsuite/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-c++-common/gomp/cancel-1.c (f2): Add map clause to target data. * c-c++-common/gomp/clauses-1.c: New test. * c-c++-common/gomp/clauses-2.c: New test. * c-c++-common/gomp/clauses-3.c: New test. * c-c++-common/gomp/clauses-4.c: New test. * c-c++-common/gomp/declare-target-1.c: New test. * c-c++-common/gomp/declare-target-2.c: New test. * c-c++-common/gomp/depend-3.c: New test. * c-c++-common/gomp/depend-4.c: New test. * c-c++-common/gomp/doacross-1.c: New test. * c-c++-common/gomp/if-1.c: New test. * c-c++-common/gomp/if-2.c: New test. * c-c++-common/gomp/linear-1.c: New test. * c-c++-common/gomp/map-2.c: New test. * c-c++-common/gomp/map-3.c: New test. * c-c++-common/gomp/nesting-1.c (f_omp_parallel, f_omp_target_data): Add map clause to target data. * c-c++-common/gomp/nesting-warn-1.c (f_omp_target): Likewise. * c-c++-common/gomp/ordered-1.c: New test. * c-c++-common/gomp/ordered-2.c: New test. * c-c++-common/gomp/ordered-3.c: New test. * c-c++-common/gomp/pr61486-1.c (foo): Remove linear clause on non-iterator. * c-c++-common/gomp/pr61486-2.c (test, test2): Remove ordered clause and ordered construct where no longer allowed. * c-c++-common/gomp/priority-1.c: New test. * c-c++-common/gomp/reduction-1.c: New test. * c-c++-common/gomp/schedule-simd-1.c: New test. * c-c++-common/gomp/sink-1.c: New test. * c-c++-common/gomp/sink-2.c: New test. * c-c++-common/gomp/sink-3.c: New test. * c-c++-common/gomp/sink-4.c: New test. * c-c++-common/gomp/udr-1.c: New test. * c-c++-common/taskloop-1.c: New test. * c-c++-common/cpp/openmp-define-3.c: Adjust for the new value of _OPENMP macro. * c-c++-common/cilk-plus/PS/body.c (foo): Adjust expected diagnostics. * c-c++-common/goacc-gomp/nesting-fail-1.c (f_acc_parallel, f_acc_kernels, f_acc_data, f_acc_loop): Add map clause to target data. * gcc.dg/gomp/clause-1.c: * gcc.dg/gomp/reduction-1.c: New test. * gcc.dg/gomp/sink-fold-1.c: New test. * gcc.dg/gomp/sink-fold-2.c: New test. * gcc.dg/gomp/sink-fold-3.c: New test. * gcc.dg/vect/vect-simd-clone-15.c: New test. * g++.dg/gomp/clause-1.C (T::test): Remove dg-error on privatization of non-static data members. * g++.dg/gomp/clause-3.C (foo): Remove one dg-error directive. Add some linear clause tests. * g++.dg/gomp/declare-simd-3.C: New test. * g++.dg/gomp/linear-1.C: New test. * g++.dg/gomp/member-1.C: New test. * g++.dg/gomp/member-2.C: New test. * g++.dg/gomp/pr66571-2.C: New test. * g++.dg/gomp/pr67504.C (foo): Add test for ordered clause with dependent argument. * g++.dg/gomp/pr67522.C (foo): Add test for invalid array section in reduction clause. * g++.dg/gomp/reference-1.C: New test. * g++.dg/gomp/sink-1.C: New test. * g++.dg/gomp/sink-2.C: New test. * g++.dg/gomp/sink-3.C: New test. * g++.dg/gomp/task-1.C: Remove both dg-error directives. * g++.dg/gomp/this-1.C: New test. * g++.dg/gomp/this-2.C: New test. * g++.dg/vect/simd-clone-2.cc: New test. * g++.dg/vect/simd-clone-2.h: New test. * g++.dg/vect/simd-clone-3.cc: New test. * g++.dg/vect/simd-clone-4.cc: New test. * g++.dg/vect/simd-clone-4.h: New test. * g++.dg/vect/simd-clone-5.cc: New test. include/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define. (enum gomp_map_kind): Add GOMP_MAP_FIRSTPRIVATE, GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_DELETE, GOMP_MAP_RELEASE, GOMP_MAP_FIRSTPRIVATE_POINTER. (GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Define. (GOMP_TASK_FLAG_UNTIED, GOMP_TASK_FLAG_FINAL, GOMP_TASK_FLAG_MERGEABLE, GOMP_TASK_FLAG_DEPEND, GOMP_TASK_FLAG_PRIORITY, GOMP_TASK_FLAG_UP, GOMP_TASK_FLAG_GRAINSIZE, GOMP_TASK_FLAG_IF, GOMP_TASK_FLAG_NOGROUP, GOMP_TARGET_FLAG_NOWAIT, GOMP_TARGET_FLAG_EXIT_DATA, GOMP_TARGET_FLAG_UPDATE): Define. libgomp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * config/linux/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/linux/doacross.h: New file. * config/posix/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/posix/doacross.h: New file. * env.c: Include gomp-constants.h. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (gomp_max_task_priority_var): New variable. (parse_schedule): Rename run_sched_modifier to run_sched_chunk_size. (handle_omp_display_env): Change _OPENMP value from 201307 to 201511. Print OMP_MAX_TASK_PRIORITY. (initialize_env): Parse OMP_MAX_TASK_PRIORITY. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size and run_sched_modifier to run_sched_chunk_size. (omp_get_max_task_priority, omp_get_initial_device, omp_get_num_places, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums): New functions. * fortran.c (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_): Rename modifier argument to chunk_size. (omp_get_num_places_, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num_, omp_get_partition_num_places_, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device_, omp_get_max_task_priority_): New functions. * libgomp_g.h (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_doacross_ull_post, GOMP_doacross_wait, GOMP_taskloop, GOMP_taskloop_ull, GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data): New prototypes. (GOMP_task): Add prototype argument. * libgomp.h (_LIBGOMP_CHECKING_): Define to 0 if not yet defined. (struct gomp_doacross_work_share): New type. (struct gomp_work_share): Add doacross field. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (enum gomp_task_kind): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. Add comments. (struct gomp_task_depend_entry): Add comments. (struct gomp_task): Likewise. (struct gomp_taskgroup): Likewise. (struct gomp_target_task): New type. (struct gomp_team): Add comment. (gomp_get_place_proc_ids_8, gomp_doacross_init, gomp_doacross_ull_init, gomp_task_maybe_wait_for_dependencies, gomp_create_target_task, gomp_target_task_fn): New prototypes. (struct target_var_desc): New type. (struct target_mem_desc): Adjust comment. Use struct target_var_desc instead of splay_tree_key for list. (REFCOUNT_INFINITY): Define. (struct splay_tree_key_s): Remove copy_from field. (struct gomp_device_descr): Add dev2dev_func field. (enum gomp_map_vars_kind): New enum. (gomp_map_vars): Add one argument. * libgomp.map (OMP_4.5): Export omp_get_max_task_priority, omp_get_max_task_priority_, omp_get_num_places, omp_get_num_places_, omp_get_place_num_procs, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num, omp_get_place_num_, omp_get_partition_num_places, omp_get_partition_num_places_, omp_get_partition_place_nums, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device, omp_get_initial_device_, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr and omp_target_disassociate_ptr. (GOMP_4.0.2): Renamed to ... (GOMP_4.5): ... this. Export GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data, GOMP_taskloop, GOMP_taskloop_ull, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_doacross_static_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_doacross_ull_post and GOMP_doacross_ull_wait. * libgomp.texi: Document omp_get_max_task_priority. Rename modifier argument to chunk_size for omp_set_schedule and omp_get_schedule. Document OMP_MAX_TASK_PRIORITY env var. * loop.c (GOMP_loop_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ordered_runtime_start): Likewise. (gomp_loop_doacross_static_start, gomp_loop_doacross_dynamic_start, gomp_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_parallel_loop_runtime_start): New functions. (GOMP_parallel_loop_runtime): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start): New functions or aliases. * loop_ull.c (GOMP_loop_ull_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ull_ordered_runtime_start): Likewise. (gomp_loop_ull_doacross_static_start, gomp_loop_ull_doacross_dynamic_start, gomp_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start): New functions. (GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start): New functions or aliases. * oacc-mem.c (acc_map_data, present_create_copy, gomp_acc_insert_pointer): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (gomp_acc_remove_pointer): Use copy_from from target_var_desc. * oacc-parallel.c (GOACC_data_start): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (GOACC_parallel_keyed): Likewise. Use copy_from from target_var_desc. * omp.h.in (omp_lock_hint_t): New type. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr): New prototypes. * omp_lib.f90.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New interfaces. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size. * omp_lib.h.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New functions and subroutines. * ordered.c: Include stdarg.h and string.h. (MAX_COLLAPSED_BITS): Define. (gomp_doacross_init, GOMP_doacross_post, GOMP_doacross_wait, gomp_doacross_ull_init, GOMP_doacross_ull_post, GOMP_doacross_ull_wait): New functions. * target.c: Include errno.h. (resolve_device): If device is not initialized, call gomp_init_device on it. (gomp_map_lookup): New function. (gomp_map_vars_existing): Add tgt_var argument, fill it in. Don't bump refcount if REFCOUNT_INFINITY. Handle GOMP_MAP_ALWAYS_TO_P. (get_kind): Rename is_openacc argument to short_mapkind. (gomp_map_pointer): Use gomp_map_lookup. (gomp_map_fields_existing): New function. (gomp_map_vars): Rename is_openacc argument to short_mapkind and is_target to pragma_kind. Handle GOMP_MAP_VARS_ENTER_DATA, handle GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_STRUCT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION. Adjust for tgt->list changed type and copy_from living in there. (gomp_copy_from_async): Adjust for tgt->list changed type and copy_from living in there. (gomp_unmap_vars): Likewise. (gomp_update): Likewise. Rename is_openacc argument to short_mapkind. Don't fail if object is not mapped. (gomp_load_image_to_device): Initialize refcount to REFCOUNT_INFINITY. (gomp_target_fallback): New function. (gomp_get_target_fn_addr): Likewise. (GOMP_target): Adjust gomp_map_vars caller, use gomp_get_target_fn_addr and gomp_target_fallback. (GOMP_target_41): New function. (gomp_target_data_fallback): New function. (GOMP_target_data): Use it, adjust gomp_map_vars caller. (GOMP_target_data_41): New function. (GOMP_target_update): Adjust gomp_update caller. (GOMP_target_update_41): New function. (gomp_exit_data, GOMP_target_enter_exit_data, gomp_target_task_fn, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect_worker, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr, gomp_load_plugin_for_device): New functions. * task.c: Include gomp-constants.h. Include taskloop.c twice to get GOMP_taskloop and GOMP_taskloop_ull definitions. (gomp_task_handle_depend): New function. (GOMP_task): Use it. Add priority argument. Use gomp-constant.h constants instead of hardcoded numbers. Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (gomp_create_target_task): New function. (verify_children_queue, verify_taskgroup_queue, verify_task_queue): New functions. (gomp_task_run_pre): Call verify_*_queue functions. If an upcoming tied task is about to leave the sibling or taskgroup queues in an invalid state, adjust appropriately. Remove taskgroup argument. Add comments. (gomp_task_run_post_handle_dependers): Add comments. (gomp_task_run_post_remove_parent): Likewise. (gomp_barrier_handle_tasks): Adjust gomp_task_run_pre caller. (GOMP_taskwait): Likewise. Add comments. (gomp_task_maybe_wait_for_dependencies): Fix scheduling problem such that the first non parent_depends_on task does not end up at the end of the children queue. (GOMP_taskgroup_start): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (GOMP_taskgroup_end): Adjust gomp_task_run_pre caller. * taskloop.c: New file. * testsuite/lib/libgomp.exp (check_effective_target_offload_device_nonshared_as): New proc. * testsuite/libgomp.c/affinity-2.c: New test. * testsuite/libgomp.c/doacross-1.c: New test. * testsuite/libgomp.c/doacross-2.c: New test. * testsuite/libgomp.c/examples-4/declare_target-1.c (fib_wrapper): Add map clause to target. * testsuite/libgomp.c/examples-4/declare_target-4.c (accum): Likewise. * testsuite/libgomp.c/examples-4/declare_target-5.c (accum): Likewise. * testsuite/libgomp.c/examples-4/device-1.c (main): Likewise. * testsuite/libgomp.c/examples-4/device-3.c (main): Likewise. * testsuite/libgomp.c/examples-4/target_data-3.c (gramSchmidt): Likewise. * testsuite/libgomp.c/examples-4/teams-2.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-3.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-4.c (dotprod): Likewise. * testsuite/libgomp.c/for-2.h (OMPTGT, OMPTO, OMPFROM): Define if not defined. Use those where needed. * testsuite/libgomp.c/for-4.c: New test. * testsuite/libgomp.c/for-5.c: New test. * testsuite/libgomp.c/for-6.c: New test. * testsuite/libgomp.c/linear-1.c: New test. * testsuite/libgomp.c/ordered-4.c: New test. * testsuite/libgomp.c/pr66199-2.c (f2): Adjust for linear clause only allowed on the loop iterator. * testsuite/libgomp.c/pr66199-3.c: New test. * testsuite/libgomp.c/pr66199-4.c: New test. * testsuite/libgomp.c/reduction-7.c: New test. * testsuite/libgomp.c/reduction-8.c: New test. * testsuite/libgomp.c/reduction-9.c: New test. * testsuite/libgomp.c/reduction-10.c: New test. * testsuite/libgomp.c/target-1.c (fn2, fn3, fn4): Add map(tofrom:s). * testsuite/libgomp.c/target-2.c (fn2, fn3, fn4): Likewise. * testsuite/libgomp.c/target-7.c (foo): Add map(h) where needed. * testsuite/libgomp.c/target-11.c: New test. * testsuite/libgomp.c/target-12.c: New test. * testsuite/libgomp.c/target-13.c: New test. * testsuite/libgomp.c/target-14.c: New test. * testsuite/libgomp.c/target-15.c: New test. * testsuite/libgomp.c/target-16.c: New test. * testsuite/libgomp.c/target-17.c: New test. * testsuite/libgomp.c/target-18.c: New test. * testsuite/libgomp.c/target-19.c: New test. * testsuite/libgomp.c/target-20.c: New test. * testsuite/libgomp.c/target-21.c: New test. * testsuite/libgomp.c/target-22.c: New test. * testsuite/libgomp.c/target-23.c: New test. * testsuite/libgomp.c/target-24.c: New test. * testsuite/libgomp.c/target-25.c: New test. * testsuite/libgomp.c/target-26.c: New test. * testsuite/libgomp.c/target-27.c: New test. * testsuite/libgomp.c/taskloop-1.c: New test. * testsuite/libgomp.c/taskloop-2.c: New test. * testsuite/libgomp.c/taskloop-3.c: New test. * testsuite/libgomp.c/taskloop-4.c: New test. * testsuite/libgomp.c++/ctor-13.C: New test. * testsuite/libgomp.c++/doacross-1.C: New test. * testsuite/libgomp.c++/examples-4/declare_target-2.C: Replace offload_device with offload_device_nonshared_as. * testsuite/libgomp.c++/for-12.C: New test. * testsuite/libgomp.c++/for-13.C: New test. * testsuite/libgomp.c++/for-14.C: New test. * testsuite/libgomp.c++/linear-1.C: New test. * testsuite/libgomp.c++/member-1.C: New test. * testsuite/libgomp.c++/member-2.C: New test. * testsuite/libgomp.c++/member-3.C: New test. * testsuite/libgomp.c++/member-4.C: New test. * testsuite/libgomp.c++/member-5.C: New test. * testsuite/libgomp.c++/ordered-1.C: New test. * testsuite/libgomp.c++/reduction-5.C: New test. * testsuite/libgomp.c++/reduction-6.C: New test. * testsuite/libgomp.c++/reduction-7.C: New test. * testsuite/libgomp.c++/reduction-8.C: New test. * testsuite/libgomp.c++/reduction-9.C: New test. * testsuite/libgomp.c++/reduction-10.C: New test. * testsuite/libgomp.c++/reference-1.C: New test. * testsuite/libgomp.c++/simd14.C: New test. * testsuite/libgomp.c++/target-2.C (fn2): Add map(tofrom: s) clause. * testsuite/libgomp.c++/target-5.C: New test. * testsuite/libgomp.c++/target-6.C: New test. * testsuite/libgomp.c++/target-7.C: New test. * testsuite/libgomp.c++/target-8.C: New test. * testsuite/libgomp.c++/target-9.C: New test. * testsuite/libgomp.c++/target-10.C: New test. * testsuite/libgomp.c++/target-11.C: New test. * testsuite/libgomp.c++/target-12.C: New test. * testsuite/libgomp.c++/taskloop-1.C: New test. * testsuite/libgomp.c++/taskloop-2.C: New test. * testsuite/libgomp.c++/taskloop-3.C: New test. * testsuite/libgomp.c++/taskloop-4.C: New test. * testsuite/libgomp.c++/taskloop-5.C: New test. * testsuite/libgomp.c++/taskloop-6.C: New test. * testsuite/libgomp.c++/taskloop-7.C: New test. * testsuite/libgomp.c++/taskloop-8.C: New test. * testsuite/libgomp.c++/taskloop-9.C: New test. * testsuite/libgomp.fortran/affinity1.f90: New test. * testsuite/libgomp.fortran/affinity2.f90: New test. liboffloadmic/ 2015-10-13 Ilya Verbin <ilya.verbin@intel.com> * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New function. * plugin/offload_target_main.cpp (__offload_target_tgt2tgt): New static function, register it in liboffloadmic. From-SVN: r228777
2015-10-13 21:06:23 +02:00
extern tree push_omp_privatization_clauses (bool);
extern void pop_omp_privatization_clauses (tree);
extern void save_omp_privatization_clauses (vec<tree> &);
extern void restore_omp_privatization_clauses (vec<tree> &);
extern void finish_omp_threadprivate (tree);
extern tree begin_omp_structured_block (void);
extern tree finish_omp_structured_block (tree);
Merge current set of OpenACC changes from gomp-4_0-branch. contrib/ * gcc_update (files_and_dependencies): Update rules for new libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files. gcc/ * builtin-types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * builtins.c: Include "gomp-constants.h". (expand_builtin_acc_on_device): New function. (expand_builtin, is_inexpensive_builtin): Handle BUILT_IN_ACC_ON_DEVICE. * builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER): New macros. * cgraph.c (cgraph_node::create): Consider flag_openacc next to flag_openmp. * config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h. <*-intelmic-* | *-intelmicemul-*> (tm_file): Add i386/intelmic-offload.h. * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link to libgomp and its dependencies. * config/arc/arc.h (LINK_COMMAND_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise. * config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * doc/generic.texi: Update for OpenACC changes. * doc/gimple.texi: Likewise. * doc/invoke.texi: Likewise. * doc/sourcebuild.texi: Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_OACC_LOOP. (dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. Dump more data. * gimple.c: Update comments for OpenACC changes. * gimple.def: Likewise. * gimple.h: Likewise. (enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. (gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the appropriate place. (is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions. * gimplify.c: Include "gomp-constants.h". Update comments for OpenACC changes. (is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gimplify_oacc_cache): New function. (gimplify_omp_for): Handle OACC_LOOP. (gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL, OACC_DATA. (gimplify_omp_target_update): Handle OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA, OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_body): Consider flag_openacc next to flag_openmp. * lto-streamer-out.c: Include "gomp-constants.h". * omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE) (BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END) (BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL) (BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT) (BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS) (BUILT_IN_ACC_ON_DEVICE): New builtins. * omp-low.c: Include "gomp-constants.h". Update comments for OpenACC changes. (struct omp_context): Add reduction_map, gwv_below, gwv_this members. (extract_omp_for_data, use_pointer_for_field, install_var_field) (new_omp_context, delete_omp_context, scan_sharing_clauses) (create_omp_child_function, scan_omp_for, scan_omp_target) (check_omp_nesting_restrictions, lower_reduction_clauses) (build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges): Update for OpenACC changes. (scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS: OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle GF_OMP_FOR_KIND_OACC_LOOP. (expand_omp_target, lower_omp_target): Handle GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA, GF_OMP_TARGET_KIND_OACC_DATA. (pass_expand_omp::execute, execute_lower_omp) (pass_diagnose_omp_blocks::gate): Consider flag_openacc next to flag_openmp. (offload_symbol_decl): New variable. (oacc_get_reduction_array_id, oacc_max_threads) (get_offload_symbol_decl, get_base_type, lookup_oacc_reduction) (maybe_lookup_oacc_reduction, enclosing_target_ctx) (oacc_loop_or_target_p, oacc_lower_reduction_var_helper) (oacc_gimple_assign, oacc_initialize_reduction_data) (oacc_finalize_reduction_data, oacc_process_reduction_data): New functions. (is_targetreg_ctx): Remove function. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH. * tree.c (omp_clause_code_name, walk_tree_1): Update accordingly. * tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR) (OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR) (OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR) (OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR) (OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros. * tree-core.h: Update comments for OpenACC changes. (enum omp_clause_map_kind): Remove. (struct tree_omp_clause): Change type of map_kind member from enum omp_clause_map_kind to unsigned char. * tree-inline.c: Update comments for OpenACC changes. * tree-nested.c: Likewise. Include "gomp-constants.h". (convert_nonlocal_reference_stmt, convert_local_reference_stmt) (convert_tramp_reference_stmt, convert_gimple_call): Update for OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-pretty-print.c: Include "gomp-constants.h". (dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. * tree-streamer-in.c: Include "gomp-constants.h". (unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-streamer-out.c: Include "gomp-constants.h". (pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. * tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA) (OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE) (OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes. * tree.c (omp_clause_num_ops): Update accordingly. * tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE): Likewise. (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY) (OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES) (OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES) (OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros. * tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind. (OMP_CLAUSE_SET_MAP_KIND): New macro. * varpool.c (varpool_node::get_create): Consider flag_openacc next to flag_openmp. * config/i386/intelmic-offload.h: New file. * config/nvptx/offload.h: Likewise. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): New macros. gcc/c-family/ * c.opt (fopenacc): New option. * c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC. * c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * c-common.h (c_finish_oacc_wait): New prototype. * c-omp.c: Include "omp-low.h" and "gomp-constants.h". (c_finish_oacc_wait): New function. * c-pragma.c (oacc_pragmas): New variable. (c_pp_lookup_pragma, init_pragma): Handle it. * c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC, PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE, PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN, PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE, PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE, PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE, PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST, PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS, PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT, PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE, PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF, PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR, PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT, PRAGMA_OACC_CLAUSE_WORKER. gcc/c/ * c-parser.c: Include "gomp-constants.h". (c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE. (c_parser_omp_construct): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT. (c_parser_omp_clause_name): Handle "auto", "async", "copy", "copyout", "create", "delete", "deviceptr", "gang", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "seq", "self", "vector", "vector_length", "wait", "worker". (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_. (c_parser_oacc_wait_list, c_parser_oacc_data_clause) (c_parser_oacc_data_clause_deviceptr) (c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers) (c_parser_oacc_clause_async, c_parser_oacc_clause_wait) (c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses) (c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels) (c_parser_oacc_enter_exit_data, c_parser_oacc_loop) (c_parser_oacc_parallel, c_parser_oacc_update) (c_parser_oacc_wait): New functions. * c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New prototypes. * c-typeck.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's GOMP_MAP_FORCE_DEVICEPTR. gcc/cp/ * parser.c: Include "gomp-constants.h". (cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (cp_parser_omp_construct, cp_parser_pragma): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (cp_parser_omp_clause_name): Handle "async", "copy", "copyout", "create", "delete", "deviceptr", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "vector_length", "wait". (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK) (OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_. (cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr) (cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list) (cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs) (cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async) (cp_parser_oacc_all_clauses, cp_parser_oacc_cache) (cp_parser_oacc_data, cp_parser_oacc_enter_exit_data) (cp_parser_oacc_kernels, cp_parser_oacc_loop) (cp_parser_oacc_parallel, cp_parser_oacc_update) (cp_parser_oacc_wait): New functions. * cp-tree.h (finish_oacc_data, finish_oacc_kernels) (finish_oacc_parallel): New prototypes. * semantics.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (finish_omp_clauses): Handle OMP_CLAUSE_ASYNC, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New functions. gcc/fortran/ * lang.opt (fopenacc): New option. * cpp.c (cpp_define_builtins): Conditionally define _OPENACC. * dump-parse-tree.c (show_omp_node): Split part of it into... (show_omp_clauses): ... this new function. (show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (show_namespace): Update for OpenACC. * f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN) (DEF_GOACC_BUILTIN_COMPILER): New macros. * types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (struct gfc_expr_list): New data type. (gfc_get_expr_list): New macro. (gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR. (OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE) (OMP_LIST_CACHE): New enumerators. (struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr, vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr, wait_list, tile_list, async, gang, worker, vector, seq, independent, wait, par_auto, gang_static, and loc members. (struct gfc_namespace): Add oacc_declare_clauses member. (gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (gfc_free_expr_list, gfc_resolve_oacc_directive) (gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks) (gfc_resolve_oacc_blocks): New prototypes. * match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and EXEC_OACC_PARALLEL_LOOP. * match.h (gfc_match_oacc_cache, gfc_match_oacc_wait) (gfc_match_oacc_update, gfc_match_oacc_declare) (gfc_match_oacc_loop, gfc_match_oacc_host_data) (gfc_match_oacc_data, gfc_match_oacc_kernels) (gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel) (gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data) (gfc_match_oacc_exit_data, gfc_match_oacc_routine): New prototypes. * openmp.c: Include "diagnostic.h" and "gomp-constants.h". (gfc_free_omp_clauses): Update for members added to struct gfc_omp_clauses. (gfc_match_omp_clauses): Change mask paramter to uint64_t. Add openacc parameter. (resolve_omp_clauses): Add openacc parameter. Update for OpenACC. (struct fortran_omp_context): Add is_openmp member. (gfc_resolve_omp_parallel_blocks): Initialize it. (gfc_resolve_do_iterator): Update for OpenACC. (gfc_resolve_omp_directive): Call resolve_omp_directive_inside_oacc_region. (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE) (OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE) (OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION) (OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE) (OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE) (OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE) (OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH) (OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND) (OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM) (OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO) (OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT) (OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t. (OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS) (OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT) (OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT) (OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN) (OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE) (OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER) (OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT) (OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT) (OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT) (OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros. (gfc_match_omp_clauses): Handle those. (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES) (OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES) (OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) (OACC_WAIT_CLAUSES): New macros. (gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang) (gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop) (gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop) (gfc_match_oacc_kernels, gfc_match_oacc_data) (gfc_match_oacc_host_data, gfc_match_oacc_loop) (gfc_match_oacc_declare, gfc_match_oacc_update) (gfc_match_oacc_enter_data, gfc_match_oacc_exit_data) (gfc_match_oacc_wait, gfc_match_oacc_cache) (gfc_match_oacc_routine, oacc_is_loop) (resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr) (check_symbol_not_pointer, check_array_not_assumed) (resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause) (oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels) (omp_code_to_statement, oacc_code_to_statement) (resolve_oacc_directive_inside_omp_region) (resolve_omp_directive_inside_oacc_region) (resolve_oacc_nested_loops, resolve_oacc_params_in_parallel) (resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks) (resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare) (gfc_resolve_oacc_directive): New functions. * parse.c (next_free): Update for OpenACC. Move some code into... (verify_token_free): ... this new function. (next_fixed): Update for OpenACC. Move some code into... (verify_token_fixed): ... this new function. (case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA. (case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP, ST_OACC_KERNELS_LOOP. (case_decl): Add ST_OACC_ROUTINE. (push_state, parse_critical_block, parse_progunit): Update for OpenACC. (gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (verify_st_order, parse_spec): Handle ST_OACC_DECLARE. (parse_executable): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA. (decode_oacc_directive, parse_oacc_structured_block) (parse_oacc_loop, is_oacc): New functions. * parse.h (struct gfc_state_data): Add oacc_declare_clauses member. (is_oacc): New prototype. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (resolve_codes): Call gfc_resolve_oacc_declare. * scanner.c (openacc_flag, openacc_locus): New variables. (skip_free_comments): Update for OpenACC. Move some code into... (skip_omp_attribute): ... this new function. (skip_oacc_attribute): New function. (skip_fixed_comments, gfc_next_char_literal): Update for OpenACC. * st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * trans-decl.c (gfc_generate_function_code): Update for OpenACC. * trans-openmp.c: Include "gomp-constants.h". (gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq, independent, wait_list, num_gangs_expr, num_workers_expr, vector_length_expr, vector, vector_expr, worker, worker_expr, gang, gang_expr members. (gfc_trans_omp_do): Handle EXEC_OACC_LOOP. (gfc_convert_expr_to_tree, gfc_trans_oacc_construct) (gfc_trans_oacc_executable_directive) (gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive) (gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions. * trans-stmt.c (gfc_trans_block_construct): Update for OpenACC. * trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare): New prototypes. * trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT, EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA, EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * gfortran.texi: Update for OpenACC. * intrinsic.texi: Likewise. * invoke.texi: Likewise. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * lto.c: Include "gomp-constants.h". gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fopenacc): New procedure. * g++.dg/goacc-gomp/goacc-gomp.exp: New file. * g++.dg/goacc/goacc.exp: Likewise. * gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise. * gcc.dg/goacc/goacc.exp: Likewise. * gfortran.dg/goacc/goacc.exp: Likewise. * c-c++-common/cpp/openacc-define-1.c: New file. * c-c++-common/cpp/openacc-define-2.c: Likewise. * c-c++-common/cpp/openacc-define-3.c: Likewise. * c-c++-common/goacc-gomp/nesting-1.c: Likewise. * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. * c-c++-common/goacc/acc_on_device-2-off.c: Likewise. * c-c++-common/goacc/acc_on_device-2.c: Likewise. * c-c++-common/goacc/asyncwait-1.c: Likewise. * c-c++-common/goacc/cache-1.c: Likewise. * c-c++-common/goacc/clauses-fail.c: Likewise. * c-c++-common/goacc/collapse-1.c: Likewise. * c-c++-common/goacc/data-1.c: Likewise. * c-c++-common/goacc/data-2.c: Likewise. * c-c++-common/goacc/data-clause-duplicate-1.c: Likewise. * c-c++-common/goacc/deviceptr-1.c: Likewise. * c-c++-common/goacc/deviceptr-2.c: Likewise. * c-c++-common/goacc/deviceptr-3.c: Likewise. * c-c++-common/goacc/if-clause-1.c: Likewise. * c-c++-common/goacc/if-clause-2.c: Likewise. * c-c++-common/goacc/kernels-1.c: Likewise. * c-c++-common/goacc/loop-1.c: Likewise. * c-c++-common/goacc/loop-private-1.c: Likewise. * c-c++-common/goacc/nesting-1.c: Likewise. * c-c++-common/goacc/nesting-data-1.c: Likewise. * c-c++-common/goacc/nesting-fail-1.c: Likewise. * c-c++-common/goacc/parallel-1.c: Likewise. * c-c++-common/goacc/pcopy.c: Likewise. * c-c++-common/goacc/pcopyin.c: Likewise. * c-c++-common/goacc/pcopyout.c: Likewise. * c-c++-common/goacc/pcreate.c: Likewise. * c-c++-common/goacc/pragma_context.c: Likewise. * c-c++-common/goacc/present-1.c: Likewise. * c-c++-common/goacc/reduction-1.c: Likewise. * c-c++-common/goacc/reduction-2.c: Likewise. * c-c++-common/goacc/reduction-3.c: Likewise. * c-c++-common/goacc/reduction-4.c: Likewise. * c-c++-common/goacc/sb-1.c: Likewise. * c-c++-common/goacc/sb-2.c: Likewise. * c-c++-common/goacc/sb-3.c: Likewise. * c-c++-common/goacc/update-1.c: Likewise. * gcc.dg/goacc/acc_on_device-1.c: Likewise. * gfortran.dg/goacc/acc_on_device-1.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2.f95: Likewise. * gfortran.dg/goacc/assumed.f95: Likewise. * gfortran.dg/goacc/asyncwait-1.f95: Likewise. * gfortran.dg/goacc/asyncwait-2.f95: Likewise. * gfortran.dg/goacc/asyncwait-3.f95: Likewise. * gfortran.dg/goacc/asyncwait-4.f95: Likewise. * gfortran.dg/goacc/branch.f95: Likewise. * gfortran.dg/goacc/cache-1.f95: Likewise. * gfortran.dg/goacc/coarray.f95: Likewise. * gfortran.dg/goacc/continuation-free-form.f95: Likewise. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/critical.f95: Likewise. * gfortran.dg/goacc/data-clauses.f95: Likewise. * gfortran.dg/goacc/data-tree.f95: Likewise. * gfortran.dg/goacc/declare-1.f95: Likewise. * gfortran.dg/goacc/enter-exit-data.f95: Likewise. * gfortran.dg/goacc/fixed-1.f: Likewise. * gfortran.dg/goacc/fixed-2.f: Likewise. * gfortran.dg/goacc/fixed-3.f: Likewise. * gfortran.dg/goacc/fixed-4.f: Likewise. * gfortran.dg/goacc/host_data-tree.f95: Likewise. * gfortran.dg/goacc/if.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/literal.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-2.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/loop-tree-1.f90: Likewise. * gfortran.dg/goacc/omp.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/parameter.f95: Likewise. * gfortran.dg/goacc/private-1.f95: Likewise. * gfortran.dg/goacc/private-2.f95: Likewise. * gfortran.dg/goacc/private-3.f95: Likewise. * gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise. * gfortran.dg/goacc/reduction-2.f95: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise. * gfortran.dg/goacc/routine-1.f90: Likewise. * gfortran.dg/goacc/routine-2.f90: Likewise. * gfortran.dg/goacc/sentinel-free-form.f95: Likewise. * gfortran.dg/goacc/several-directives.f95: Likewise. * gfortran.dg/goacc/sie.f95: Likewise. * gfortran.dg/goacc/subarrays.f95: Likewise. * gfortran.dg/gomp/map-1.f90: Likewise. * gfortran.dg/openacc-define-1.f90: Likewise. * gfortran.dg/openacc-define-2.f90: Likewise. * gfortran.dg/openacc-define-3.f90: Likewise. * g++.dg/gomp/block-1.C: Update for changed compiler output. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.dg/gomp/target-1.C: Likewise. * g++.dg/gomp/target-2.C: Likewise. * g++.dg/gomp/taskgroup-1.C: Likewise. * g++.dg/gomp/teams-1.C: Likewise. * gcc.dg/cilk-plus/jump-openmp.c: Likewise. * gcc.dg/cilk-plus/jump.c: Likewise. * gcc.dg/gomp/block-1.c: Likewise. * gcc.dg/gomp/block-10.c: Likewise. * gcc.dg/gomp/block-2.c: Likewise. * gcc.dg/gomp/block-3.c: Likewise. * gcc.dg/gomp/block-4.c: Likewise. * gcc.dg/gomp/block-5.c: Likewise. * gcc.dg/gomp/block-6.c: Likewise. * gcc.dg/gomp/block-7.c: Likewise. * gcc.dg/gomp/block-8.c: Likewise. * gcc.dg/gomp/block-9.c: Likewise. * gcc.dg/gomp/target-1.c: Likewise. * gcc.dg/gomp/target-2.c: Likewise. * gcc.dg/gomp/taskgroup-1.c: Likewise. * gcc.dg/gomp/teams-1.c: Likewise. include/ * gomp-constants.h: New file. libgomp/ * Makefile.am (search_path): Add $(top_srcdir)/../include. (libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c, oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c, oacc-async.c, oacc-plugin.c, oacc-cuda.c. [USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90. Include $(top_srcdir)/plugin/Makefrag.am. (nodist_libsubinclude_HEADERS): Add openacc.h. [USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h, openacc.f90, openacc.mod, openacc_kinds.mod. (omp_lib.mod): Generalize into... (%.mod): ... this new rule. (openacc_kinds.mod, openacc.mod): New rules. * plugin/configfrag.ac: New file. * configure.ac: Move plugin/offloading support into it. Include it. Instantiate testsuite/libgomp-test-support.pt.exp. * plugin/Makefrag.am: New file. * testsuite/Makefile.am (OFFLOAD_TARGETS) (OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't export. (libgomp-test-support.exp): New rule. (all-local): Depend on it. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * config.h.in: Likewise. * configure: Likewise. * configure.tgt: Harden shell syntax. * env.c: Include "oacc-int.h". (parse_acc_device_type): New function. (gomp_debug_var, goacc_device_type, goacc_device_num): New variables. (initialize_env): Initialize those. Call goacc_runtime_initialize. * error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions. (gomp_fatal): Call gomp_vfatal. * libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>. (gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug) (gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once) (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_memory_mapping, struct acc_dispatch_t) (struct gomp_device_descr, gomp_acc_insert_pointer) (gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async) (gomp_unmap_vars, gomp_init_device, gomp_init_tables) (gomp_free_memmap, gomp_fini_device): New declarations. (gomp_vdebug, gomp_debug): New macros. Include "splay-tree.h". * libgomp.map (OACC_2.0): New symbol version. Use for acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type, acc_set_device_type_h_, acc_get_device_type, acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_, acc_get_device_num, acc_get_device_num_h_, acc_async_test, acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_, acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_, acc_wait_all, acc_wait_all_h_, acc_wait_all_async, acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown, acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc, acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_, acc_copyin_array_h_, acc_present_or_copyin, acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_, acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_, acc_create_64_h_, acc_create_array_h_, acc_present_or_create, acc_present_or_create_32_h_, acc_present_or_create_64_h_, acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_, acc_copyout_64_h_, acc_copyout_array_h_, acc_delete, acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_, acc_update_device, acc_update_device_32_h_, acc_update_device_64_h_, acc_update_device_array_h_, acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_, acc_update_self_array_h_, acc_map_data, acc_unmap_data, acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_, acc_is_present_64_h_, acc_is_present_array_h_, acc_memcpy_to_device, acc_memcpy_from_device, acc_get_current_cuda_device, acc_get_current_cuda_context, acc_get_cuda_stream, acc_set_cuda_stream. (GOACC_2.0): New symbol version. Use for GOACC_data_end, GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait, GOACC_get_thread_num, GOACC_get_num_threads. (GOMP_PLUGIN_1.0): New symbol version. Use for GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared, GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error, GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars, GOMP_PLUGIN_acc_thread. * libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG environment variable. * libgomp_g.h (GOACC_data_start, GOACC_data_end) (GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait) (GOACC_get_num_threads, GOACC_get_thread_num): New declarations. * splay-tree.h (splay_tree_lookup, splay_tree_insert) (splay_tree_remove): New declarations. (rotate_left, rotate_right, splay_tree_splay, splay_tree_insert) (splay_tree_remove, splay_tree_lookup): Move into... * splay-tree.c: ... this new file. * target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>. (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_device_descr): Don't declare. (num_devices_openmp): New variable. (gomp_get_num_devices ): Use it. (gomp_init_targets_once): New function. (gomp_get_num_devices ): Use it. (get_kind, gomp_copy_from_async, gomp_free_memmap) (gomp_fini_device, gomp_register_image_for_device): New functions. (gomp_map_vars): Add devaddrs parameter. (gomp_update): Add mm parameter. (gomp_init_device): Move most of it into... (gomp_init_tables): ... this new function. (gomp_register_images_for_device): Remove function. (splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device): Make them hidden instead of static. (gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars) (gomp_update, gomp_init_device, GOMP_target, GOMP_target_data) (GOMP_target_end_data, GOMP_target_update) (gomp_load_plugin_for_device, gomp_target_init): Update for OpenACC changes. * oacc-async.c: New file. * oacc-cuda.c: Likewise. * oacc-host.c: Likewise. * oacc-init.c: Likewise. * oacc-int.h: Likewise. * oacc-mem.c: Likewise. * oacc-parallel.c: Likewise. * oacc-plugin.c: Likewise. * oacc-plugin.h: Likewise. * oacc-ptx.h: Likewise. * openacc.f90: Likewise. * openacc.h: Likewise. * openacc_lib.h: Likewise. * plugin/plugin-host.c: Likewise. * plugin/plugin-nvptx.c: Likewise. * libgomp-plugin.c: Likewise. * libgomp-plugin.h: Likewise. * libgomp_target.h: Remove file after merging content into the former file. Update all users. * testsuite/lib/libgomp.exp: Load libgomp-test-support.exp. (offload_targets_s, offload_targets_s_openacc): New variables. (check_effective_target_openacc_nvidia_accel_present) (check_effective_target_openacc_nvidia_accel_selected): New procedures. (libgomp_init): Update for OpenACC changes. * testsuite/libgomp-test-support.exp.in: New file. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise. * testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise. * testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-2.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-3.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/map-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name) (GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions. Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com> Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com> Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com> Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: James Norris <jnorris@codesourcery.com> Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r219682
2015-01-15 21:11:12 +01:00
extern tree finish_oacc_data (tree, tree);
OpenACC host_data support. gcc/ * gimple-pretty-print.c (dump_gimple_omp_target): Add host_data support. * gimple.h (gf_mask): Add GF_OMP_TARGET_KIND_OACC_HOST_DATA. (is_gimple_omp_oacc): Add support for above. * gimplify.c (omp_region_type): Add ORT_ACC_HOST_DATA. (omp_notice_variable): Diagnose undefined implicit uses of use_device variables in offloaded regions. (gimplify_scan_omp_clauses): Add host_data, use_device support. Diagnose undefined mapping of use_device variables in OpenACC clauses. (gimplify_omp_workshare): Add host_data support. (gimplify_expr): Likewise. * omp-builtins.def (BUILT_IN_GOACC_HOST_DATA): New. * omp-low.c (lookup_decl_in_outer_ctx) (maybe_lookup_decl_in_outer_ctx): Add optional argument to skip host_data regions. (scan_sharing_clauses): Support use_device. (check_omp_nesting_restrictions): Support host_data. (expand_omp_target): Support host_data. (lower_omp_target): Skip over outer host_data regions when looking up decls. Support use_device. (make_gimple_omp_edges): Support host_data. * tree-nested.c (convert_nonlocal_omp_clauses): Add use_device clause. gcc/c/ * c-parser.c (c_parser_omp_clause_name): Add use_device support. (c_parser_oacc_clause_use_device): New function. (c_parser_oacc_all_clauses): Add use_device support. (OACC_HOST_DATA_CLAUSE_MASK): New macro. (c_parser_oacc_host_data): New function. (c_parser_omp_construct): Add host_data support. * c-tree.h (c_finish_oacc_host_data): Add prototype. * c-typeck.c (c_finish_oacc_host_data): New function. (c_finish_omp_clauses): Add use_device support. gcc/cp/ * cp-tree.h (finish_oacc_host_data): Add prototype. * parser.c (cp_parser_omp_clause_name): Add use_device support. (cp_parser_oacc_all_clauses): Add use_device support. (OACC_HOST_DATA_CLAUSE_MASK): New macro. (cp_parser_oacc_host_data): New function. (cp_parser_omp_construct): Add host_data support. (cp_parser_pragma): Add host_data support. * semantics.c (finish_omp_clauses): Add use_device support. (finish_oacc_host_data): New function. gcc/c-family/ * c-pragma.c (oacc_pragmas): Add PRAGMA_OACC_HOST_DATA. * c-pragma.h (pragma_kind): Add PRAGMA_OACC_HOST_DATA. (pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_USE_DEVICE. libgomp/ * oacc-parallel.c (GOACC_host_data): New function. * libgomp.map (GOACC_host_data): Add to GOACC_2.0.1. * testsuite/libgomp.oacc-c-c++-common/host_data-1.c: New test. * testsuite/libgomp.oacc-c-c++-common/host_data-2.c: New test. * testsuite/libgomp.oacc-c-c++-common/host_data-3.c: New test. * testsuite/libgomp.oacc-c-c++-common/host_data-4.c: New test. * testsuite/libgomp.oacc-c-c++-common/host_data-5.c: New test. * testsuite/libgomp.oacc-c-c++-common/host_data-6.c: New test. Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> Co-Authored-By: James Norris <James_Norris@mentor.com> From-SVN: r231118
2015-12-01 16:52:23 +01:00
extern tree finish_oacc_host_data (tree, tree);
[PR c/64765, c/64880] Support OpenACC Combined Directives in C, C++ gcc/c-family/ PR c/64765 PR c/64880 * c-common.h (c_oacc_split_loop_clauses): Declare function. * c-omp.c (c_oacc_split_loop_clauses): New function. gcc/c/ PR c/64765 PR c/64880 * c-parser.c (c_parser_oacc_loop): Add mask, cclauses formal parameters, and handle these. Adjust all users. (c_parser_oacc_kernels, c_parser_oacc_parallel): Merge functions into... (c_parser_oacc_kernels_parallel): ... this new function. Adjust all users. * c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels): Don't declare functions. (c_finish_omp_construct): Declare function. * c-typeck.c (c_finish_oacc_parallel, c_finish_oacc_kernels): Merge functions into... (c_finish_omp_construct): ... this new function. gcc/cp/ PR c/64765 PR c/64880 * cp-tree.h (finish_oacc_kernels, finish_oacc_parallel): Don't declare functions. (finish_omp_construct): Declare function. * parser.c (cp_parser_oacc_loop): Add p_name, mask, cclauses formal parameters, and handle these. Adjust all users. (cp_parser_oacc_kernels, cp_parser_oacc_parallel): Merge functions into... (cp_parser_oacc_kernels_parallel): ... this new function. Adjust all users. * semantics.c (finish_oacc_kernels, finish_oacc_parallel): Merge functions into... (finish_omp_construct): ... this new function. gcc/ * tree.h (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES) (OACC_KERNELS_BODY, OACC_KERNELS_CLAUSES, OACC_KERNELS_COMBINED) (OACC_PARALLEL_COMBINED): Don't define macros. Adjust all users. gcc/testsuite/ PR c/64765 PR c/64880 * c-c++-common/goacc/loop-1.c: Don't skip for C++. Don't prune sorry message. (PR64765): New function. * gfortran.dg/goacc/coarray_2.f90: XFAIL. * gfortran.dg/goacc/combined_loop.f90: Extend. Don't prune sorry message. * gfortran.dg/goacc/cray.f95: Refine prune directive. * gfortran.dg/goacc/parameter.f95: Likewise. libgomp/ * testsuite/libgomp.oacc-c-c++-common/combdir-1.c: New file. * testsuite/libgomp.oacc-fortran/combdir-1.f90: Likewise. From-SVN: r229404
2015-10-27 09:39:15 +01:00
extern tree finish_omp_construct (enum tree_code, tree, tree);
extern tree begin_omp_parallel (void);
extern tree finish_omp_parallel (tree, tree);
c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. * langhooks.h (struct lang_hooks_for_decls): Add omp_finish_clause. Add omp_private_outer_ref hook, add another argument to omp_clause_default_ctor hook. * langhooks-def.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define. (LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define. (LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR): Change to hook_tree_tree_tree_tree_null. (LANG_HOOKS_DECLS): Add LANG_HOOKS_OMP_FINISH_CLAUSE and LANG_HOOKS_OMP_PRIVATE_OUTER_REF. * hooks.c (hook_tree_tree_tree_tree_null): New function. * hooks.h (hook_tree_tree_tree_tree_null): New prototype. * tree.def (OMP_TASK): New tree code. * tree.h (OMP_TASK_COPYFN, OMP_TASK_ARG_SIZE, OMP_TASK_ARG_ALIGN, OMP_CLAUSE_PRIVATE_OUTER_REF, OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_COLLAPSE_ITERVAR, OMP_CLAUSE_COLLAPSE_COUNT, OMP_TASKREG_CHECK, OMP_TASKREG_BODY, OMP_TASKREG_CLAUSES, OMP_TASKREG_FN, OMP_TASKREG_DATA_ARG, OMP_TASK_BODY, OMP_TASK_CLAUSES, OMP_TASK_FN, OMP_TASK_DATA_ARG, OMP_CLAUSE_COLLAPSE_EXPR): Define. (enum omp_clause_default_kind): Add OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. (OMP_DIRECTIVE_P): Add OMP_TASK. (OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): New clause codes. (OMP_CLAUSE_SCHEDULE_AUTO): New schedule kind. * tree.c (omp_clause_code_name): Add OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED entries. (omp_clause_num_ops): Likewise. Increase OMP_CLAUSE_LASTPRIVATE num_ops to 2. (walk_tree_1): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Walk OMP_CLAUSE_LASTPRIVATE_STMT. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_SCHEDULE_AUTO, OMP_CLAUSE_UNTIED, OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. (dump_generic_node): Handle OMP_TASK and collapsed OMP_FOR loops. * c-omp.c (c_finish_omp_for): Allow pointer iterators. Remove warning about unsigned iterators. Change decl/init/cond/incr arguments to TREE_VECs, check arguments for all collapsed loops. (c_finish_omp_taskwait): New function. (c_split_parallel_clauses): Put OMP_CLAUSE_COLLAPSE clause to ws_clauses. * c-parser.c (c_parser_omp_for_loop): Parse collapsed loops. Call default_function_array_conversion on init. Add par_clauses argument. If decl is present in parallel's lastprivate clause, change it to shared and add lastprivate clause for decl to OMP_FOR_CLAUSES. Add clauses argument, on success set OMP_FOR_CLAUSES to it. Look up collapse count in clauses. (c_parser_omp_for, c_parser_omp_parallel): Adjust c_parser_omp_for_loop callers. (OMP_FOR_CLAUSE_MASK): Add 1 << PRAGMA_OMP_CLAUSE_COLLAPSE. (c_parser_pragma): Handle PRAGMA_OMP_TASKWAIT. (c_parser_omp_clause_name): Handle collapse and untied clauses. (c_parser_omp_clause_collapse, c_parser_omp_clause_untied): New functions. (c_parser_omp_clause_schedule): Handle schedule(auto). Include correct location in the error message. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE and PRAGMA_OMP_CLAUSE_UNTIED. (OMP_TASK_CLAUSE_MASK): Define. (c_parser_omp_task, c_parser_omp_taskwait): New functions. (c_parser_omp_construct): Handle PRAGMA_OMP_TASK. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Handle OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_REDUCTION_INIT, OMP_CLAUSE_REDUCTION_MERGE, OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Don't handle TREE_STATIC or DECL_EXTERNAL VAR_DECLs in OMP_CLAUSE_DECL. (conver_nonlocal_reference, convert_local_reference, convert_call_expr): Handle OMP_TASK the same as OMP_PARALLEL. Use OMP_TASKREG_* macros rather than OMP_PARALLEL_*. (walk_omp_for): Adjust for OMP_FOR_{INIT,COND,INCR} changes. * tree-gimple.c (is_gimple_stmt): Handle OMP_TASK. * c-tree.h (c_begin_omp_task, c_finish_omp_task): New prototypes. * c-pragma.h (PRAGMA_OMP_TASK, PRAGMA_OMP_TASKWAIT): New. (PRAGMA_OMP_CLAUSE_COLLAPSE, PRAGMA_OMP_CLAUSE_UNTIED): New. * c-typeck.c (c_begin_omp_task, c_finish_omp_task): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. * c-pragma.c (init_pragma): Init omp task and omp taskwait pragmas. * c-common.h (c_finish_omp_taskwait): New prototype. * gimple-low.c (lower_stmt): Handle OMP_TASK. * tree-parloops.c (create_parallel_loop): Create 1 entry vectors for OMP_FOR_{INIT,COND,INCR}. * tree-cfg.c (remove_useless_stmts_1): Handle OMP_* containers. (make_edges): Handle OMP_TASK. * tree-ssa-operands.c (get_expr_operands): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. * tree-inline.c (estimate_num_insns_1): Handle OMP_TASK. * builtin-types.def (BT_PTR_ULONGLONG, BT_PTR_FN_VOID_PTR_PTR, BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New. * omp-builtins.def (BUILT_IN_GOMP_TASK, BUILT_IN_GOMP_TASKWAIT, BUILT_IN_GOMP_LOOP_ULL_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_STATIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_RUNTIME_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): New builtins. * gimplify.c (gimplify_omp_for): Allow pointer type for decl, handle POINTER_PLUS_EXPR. If loop counter has been replaced and original iterator is present in lastprivate clause or if collapse > 1, set OMP_CLAUSE_LASTPRIVATE_STMT. Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. (gimplify_expr): Handle OMP_SECTIONS_SWITCH and OMP_TASK. (enum gimplify_omp_var_data): Add GOVD_PRIVATE_OUTER_REF. (omp_notice_variable): Set GOVD_PRIVATE_OUTER_REF if needed, if it is set, lookup var in outer contexts too. Handle OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. Handle vars that are supposed to be implicitly determined firstprivate for task regions. (gimplify_scan_omp_clauses): Set GOVD_PRIVATE_OUTER_REF if needed, if it is set, lookup var in outer contexts too. Set OMP_CLAUSE_PRIVATE_OUTER_REF if GOVD_PRIVATE_OUTER_REF is set. Handle OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Take region_type as last argument instead of in_parallel and in_combined_parallel. (gimplify_omp_parallel, gimplify_omp_for, gimplify_omp_workshare): Adjust callers. (gimplify_adjust_omp_clauses_1): Set OMP_CLAUSE_PRIVATE_OUTER_REF if GOVD_PRIVATE_OUTER_REF is set. Call omp_finish_clause langhook. (new_omp_context): Set default_kind to OMP_CLAUSE_DEFAULT_UNSPECIFIED for OMP_TASK regions. (omp_region_type): New enum. (struct gimplify_omp_ctx): Remove is_parallel and is_combined_parallel fields, add region_type. (new_omp_context): Take region_type as argument instead of is_parallel and is_combined_parallel. (gimple_add_tmp_var, omp_firstprivatize_variable, omp_notice_variable, omp_is_private, omp_check_private): Adjust ctx->is_parallel and ctx->is_combined_parallel checks. (gimplify_omp_task): New function. (gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. * omp-low.c (extract_omp_for_data): Use schedule(static) for schedule(auto). Handle pointer and unsigned iterators. Compute fd->iter_type. Handle POINTER_PLUS_EXPR increments. Add loops argument. Extract data for collapsed OMP_FOR loops. (expand_parallel_call): Assert sched_kind isn't auto, map runtime schedule to index 3. (struct omp_for_data_loop): New type. (struct omp_for_data): Remove v, n1, n2, step, cond_code fields. Add loop, loops, collapse and iter_type fields. (workshare_safe_to_combine_p): Disallow combined for if iter_type is unsigned long long. Don't combine collapse > 1 loops unless all bounds and steps are constant. Adjust extract_omp_for_data caller. (expand_omp_for_generic): Handle pointer, unsigned and long long iterators. Handle collapsed OMP_FOR loops. Adjust for struct omp_for_data changes. If libgomp function doesn't return boolean_type_node, add comparison of the return value with 0. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle pointer, unsigned and long long iterators. Adjust for struct omp_for_data changes. (expand_omp_for): Assert sched_kind isn't auto, map runtime schedule to index 3. Use GOMP_loop_ull*{start,next} if iter_type is unsigned long long. Allocate loops array, pass it to extract_omp_for_data. For collapse > 1 loops use always expand_omp_for_generic. (omp_context): Add sfield_map and srecord_type fields. (is_task_ctx, lookup_sfield): New functions. (use_pointer_for_field): Use is_task_ctx helper. Change first argument's type from const_tree to tree. Clarify comment. In OMP_TASK disallow copy-in/out sharing. (build_sender_ref): Call lookup_sfield instead of lookup_field. (install_var_field): Add mask argument. Populate both record_type and srecord_type if needed. (delete_omp_context): Destroy sfield_map, clear DECL_ABSTRACT_ORIGIN in srecord_type. (fixup_child_record_type): Also remap FIELD_DECL's DECL_SIZE{,_UNIT} and DECL_FIELD_OFFSET. (scan_sharing_clauses): Adjust install_var_field callers. For firstprivate clauses on explicit tasks allocate the var by value in record_type unconditionally, rather than by reference. Handle OMP_CLAUSE_PRIVATE_OUTER_REF. Scan OMP_CLAUSE_LASTPRIVATE_STMT. Use is_taskreg_ctx instead of is_parallel_ctx. Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. (create_omp_child_function_name): Add task_copy argument, use *_omp_cpyfn* names if it is true. (create_omp_child_function): Add task_copy argument, if true create *_omp_cpyfn* helper function. (scan_omp_parallel): Adjust create_omp_child_function callers. Rename parallel_nesting_level to taskreg_nesting_level. (scan_omp_task): New function. (lower_rec_input_clauses): Don't run constructors for firstprivate explicit task vars which are initialized by *_omp_cpyfn*. Pass outer var ref to omp_clause_default_ctor hook if OMP_CLAUSE_PRIVATE_OUTER_REF or OMP_CLAUSE_LASTPRIVATE. Replace OMP_CLAUSE_REDUCTION_PLACEHOLDER decls in OMP_CLAUSE_REDUCTION_INIT. (lower_send_clauses): Clear DECL_ABSTRACT_ORIGIN if in task to avoid duplicate setting of fields. Handle OMP_CLAUSE_PRIVATE_OUTER_REF. (lower_send_shared_vars): Use srecord_type if non-NULL. Don't copy-out if TREE_READONLY, only copy-in. (expand_task_copyfn): New function. (expand_task_call): New function. (struct omp_taskcopy_context): New type. (task_copyfn_copy_decl, task_copyfn_remap_type, create_task_copyfn): New functions. (lower_omp_parallel): Rename to... (lower_omp_taskreg): ... this. Use OMP_TASKREG_* macros where needed. Call create_task_copyfn if srecord_type is needed. Adjust sender_decl type. (task_shared_vars): New variable. (check_omp_nesting_restrictions): Warn if work-sharing, barrier, master or ordered region is closely nested inside OMP_TASK. Add warnings for barrier if closely nested inside of work-sharing, ordered, or master region. (scan_omp_1): Call check_omp_nesting_restrictions even for GOMP_barrier calls. Rename parallel_nesting_level to taskreg_nesting_level. Handle OMP_TASK. (lower_lastprivate_clauses): Even if some lastprivate is found on a work-sharing construct, continue looking for them on parent parallel construct. (lower_omp_for_lastprivate): Add lastprivate clauses to the beginning of dlist rather than end. Adjust for struct omp_for_data changes. (lower_omp_for): Add rec input clauses before OMP_FOR_PRE_BODY, not after it. Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes, adjust extract_omp_for_data caller. (get_ws_args_for): Adjust extract_omp_for_data caller. (scan_omp_for): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. (lower_omp_single_simple): If libgomp function doesn't return boolean_type_node, add comparison of the return value with 0. (diagnose_sb_1, diagnose_sb_2): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. Handle OMP_TASK. (parallel_nesting_level): Rename to... (taskreg_nesting_level): ... this. (is_taskreg_ctx): New function. (build_outer_var_ref, omp_copy_decl): Use is_taskreg_ctx instead of is_parallel_ctx. (execute_lower_omp): Rename parallel_nesting_level to taskreg_nesting_level. (expand_omp_parallel): Rename to... (expand_omp_taskreg): ... this. Use OMP_TASKREG_* macros where needed. Call omp_task_call for OMP_TASK regions. (expand_omp): Adjust caller, handle OMP_TASK. (lower_omp_1): Adjust lower_omp_taskreg caller, handle OMP_TASK. * bitmap.c (bitmap_default_obstack_depth): New variable. (bitmap_obstack_initialize, bitmap_obstack_release): Do nothing if argument is NULL and bitmap_default_obstack is already initialized. * ipa-struct-reorg.c (do_reorg_1): Call bitmap_obstack_release at the end. * matrix-reorg.c (matrix_reorg): Likewise. cp/ * cp-tree.h (cxx_omp_finish_clause, cxx_omp_create_clause_info, dependent_omp_for_p, begin_omp_task, finish_omp_task, finish_omp_taskwait): New prototypes. (cxx_omp_clause_default_ctor): Add outer argument. (finish_omp_for): Add new clauses argument. * cp-gimplify.c (cxx_omp_finish_clause): New function. (cxx_omp_predetermined_sharing): Moved from semantics.c, rewritten. (cxx_omp_clause_default_ctor): Add outer argument. (cp_genericize_r): Walk OMP_CLAUSE_LASTPRIVATE_STMT. * cp-objcp-common.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define. * parser.c (cp_parser_omp_for_loop): Parse collapsed for loops. Add par_clauses argument. If decl is present in parallel's lastprivate clause, change that clause to shared and add a lastprivate clause for decl to OMP_FOR_CLAUSES. Fix wording of error messages. Adjust finish_omp_for caller. Add clauses argument. Parse loops with random access iterators. (cp_parser_omp_clause_collapse, cp_parser_omp_clause_untied): New functions. (cp_parser_omp_for, cp_parser_omp_parallel): Adjust cp_parser_omp_for_loop callers. (cp_parser_omp_for_cond, cp_parser_omp_for_incr): New helper functions. (cp_parser_omp_clause_name): Handle collapse and untied clauses. (cp_parser_omp_clause_schedule): Handle auto schedule. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE and PRAGMA_OMP_CLAUSE_UNTIED. (OMP_FOR_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_COLLAPSE. (OMP_TASK_CLAUSE_MASK): Define. (cp_parser_omp_task, cp_parser_omp_taskwait): New functions. (cp_parser_omp_construct): Handle PRAGMA_OMP_TASK. (cp_parser_pragma): Handle PRAGMA_OMP_TASK and PRAGMA_OMP_TASKWAIT. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Handle OMP_CLAUSE_LASTPRIVATE_STMT. (tsubst_omp_for_iterator): New function. (dependent_omp_for_p): New function. (tsubst_expr) <case OMP_FOR>: Use it. Handle collapsed OMP_FOR loops. Adjust finish_omp_for caller. Handle loops with random access iterators. Adjust for OMP_FOR_{INIT,COND,INCR} changes. (tsubst_expr): Handle OMP_TASK. * semantics.c (cxx_omp_create_clause_info): New function. (finish_omp_clauses): Call it. Handle OMP_CLAUSE_UNTIED and OMP_CLAUSE_COLLAPSE. (cxx_omp_predetermined_sharing): Removed. * semantics.c (finish_omp_for): Allow pointer iterators. Use handle_omp_for_class_iterator and dependent_omp_for_p. Handle collapsed for loops. Adjust c_finish_omp_for caller. Add new clauses argument. Fix check for type dependent cond or incr. Set OMP_FOR_CLAUSES to clauses. Use cp_convert instead of fold_convert to convert incr amount to difference_type. Only fold if not in template. If decl is mentioned in lastprivate clause, set OMP_CLAUSE_LASTPRIVATE_STMT. Handle loops with random access iterators. Adjust for OMP_FOR_{INIT,COND,INCR} changes. (finish_omp_threadprivate): Allow static class members of the current class. (handle_omp_for_class_iterator, begin_omp_task, finish_omp_task, finish_omp_taskwait): New functions. * parser.c (cp_parser_binary_expression): Add prec argument. (cp_parser_assignment_expression): Adjust caller. * cp-tree.h (outer_curly_brace_block): New prototype. * decl.c (outer_curly_brace_block): No longer static. fortran/ * scanner.c (skip_free_comments, skip_fixed_comments): Handle tabs. * parse.c (next_free): Allow tab after !$omp. (decode_omp_directive): Handle !$omp task, !$omp taskwait and !$omp end task. (case_executable): Add ST_OMP_TASKWAIT. (case_exec_markers): Add ST_OMP_TASK. (gfc_ascii_statement): Handle ST_OMP_TASK, ST_OMP_END_TASK and ST_OMP_TASKWAIT. (parse_omp_structured_block, parse_executable): Handle ST_OMP_TASK. * gfortran.h (gfc_find_sym_in_expr): New prototype. (gfc_statement): Add ST_OMP_TASK, ST_OMP_END_TASK and ST_OMP_TASKWAIT. (gfc_omp_clauses): Add OMP_SCHED_AUTO to sched_kind, OMP_DEFAULT_FIRSTPRIVATE to default_sharing. Add collapse and untied fields. (gfc_exec_op): Add EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * f95-lang.c (LANG_HOOKS_OMP_CLAUSE_COPY_CTOR, LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, LANG_HOOKS_OMP_CLAUSE_DTOR, LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define. * trans.h (gfc_omp_clause_default_ctor): Add another argument. (gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op, gfc_omp_clause_dtor, gfc_omp_private_outer_ref): New prototypes. * types.def (BT_ULONGLONG, BT_PTR_ULONGLONG, BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_VOID_PTR_PTR, BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New. (BT_BOOL): Use integer type with BOOL_TYPE_SIZE rather than boolean_type_node. * dump-parse-tree.c (gfc_show_omp_node): Handle EXEC_OMP_TASK, EXEC_OMP_TASKWAIT, OMP_SCHED_AUTO, OMP_DEFAULT_FIRSTPRIVATE, untied and collapse clauses. (gfc_show_code_node): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * trans.c (gfc_trans_code): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * st.c (gfc_free_statement): Likewise. * resolve.c (gfc_resolve_blocks, resolve_code): Likewise. (find_sym_in_expr): Rename to... (gfc_find_sym_in_expr): ... this. No longer static. (resolve_allocate_expr, resolve_ordinary_assign): Adjust caller. * match.h (gfc_match_omp_task, gfc_match_omp_taskwait): New prototypes. * openmp.c (resolve_omp_clauses): Allow allocatable arrays in firstprivate, lastprivate, reduction, copyprivate and copyin clauses. (omp_current_do_code): Made static. (omp_current_do_collapse): New variable. (gfc_resolve_omp_do_blocks): Compute omp_current_do_collapse, clear omp_current_do_code and omp_current_do_collapse on return. (gfc_resolve_do_iterator): Handle collapsed do loops. (resolve_omp_do): Likewise, diagnose errorneous collapsed do loops. (OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): Define. (gfc_match_omp_clauses): Handle default (firstprivate), schedule (auto), untied and collapse (n) clauses. (OMP_DO_CLAUSES): Add OMP_CLAUSE_COLLAPSE. (OMP_TASK_CLAUSES): Define. (gfc_match_omp_task, gfc_match_omp_taskwait): New functions. * trans-openmp.c (gfc_omp_private_outer_ref): New function. (gfc_omp_clause_default_ctor): Add outer argument. For allocatable arrays allocate them with the bounds of the outer var if outer var is allocated. (gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op, gfc_omp_clause_dtor): New functions. (gfc_trans_omp_array_reduction): If decl is allocatable array, allocate it with outer var's bounds in OMP_CLAUSE_REDUCTION_INIT and deallocate it in OMP_CLAUSE_REDUCTION_MERGE. (gfc_omp_predetermined_sharing): Return OMP_CLAUSE_DEFAULT_SHARED for assumed-size arrays. (gfc_trans_omp_do): Add par_clauses argument. If dovar is present in lastprivate clause and do loop isn't simple, set OMP_CLAUSE_LASTPRIVATE_STMT. If dovar is present in parallel's lastprivate clause, change it to shared and add lastprivate clause to OMP_FOR_CLAUSES. Handle collapsed do loops. (gfc_trans_omp_directive): Adjust gfc_trans_omp_do callers. (gfc_trans_omp_parallel_do): Likewise. Move collapse clause to OMP_FOR from OMP_PARALLEL. (gfc_trans_omp_clauses): Handle OMP_SCHED_AUTO, OMP_DEFAULT_FIRSTPRIVATE, untied and collapse clauses. (gfc_trans_omp_task, gfc_trans_omp_taskwait): New functions. (gfc_trans_omp_directive): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. gcc/testsuite/ * gcc.dg/gomp/collapse-1.c: New test. * gcc.dg/gomp/nesting-1.c: New test. * g++.dg/gomp/task-1.C: New test. * g++.dg/gomp/predetermined-1.C: New test. * g++.dg/gomp/tls-4.C: New test. * gfortran.dg/gomp/collapse1.f90: New test. * gfortran.dg/gomp/sharing-3.f90: New test. * gcc.dg/gomp/pr27499.c (foo): Remove is unsigned dg-warning. * g++.dg/gomp/pr27499.C (foo): Likewise. * g++.dg/gomp/for-16.C (foo): Likewise. * g++.dg/gomp/tls-3.C: Remove dg-error, add S::s definition. * g++.dg/gomp/pr34607.C: Adjust dg-error location. * g++.dg/gomp/for-16.C (foo): Add a new dg-error. * gcc.dg/gomp/appendix-a/a.35.4.c: Add dg-warning. * gcc.dg/gomp/appendix-a/a.35.6.c: Likewise. * gfortran.dg/gomp/appendix-a/a.35.4.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise. * gfortran.dg/gomp/omp_parse1.f90: Remove !$omp tab test. * gfortran.dg/gomp/appendix-a/a.33.4.f90: Remove dg-error about allocatable array. * gfortran.dg/gomp/reduction1.f90: Likewise. libgomp/ * configure.ac (LIBGOMP_GNU_SYMBOL_VERSIONING): New AC_DEFINE. Substitute also OMP_*LOCK_25*. * configure: Regenerated. * config.h.in: Regenerated. * Makefile.am (libgomp_la_SOURCES): Add loop_ull.c, iter_ull.c, ptrlock.c and task.c. * Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * task.c: New file. * loop_ull.c: New file. * iter_ull.c: New file. * libgomp.h: Include ptrlock.h. (enum gomp_task_kind): New type. (struct gomp_team): Add task_lock, task_queue, task_count, task_running_count, single_count fields. Add work_share_list_free_lock ifndef HAVE_SYNC_BUILTINS. Remove work_share_lock, generation_mask, oldest_live_gen, num_live_gen and init_work_shares fields, add work work_share_list_alloc, work_share_list_free and work_share_chunk fields. Change work_shares from pointer to pointers into an array. Change ordered_release field into gomp_sem_t ** from flexible array member. Add implicit_task and initial_work_shares fields. Move close to the end of the struct. (struct gomp_team_state): Add single_count, last_work_share, active_level and level fields, remove work_share_generation. (gomp_barrier_handle_tasks): New prototype. (gomp_finish_task): New inline function. (struct gomp_work_share): Move chunk_size, end, incr into transparent union/struct, add chunk_size_ull, end_ll, incr_ll and next_ll fields. Reshuffle fields. Add next_alloc, next_ws, next_free and inline_ordered_team_ids fields, change ordered_team_ids into pointer from flexible array member. Add mode field. Put lock and next into a different cache line from most of the write-once fields. (gomp_iter_ull_static_next, gomp_iter_ull_dynamic_next_locked, gomp_iter_ull_guided_next_locked, gomp_iter_ull_dynamic_next, gomp_iter_ull_guided_next): New prototypes. (gomp_new_icv): New prototype. (struct gomp_thread): Add thread_pool and task fields. (struct gomp_thread_pool): New type. (gomp_new_team): New prototype. (gomp_team_start): Change type of last argument. (gomp_new_work_share): Removed. (gomp_init_work_share, gomp_fini_work_share): New prototypes. (gomp_work_share_init_done): New static inline. (gomp_throttled_spin_count_var, gomp_available_cpus, gomp_managed_threads): New extern decls. (gomp_init_task): New prototype. (gomp_spin_count_var): New extern var decl. (LIBGOMP_GNU_SYMBOL_VERSIONING): Undef if no visibility or no alias support, or if not PIC. (gomp_init_lock_30, gomp_destroy_lock_30, gomp_set_lock_30, gomp_unset_lock_30, gomp_test_lock_30, gomp_init_nest_lock_30, gomp_destroy_nest_lock_30, gomp_set_nest_lock_30, gomp_unset_nest_lock_30, gomp_test_nest_lock_30, gomp_init_lock_25, gomp_destroy_lock_25, gomp_set_lock_25, gomp_unset_lock_25, gomp_test_lock_25, gomp_init_nest_lock_25, gomp_destroy_nest_lock_25, gomp_set_nest_lock_25, gomp_unset_nest_lock_25, gomp_test_nest_lock_25): New prototypes. (omp_lock_symver, strong_alias): Define. (gomp_remaining_threads_count, gomp_remaining_threads_lock): New decls. (gomp_end_task): New. (struct gomp_task_icv, gomp_global_icv): New. (gomp_thread_limit_var, gomp_max_active_levels_var): New. (struct gomp_task): New. (gomp_nthreads_var, gomp_dyn_var, gomp_nest_var, gomp_run_sched_var, gomp_run_sched_chunk): Remove. (gomp_icv): New. (gomp_schedule_type): Reorder enum to match omp_sched_t. * team.c (struct gomp_thread_start_data): Add thread_pool and task fields. (gomp_thread_start): Add gomp_team_barrier_wait call. For non-nested case remove clearing of docked thread thr fields. Use pool fields instead of global gomp_* variables. Use gomp_barrier_wait_last when needed. Initialize ts.active_level. Create tasks for each member thread. (free_team): Only destroy team barrier, task_lock here and free it. (gomp_free_thread): Free last_team if non-NULL. (gomp_team_end): Call gomp_team_barrier_wait instead of gomp_barrier_wait. For nested case call one extra gomp_barrier_wait. Move here some destruction from free_team. Call free_team on pool->last_team if any, rather than freeing current team. Destroy work_share_list_free_lock ifndef HAVE_SYNC_BUILTINS. (gomp_new_icv): New function. (gomp_threads, gomp_threads_size, gomp_threads_used, gomp_threads_dock): Removed. (gomp_thread_destructor): New variable. (gomp_new_thread_pool, gomp_free_pool_helper, gomp_free_thread): New functions. (gomp_team_start): Create new pool if current thread doesn't have one. Use pool fields instead of global gomp_* variables. Initialize thread_pool field for new threads. Clear single_count. Change last argument from ws to team, don't create new team, set ts.work_share to &team->work_shares[0] and clear ts.last_work_share. Don't clear ts.work_share_generation. If number of threads changed, adjust atomically gomp_managed_threads. Use gomp_init_task instead of gomp_new_task, set thr->task to the corresponding implicit_task array entry. Create tasks for each member thread. Initialize ts.level. (initialize_team): Call pthread_key_create on gomp_thread_destructor. (team_destructor): New function. (new_team): Removed. (gomp_new_team): New function. (free_team): Free gomp_work_share blocks chained through next_alloc, instead of freeing work_shares and destroying work_share_lock. (gomp_team_end): Call gomp_fini_work_share. If number of threads changed, adjust atomically gomp_managed_threads. Use gomp_end_task. * barrier.c (GOMP_barrier): Call gomp_team_barrier_wait instead of gomp_barrier_wait. * single.c (GOMP_single_copy_start): Call gomp_team_barrier_wait instead of gomp_barrier_wait. Call gomp_work_share_init_done if gomp_work_share_start returned true. Don't unlock ws->lock. (GOMP_single_copy_end): Call gomp_team_barrier_wait instead of gomp_barrier_wait. (GOMP_single_start): Rewritten if HAVE_SYNC_BUILTINS. Call gomp_work_share_init_done if gomp_work_share_start returned true. Don't unlock ws->lock. * work.c: Include stddef.h. (free_work_share): Use work_share_list_free_lock instead of atomic chaining ifndef HAVE_SYNC_BUILTINS. Add team argument. Call gomp_fini_work_share and then either free ws if orphaned, or put it into work_share_list_free list of the current team. (alloc_work_share, gomp_init_work_share, gomp_fini_work_share): New functions. (gomp_work_share_start, gomp_work_share_end, gomp_work_share_end_nowait): Rewritten. * omp_lib.f90.in Change some tabs to spaces to prevent warnings. (openmp_version): Set to 200805. (omp_sched_kind, omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): New parameters. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New interfaces. * omp_lib.h.in (openmp_version): Set to 200805. (omp_sched_kind, omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): New parameters. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New externals. * loop.c: Include limits.h. (GOMP_loop_runtime_next, GOMP_loop_ordered_runtime_next): Handle GFS_AUTO. (GOMP_loop_runtime_start, GOMP_loop_ordered_runtime_start): Likewise. Use gomp_icv. (gomp_loop_static_start, gomp_loop_dynamic_start): Clear ts.static_trip here. (gomp_loop_static_start, gomp_loop_ordered_static_start): Call gomp_work_share_init_done after gomp_loop_init. Don't unlock ws->lock. (gomp_loop_dynamic_start, gomp_loop_guided_start): Call gomp_work_share_init_done after gomp_loop_init. If HAVE_SYNC_BUILTINS, don't unlock ws->lock, otherwise lock it. (gomp_loop_ordered_dynamic_start, gomp_loop_ordered_guided_start): Call gomp_work_share_init_done after gomp_loop_init. Lock ws->lock. (gomp_parallel_loop_start): Call gomp_new_team instead of gomp_new_work_share. Call gomp_loop_init on &team->work_shares[0]. Adjust gomp_team_start caller. Pass 0 as second argument to gomp_resolve_num_threads. (gomp_loop_init): For GFS_DYNAMIC, multiply ws->chunk_size by incr. If adding ws->chunk_size nthreads + 1 times after end won't overflow, set ws->mode to 1. * libgomp_g.h (GOMP_loop_ull_static_start, GOMP_loop_ull_dynamic_start, GOMP_loop_ull_guided_start, GOMP_loop_ull_runtime_start, GOMP_loop_ull_ordered_static_start, GOMP_loop_ull_ordered_dynamic_start, GOMP_loop_ull_ordered_guided_start, GOMP_loop_ull_ordered_runtime_start, GOMP_loop_ull_static_next, GOMP_loop_ull_dynamic_next, GOMP_loop_ull_guided_next, GOMP_loop_ull_runtime_next, GOMP_loop_ull_ordered_static_next, GOMP_loop_ull_ordered_dynamic_next, GOMP_loop_ull_ordered_guided_next, GOMP_loop_ull_ordered_runtime_next, GOMP_task, GOMP_taskwait): New prototypes. * libgomp.map: Export lock routines also @@OMP_2.0. (GOMP_loop_ordered_dynamic_first, GOMP_loop_ordered_guided_first, GOMP_loop_ordered_runtime_first, GOMP_loop_ordered_static_first): Remove. (GOMP_loop_ull_dynamic_next, GOMP_loop_ull_dynamic_start, GOMP_loop_ull_guided_next, GOMP_loop_ull_guided_start, GOMP_loop_ull_ordered_dynamic_next, GOMP_loop_ull_ordered_dynamic_start, GOMP_loop_ull_ordered_guided_next, GOMP_loop_ull_ordered_guided_start, GOMP_loop_ull_ordered_runtime_next, GOMP_loop_ull_ordered_runtime_start, GOMP_loop_ull_ordered_static_next, GOMP_loop_ull_ordered_static_start, GOMP_loop_ull_runtime_next, GOMP_loop_ull_runtime_start, GOMP_loop_ull_static_next, GOMP_loop_ull_static_start, GOMP_task, GOMP_taskwait): Export @@GOMP_2.0. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_, omp_set_max_active_levels_, omp_set_max_active_levels_8_, omp_get_max_active_levels_, omp_get_level_, omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_, omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_): New exports @@OMP_3.0. * omp.h.in (omp_sched_t): New type. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New prototypes. * env.c (gomp_spin_count_var, gomp_throttled_spin_count_var, gomp_available_cpus, gomp_managed_threads, gomp_max_active_levels_var, gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): New variables. (parse_spincount): New function. (initialize_env): Call gomp_init_num_threads unconditionally. Initialize gomp_available_cpus. Call parse_spincount, initialize gomp_{,throttled_}spin_count_var depending on presence and value of OMP_WAIT_POLICY and GOMP_SPINCOUNT env vars. Handle GOMP_BLOCKTIME env var. Handle OMP_WAIT_POLICY, OMP_MAX_ACTIVE_LEVELS, OMP_THREAD_LIMIT, OMP_STACKSIZE env vars. Handle unit specification for GOMP_STACKSIZE. Initialize gomp_remaining_threads_count and gomp_remaining_threads_lock if needed. Use gomp_global_icv. (gomp_nthreads_var, gomp_dyn_var, gomp_nest_var, gomp_run_sched_var, gomp_run_sched_chunk): Remove. (gomp_global_icv): New. (parse_schedule): Use it. Parse "auto". (omp_set_num_threads): Use gomp_icv. (omp_set_dynamic, omp_get_dynamic, omp_set_nested, omp_get_nested): Likewise. (omp_get_max_threads): Move from parallel.c. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels): New functions, add ialias. (parse_stacksize, parse_wait_policy): New functions. * fortran.c: Rewrite lock wrappers, if symbol versioning provide both wrappers for compatibility and new locks. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New ialias_redirect. (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_, omp_set_max_active_levels_, omp_set_max_active_levels_8_, omp_get_max_active_levels_, omp_get_level_, omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_, omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_): New functions. * parallel.c: Include limits.h. (gomp_resolve_num_threads): Add count argument. Rewritten. (GOMP_parallel_start): Call gomp_new_team and pass that as last argument to gomp_team_start. Pass 0 as second argument to gomp_resolve_num_threads. (GOMP_parallel_end): Decrease gomp_remaining_threads_count if gomp_thread_limit_var != ULONG_MAX. (omp_in_parallel): Implement using ts.active_level. (omp_get_max_threads): Move to env.c. (omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New functions, add ialias. * sections.c (GOMP_sections_start): Call gomp_work_share_init_done after gomp_sections_init. If HAVE_SYNC_BUILTINS, call gomp_iter_dynamic_next instead of the _locked variant and don't take lock around it, otherwise acquire it before calling gomp_iter_dynamic_next_locked. (GOMP_sections_next): If HAVE_SYNC_BUILTINS, call gomp_iter_dynamic_next instead of the _locked variant and don't take lock around it. (GOMP_parallel_sections_start): Call gomp_new_team instead of gomp_new_work_share. Call gomp_sections_init on &team->work_shares[0]. Adjust gomp_team_start caller. Pass count as second argument to gomp_resolve_num_threads, don't adjust num_threads after the call. Use gomp_icv. * iter.c (gomp_iter_dynamic_next_locked): Don't multiply ws->chunk_size by incr. (gomp_iter_dynamic_next): Likewise. If ws->mode, use more efficient code. * libgomp_f.h.in (omp_lock_25_arg_t, omp_nest_lock_25_arg_t): New types. (omp_lock_25_arg, omp_nest_lock_25_arg): New macros. (omp_check_defines): Check even the compat defines. * config/linux/ptrlock.c: New file. * config/linux/ptrlock.h: New file. * config/linux/wait.h: New file. * config/posix/ptrlock.c: New file. * config/posix/ptrlock.h: New file. * config/linux/bar.h (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes. (gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): New inlines. (gomp_barrier_t): Rewritten. (gomp_barrier_state_t): New typedef. (gomp_barrier_init, gomp_barrier_reinit, gomp_barrier_destroy, gomp_barrier_wait_start): Rewritten. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_barrier_last_thread, gomp_barrier_wait_last): New static inlines. * config/linux/bar.c: Include wait.h instead of libgomp.h and futex.h. (gomp_barrier_wait_end): Rewritten. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake, gomp_barrier_wait_last): New functions. * config/posix/bar.h (gomp_barrier_t): Add generation field. (gomp_barrier_state_t): New typedef. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes. (gomp_barrier_wait_start): Or all but low 2 bits from generation into the return value. Return gomp_barrier_state_t. (gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): New inlines. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_barrier_last_thread, gomp_barrier_wait_last): New static inlines. * config/posix/bar.c (gomp_barrier_init): Clear generation field. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New functions. * config/linux/mutex.c: Include wait.h instead of libgomp.h and futex.h. (gomp_futex_wake, gomp_futex_wait): New variables. (gomp_mutex_lock_slow): Call do_wait instead of futex_wait. * config/linux/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. Include wait.h instead of libgomp.h and futex.h. (gomp_set_nest_lock_25): Call do_wait instead of futex_wait. * config/posix95/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. * config/posix/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. * config/linux/proc.c (gomp_init_num_threads): Use gomp_global_icv. (get_num_procs, gomp_dynamic_max_threads): Use gomp_icv. * config/posix/proc.c, config/mingw32/proc.c: Similarly. * config/linux/powerpc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/alpha/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/x86/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/s390/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/ia64/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/sparc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/sem.c: Include wait.h instead of libgomp.h and futex.h. (gomp_sem_wait_slow): Call do_wait instead of futex_wait. * config/linux/affinity.c: Assume HAVE_SYNC_BUILTINS. * config/linux/omp-lock.h (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_nest_lock_t): Change owner into void *, add lock field. * config/posix95/omp-lock.h: Include semaphore.h. (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_lock_t): Use sem_t instead of mutex if semaphores aren't broken. (omp_nest_lock_t): Likewise. Change owner to void *. * config/posix/omp-lock.h: Include semaphore.h. (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_lock_t): Use sem_t instead of mutex if semaphores aren't broken. (omp_nest_lock_t): Likewise. Add owner field. * testsuite/libgomp.c/collapse-1.c: New test. * testsuite/libgomp.c/collapse-2.c: New test. * testsuite/libgomp.c/collapse-3.c: New test. * testsuite/libgomp.c/icv-1.c: New test. * testsuite/libgomp.c/icv-2.c: New test. * testsuite/libgomp.c/lib-2.c: New test. * testsuite/libgomp.c/lock-1.c: New test. * testsuite/libgomp.c/lock-2.c: New test. * testsuite/libgomp.c/lock-3.c: New test. * testsuite/libgomp.c/loop-4.c: New test. * testsuite/libgomp.c/loop-5.c: New test. * testsuite/libgomp.c/loop-6.c: New test. * testsuite/libgomp.c/loop-7.c: New test. * testsuite/libgomp.c/loop-8.c: New test. * testsuite/libgomp.c/loop-9.c: New test. * testsuite/libgomp.c/nested-3.c: New test. * testsuite/libgomp.c/nestedfn-6.c: New test. * testsuite/libgomp.c/sort-1.c: New test. * testsuite/libgomp.c/task-1.c: New test. * testsuite/libgomp.c/task-2.c: New test. * testsuite/libgomp.c/task-3.c: New test. * testsuite/libgomp.c/task-4.c: New test. * testsuite/libgomp.c++/c++.exp: Add libstdc++-v3 build includes to C++ testsuite default compiler options. * testsuite/libgomp.c++/collapse-1.C: New test. * testsuite/libgomp.c++/collapse-2.C: New test. * testsuite/libgomp.c++/ctor-10.C: New test. * testsuite/libgomp.c++/for-1.C: New test. * testsuite/libgomp.c++/for-2.C: New test. * testsuite/libgomp.c++/for-3.C: New test. * testsuite/libgomp.c++/for-4.C: New test. * testsuite/libgomp.c++/for-5.C: New test. * testsuite/libgomp.c++/loop-8.C: New test. * testsuite/libgomp.c++/loop-9.C: New test. * testsuite/libgomp.c++/loop-10.C: New test. * testsuite/libgomp.c++/task-1.C: New test. * testsuite/libgomp.c++/task-2.C: New test. * testsuite/libgomp.c++/task-3.C: New test. * testsuite/libgomp.c++/task-4.C: New test. * testsuite/libgomp.c++/task-5.C: New test. * testsuite/libgomp.c++/task-6.C: New test. * testsuite/libgomp.fortran/allocatable1.f90: New test. * testsuite/libgomp.fortran/allocatable2.f90: New test. * testsuite/libgomp.fortran/allocatable3.f90: New test. * testsuite/libgomp.fortran/allocatable4.f90: New test. * testsuite/libgomp.fortran/collapse1.f90: New test. * testsuite/libgomp.fortran/collapse2.f90: New test. * testsuite/libgomp.fortran/collapse3.f90: New test. * testsuite/libgomp.fortran/collapse4.f90: New test. * testsuite/libgomp.fortran/lastprivate1.f90: New test. * testsuite/libgomp.fortran/lastprivate2.f90: New test. * testsuite/libgomp.fortran/lib4.f90: New test. * testsuite/libgomp.fortran/lock-1.f90: New test. * testsuite/libgomp.fortran/lock-2.f90: New test. * testsuite/libgomp.fortran/nested1.f90: New test. * testsuite/libgomp.fortran/nestedfn4.f90: New test. * testsuite/libgomp.fortran/strassen.f90: New test. * testsuite/libgomp.fortran/tabs1.f90: New test. * testsuite/libgomp.fortran/tabs2.f: New test. * testsuite/libgomp.fortran/task1.f90: New test. * testsuite/libgomp.fortran/task2.f90: New test. * testsuite/libgomp.fortran/vla4.f90: Add dg-warning. * testsuite/libgomp.fortran/vla5.f90: Likewise. * testsuite/libgomp.c/pr26943-2.c: Likewise. * testsuite/libgomp.c/pr26943-3.c: Likewise. * testsuite/libgomp.c/pr26943-4.c: Likewise. Co-Authored-By: Jakob Blomer <jakob.blomer@ira.uka.de> Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Ulrich Drepper <drepper@redhat.com> From-SVN: r136433
2008-06-06 15:01:54 +02:00
extern tree begin_omp_task (void);
extern tree finish_omp_task (tree, tree);
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
extern tree finish_omp_for (location_t, enum tree_code,
tree, tree, tree, tree, tree,
gcc/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * builtin-types.def (BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR): Remove. (BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): New. * cgraph.h (enum cgraph_simd_clone_arg_type): Add SIMD_CLONE_ARG_TYPE_LINEAR_REF_VARIABLE_STEP, SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP. (struct cgraph_simd_clone_arg): Adjust comment. * omp-builtins.def (BUILT_IN_GOMP_TARGET): Rename GOMP_target_41 to GOMP_target_ext. Add num_teams and thread_limit arguments. (BUILT_IN_GOMP_TARGET_DATA): Rename GOMP_target_data_41 to GOMP_target_data_ext. (BUILT_IN_GOMP_TARGET_UPDATE): Rename GOMP_target_update_41 to GOMP_target_update_ext. (BUILT_IN_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START, BUILT_IN_GOMP_LOOP_NONMONOTONIC_GUIDED_START, BUILT_IN_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT, BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED): New built-ins. * tree-core.h (enum omp_clause_schedule_kind): Add OMP_CLAUSE_SCHEDULE_MASK, OMP_CLAUSE_SCHEDULE_MONOTONIC, OMP_CLAUSE_SCHEDULE_NONMONOTONIC and change OMP_CLAUSE_SCHEDULE_LAST value. * tree.def (OMP_SIMD, CILK_SIMD, CILK_FOR, OMP_DISTRIBUTE, OMP_TASKLOOP, OACC_LOOP): Add OMP_FOR_ORIG_DECLS argument. * tree.h (OMP_FOR_ORIG_DECLS): Use OMP_LOOP_CHECK instead of OMP_FOR_CHECK. Remove comment. * tree-pretty-print.c (dump_omp_clause): Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE and GOMP_MAP_ALWAYS_POINTER. Simplify. Print schedule clause modifiers. * tree-vect-stmts.c (vectorizable_simd_clone_call): Add SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_VARIABLE_STEP cases. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_ALWAYS_TO. (omp_default_clause): Tweak for private/firstprivate/is_device_ptr variables on target construct and use_device_ptr on target data. (omp_check_private): Likewise. (omp_notice_variable): For references check whether what it refers to has mappable type, rather than the reference itself. (omp_is_private): Diagnose linear iteration variables on non-simd constructs. (omp_no_lastprivate): Return true only for Fortran. (gimplify_scan_omp_clauses): Or in GOVD_MAP_ALWAYS_TO for GOMP_MAP_ALWAYS_TO or GOMP_MAP_ALWAYS_TOFROM kinds. Add support for GOMP_MAP_FIRSTPRIVATE_REFERENCE and GOMP_MAP_ALWAYS_POINTER, remove old handling of structure element based array sections. Use GOMP_MAP_ALWAYS_P. Fix up handling of lastprivate and linear when combined with distribute. Gimplify variable low-bound for array reduction. Look through POINTER_PLUS_EXPR when looking for ADDR_EXPR for array section reductions. (gimplify_adjust_omp_clauses_1): For implicit references to variables with reference type and when not ref to scalar or ref to pointer, map what they refer to using tofrom and use GOMP_MAP_FIRSTPRIVATE_REFERENCE for the reference. (gimplify_adjust_omp_clauses): Remove GOMP_MAP_ALWAYS_POINTER from target exit data. Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE. Drop OMP_CLAUSE_MAP_PRIVATE support. Use GOMP_MAP_ALWAYS_P. Diagnose the same var on both firstprivate and lastprivate on distribute construct. (gimplify_omp_for): Fix up handling of predetermined lastprivate or linear iter vars when combined with distribute. (find_omp_teams, computable_teams_clause, optimize_target_teams): New functions. (gimplify_omp_workshare): Call optimize_target_teams. * omp-low.c (struct omp_region): Add sched_modifiers field. (struct omp_for_data): Likewise. (omp_any_child_fn_dumped): New variable. (extract_omp_for_data): Fill in sched_modifiers, and mask out OMP_CLAUSE_SCHEDULE_KIND bits outside of OMP_CLAUSE_SCHEDULE_MASK from sched_kind. (determine_parallel_type): Use only OMP_CLAUSE_SCHEDULE_MASK bits of OMP_CLAUSE_SCHED_KIND. (scan_sharing_clauses): Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE, drop OMP_CLAUSE_MAP_PRIVATE support. Look through POINTER_PLUS_EXPR for array section reductions. (add_taskreg_looptemp_clauses): Add one extra _looptemp_ clause even for distribute parallel for, if there are lastprivate clauses on the for. (lower_rec_input_clauses): Handle non-zero low-bound on array section reductions. (lower_reduction_clauses): Likewise. (lower_send_clauses): Look through POINTER_PLUS_EXPR for array section reductions. (expand_parallel_call): Use nonmonotonic entrypoints for nonmonotonic: dynamic/guided. (expand_omp_taskreg): Call assign_assembler_name_if_neeeded on child_fn if current_function_decl has assembler name set, but child_fn does not. Dump the header and IL of the child function when not in SSA form. (expand_omp_target): Likewise. Pass num_teams and thread_limit arguments to BUILT_IN_GOMP_TARGET. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Initialize the extra _looptemp_ clause to fd->loop.n2. (expand_omp_for): Use nonmonotonic entrypoints for nonmonotonic: dynamic/guided. Initialize region->sched_modifiers. (expand_omp): Clear omp_any_child_fn_dumped. Dump function header again if we have dumped any child functions. (lower_omp_for_lastprivate): Determine the right count variable for distribute simd, or distribute parallel for{, simd}. (lower_omp_target): Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE and GOMP_MAP_ALWAYS_POINTER. Drop OMP_CLAUSE_MAP_PRIVATE support. (simd_clone_clauses_extract): Handle variable step for references and arguments passed by reference. (simd_clone_mangle): Mangle ref/uval/val variable steps. (simd_clone_adjust_argument_types): Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP. (simd_clone_linear_addend): New function. (simd_clone_adjust): Handle variable step like similarly to constant step, use simd_clone_linear_addend to determine the actual step at runtime. gcc/c-family/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> * c-common.h (c_finish_omp_atomic): Add TEST argument. (c_omp_check_loop_iv, c_omp_check_loop_iv_exprs): New prototypes. * c-omp.c (c_finish_omp_atomic): Add TEST argument. Don't call save_expr or create_tmp_var* if TEST is true. (c_finish_omp_for): Store OMP_FOR_ORIG_DECLS always. Don't call add_stmt here. (struct c_omp_check_loop_iv_data): New type. (c_omp_check_loop_iv_r, c_omp_check_loop_iv, c_omp_check_loop_iv_exprs): New functions. (c_omp_split_clauses): Adjust for lastprivate being allowed on distribute. (c_omp_declare_simd_clauses_to_numbers): Change OMP_CLAUSE_LINEAR_VARIABLE_STRIDE OMP_CLAUSE_LINEAR_STEP into numbers. (c_omp_declare_simd_clauses_to_decls): Similarly change those from numbers to PARM_DECLs. gcc/c/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * c-parser.c: Include context.h and gimple-expr.h. (c_parser_omp_clause_schedule): Parse schedule modifiers, diagnose monotonic together with nonmonotonic. (c_parser_omp_for_loop): Call c_omp_check_loop_iv. Call add_stmt here. (OMP_DISTRIBUTE_CLAUSE_MASK): Add lastprivate clause. (c_parser_omp_target_data, c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): Allow GOMP_MAP_ALWAYS_POINTER. (c_parser_omp_target): Likewise. Evaluate num_teams and thread_limit expressions on combined target teams before the target. (c_parser_omp_declare_target): If decl has "omp declare target" or "omp declare target link" attribute, and cgraph or varpool node already exists, then set corresponding flags. Call c_finish_omp_clauses in the parenthesized extended-list syntax case. * c-decl.c (c_decl_attributes): Don't diagnose block scope vars inside declare target. * c-typeck.c (handle_omp_array_sections_1): Allow non-zero low-bound on OMP_CLAUSE_REDUCTION array sections. (handle_omp_array_sections): Encode low-bound into the MEM_REF, either into the constant offset, or for variable low-bound using POINTER_PLUS_EXPR. For structure element based array sections use GOMP_MAP_ALWAYS_POINTER instead of GOMP_MAP_FIRSTPRIVATE_POINTER. (c_finish_omp_clauses): Drop generic_field_head, structure elements are now always mapped even as array section bases, diagnose same var in data sharing and mapping clauses. Diagnose if linear step on declare simd is neither a constant nor a uniform parameter. Look through POINTER_PLUS_EXPR for array section reductions. Diagnose the same var or function appearing multiple times on the same directive. Fix up wording for the to clause if t is neither a FUNCTION_DECL nor a VAR_DECL. Diagnose nonmonotonic modifier on kinds other than dynamic or guided or nonmonotonic modifier together with ordered clause. gcc/cp/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * cp-tree.h (finish_omp_for): Add ORIG_INITS argument. (omp_privatize_field): Add SHARED argument. * parser.c: Include context.h. (cp_parser_omp_clause_schedule): Parse schedule modifiers, diagnose monotonic together with nonmonotonic. (cp_parser_omp_clause_linear): Add DECLARE_SIMD argument. Parse parameter name as linear step as id-expression rather than expression. (cp_parser_omp_all_clauses): Adjust caller. (cp_parser_omp_for_loop_init): Add ORIG_INIT argument, initialize it. Adjust omp_privatize_field caller. (cp_parser_omp_for_loop): Compute orig_inits, pass it's address to finish_omp_for. (OMP_DISTRIBUTE_CLAUSE_MASK): Add lastprivate clause. (cp_parser_omp_target_data, cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): Allow GOMP_MAP_ALWAYS_POINTER and GOMP_MAP_FIRSTPRIVATE_REFERENCE. (cp_parser_omp_target): Likewise. Evaluate num_teams and thread_limit expressions on combined target teams before the target. (cp_parser_omp_declare_target): If decl has "omp declare target" or "omp declare target link" attribute, and cgraph or varpool node already exists, then set corresponding flags. Call finish_omp_clauses in the parenthesized extended-list syntax case. Call cp_parser_require_pragma_eol instead of cp_parser_skip_to_pragma_eol. (cp_parser_omp_end_declare_target): Call cp_parser_require_pragma_eol instead of cp_parser_skip_to_pragma_eol. * decl2.c (cplus_decl_attributes): Don't diagnose block scope vars inside declare target. * pt.c (tsubst_omp_clauses): If OMP_CLAUSE_LINEAR_VARIABLE_STRIDE, use tsubst_omp_clause_decl instead of tsubst_expr on OMP_CLAUSE_LINEAR_STEP. Handle non-static data members in shared clauses. (tsubst_omp_for_iterator): Adjust omp_privatize_field caller. (tsubst_find_omp_teams): New function. (tsubst_expr): Evaluate num_teams and thread_limit expressions on combined target teams before the target. Use OMP_FOR_ORIG_DECLS for all OpenMP/OpenACC/Cilk+ looping constructs. Adjust finish_omp_for caller. * semantics.c (omp_privatize_field): Add SHARED argument, if true, always create artificial var and never put it into the hash table or vector. (handle_omp_array_sections_1): Adjust omp_privatize_field caller. Allow non-zero low-bound on OMP_CLAUSE_REDUCTION array sections. (handle_omp_array_sections): For structure element based array sections use GOMP_MAP_ALWAYS_POINTER instead of GOMP_MAP_FIRSTPRIVATE_POINTER. Encode low-bound into the MEM_REF, either into the constant offset, or for variable low-bound using POINTER_PLUS_EXPR. (finish_omp_clauses): Adjust omp_privatize_field caller. Drop generic_field_head, structure elements are now always mapped even as array section bases, diagnose same var in data sharing and mapping clauses. For references map what they refer to using GOMP_MAP_ALWAYS_POINTER for structure elements and GOMP_MAP_FIRSTPRIVATE_REFERENCE otherwise. Diagnose if linear step on declare simd is neither a constant nor a uniform parameter. Allow non-static data members on shared clauses. Look through POINTER_PLUS_EXPR for array section reductions. Diagnose nonmonotonic modifier on kinds other than dynamic or guided or nonmonotonic modifier together with ordered clause. Diagnose the same var or function appearing multiple times on the same directive. Fix up wording for the to clause if t is neither a FUNCTION_DECL nor a VAR_DECL, use special wording for OVERLOADs and TEMPLATE_ID_EXPR. (handle_omp_for_class_iterator): Add ORIG_DECLS argument. Call c_omp_check_loop_iv_exprs on cond. (finish_omp_for): Add ORIG_INITS argument. Call c_omp_check_loop_iv_exprs on ORIG_INITS elements. Adjust handle_omp_for_class_iterator caller. Call c_omp_check_loop_iv. Call add_stmt. (finish_omp_atomic): Adjust c_finish_omp_atomic caller. gcc/fortran/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> * types.def (BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR): Remove. (BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): New. gcc/testsuite/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> * c-c++-common/gomp/clauses-2.c (foo): Adjust for diagnostics of variables in both data sharing and mapping clauses and for structure element based array sections being mapped rather than privatized. * c-c++-common/gomp/declare-target-2.c: Add various new tests. Adjust expected diagnostics wording in one case. * c-c++-common/gomp/distribute-1.c: New test. * c-c++-common/gomp/element-1.c: New test. * c-c++-common/gomp/pr61486-2.c: Add #pragma omp declare target and #pragma omp end declare target pair around the function. Change s from a parameter to a file scope variable. * c-c++-common/gomp/pr67521.c: Add dg-error directives. * c-c++-common/gomp/reduction-1.c (foo): Don't expect diagnostics on non-zero low-bound in reduction array sections. Add further tests. * c-c++-common/gomp/schedule-modifiers-1.c: New test. * c-c++-common/gomp/target-teams-1.c: New test. * gcc.dg/gomp/declare-simd-1.c: Add scan-assembler-times directives for expected mangling on x86_64/i?86. * gcc.dg/gomp/declare-simd-3.c: New test. * gcc.dg/gomp/declare-simd-4.c: New test. * gcc.dg/gomp/for-20.c: New test. * gcc.dg/gomp/for-21.c: New test. * gcc.dg/gomp/for-22.c: New test. * gcc.dg/gomp/for-23.c: New test. * gcc.dg/gomp/for-24.c: New test. * gcc.dg/gomp/linear-1.c: New test. * gcc.dg/gomp/loop-1.c: New test. * g++.dg/gomp/atomic-17.C: New test. * g++.dg/gomp/clause-1.C (T::test): Don't expect error on non-static data member in shared clause. Add single construct. * g++.dg/gomp/declare-simd-1.C: Add dg-options. Add scan-assembler-times directives for expected mangling on x86_64/i?86. * g++.dg/gomp/declare-simd-3.C: Likewise. * g++.dg/gomp/declare-simd-4.C: New test. * g++.dg/gomp/declare-simd-5.C: New test. * g++.dg/gomp/declare-target-1.C: New test. * g++.dg/gomp/linear-2.C: New test. * g++.dg/gomp/loop-1.C: New test. * g++.dg/gomp/loop-2.C: New test. * g++.dg/gomp/loop-3.C: New test. * g++.dg/gomp/member-2.C (B::m2, B::m4): Don't expect error on non-static data member in shared clause. * g++.dg/gomp/member-3.C: New test. * g++.dg/gomp/member-4.C: New test. * g++.dg/gomp/pr38639.C (foo): Adjust dg-error. (bar): Remove dg-message. * g++.dg/gomp/target-teams-1.C: New test. include/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * gomp-constants.h (GOMP_MAP_FLAG_SPECIAL_2): Define. (GOMP_MAP_FLAG_ALWAYS): Remove. (enum gomp_map_kind): Use GOMP_MAP_FLAG_SPECIAL_2 instead of GOMP_MAP_FLAG_ALWAYS for GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_RELEASE. Add GOMP_MAP_ALWAYS_POINTER and GOMP_MAP_FIRSTPRIVATE_REFERENCE. (GOMP_MAP_ALWAYS_P): Define. (GOMP_TARGET_FLAG_NOWAIT): Adjust comment. libgomp/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * libgomp_g.h (GOMP_loop_nonmonotonic_dynamic_next, GOMP_loop_nonmonotonic_dynamic_start, GOMP_loop_nonmonotonic_guided_next, GOMP_loop_nonmonotonic_guided_start, GOMP_loop_ull_nonmonotonic_dynamic_next, GOMP_loop_ull_nonmonotonic_dynamic_start, GOMP_loop_ull_nonmonotonic_guided_next, GOMP_loop_ull_nonmonotonic_guided_start, GOMP_parallel_loop_nonmonotonic_dynamic, GOMP_parallel_loop_nonmonotonic_guided): New prototypes. (GOMP_target_41): Renamed to ... (GOMP_target_ext): ... this. Add num_teams and thread_limit arguments. (GOMP_target_data_41): Renamed to ... (GOMP_target_data_ext): ... this. (GOMP_target_update_41): Renamed to ... (GOMP_target_update_ext): ... this. * libgomp.map (GOMP_4.5): Export GOMP_target_ext, GOMP_target_data_ext and GOMP_target_update_ext instead of GOMP_target_41, GOMP_target_data_41 and GOMP_target_update_41. Export GOMP_loop_nonmonotonic_dynamic_next, GOMP_loop_nonmonotonic_dynamic_start, GOMP_loop_nonmonotonic_guided_next, GOMP_loop_nonmonotonic_guided_start, GOMP_loop_ull_nonmonotonic_dynamic_next, GOMP_loop_ull_nonmonotonic_dynamic_start, GOMP_loop_ull_nonmonotonic_guided_next, GOMP_loop_ull_nonmonotonic_guided_start, GOMP_parallel_loop_nonmonotonic_dynamic and GOMP_parallel_loop_nonmonotonic_guided. * loop.c (GOMP_parallel_loop_nonmonotonic_dynamic, GOMP_parallel_loop_nonmonotonic_guided, GOMP_loop_nonmonotonic_dynamic_start, GOMP_loop_nonmonotonic_guided_start, GOMP_loop_nonmonotonic_dynamic_next, GOMP_loop_nonmonotonic_guided_next): New aliases or functions. * loop_ull.c (GOMP_loop_ull_nonmonotonic_dynamic_start, GOMP_loop_ull_nonmonotonic_guided_start, GOMP_loop_ull_nonmonotonic_dynamic_next, GOMP_loop_ull_nonmonotonic_guided_next): Likewise. * target.c (gomp_map_0len_lookup, gomp_map_val): New inline functions. (gomp_map_vars): Handle GOMP_MAP_ALWAYS_POINTER. For GOMP_MAP_ZERO_LEN_ARRAY_SECTION use gomp_map_0len_lookup. Use gomp_map_val function. (gomp_target_fallback_firstprivate): New static function. (GOMP_target_41): Renamed to ... (GOMP_target_ext): ... this. Add num_teams and thread_limit arguments. Move firstprivate fallback handling into a new function. (GOMP_target_data_41): Renamed to ... (GOMP_target_data_ext): ... this. (GOMP_target_update_41): Renamed to ... (GOMP_target_update_ext): ... this. (gomp_exit_data): For GOMP_MAP_*ZERO_LEN* use gomp_map_0len_lookup instead of gomp_map_lookup. (omp_target_is_present): Use gomp_map_0len_lookup instead of gomp_map_lookup. * testsuite/libgomp.c/target-28.c: Likewise. * testsuite/libgomp.c/monotonic-1.c: New test. * testsuite/libgomp.c/monotonic-2.c: New test. * testsuite/libgomp.c/nonmonotonic-1.c: New test. * testsuite/libgomp.c/nonmonotonic-2.c: New test. * testsuite/libgomp.c/pr66199-5.c: New test. * testsuite/libgomp.c/pr66199-6.c: New test. * testsuite/libgomp.c/pr66199-7.c: New test. * testsuite/libgomp.c/pr66199-8.c: New test. * testsuite/libgomp.c/pr66199-9.c: New test. * testsuite/libgomp.c/reduction-11.c: New test. * testsuite/libgomp.c/reduction-12.c: New test. * testsuite/libgomp.c/reduction-13.c: New test. * testsuite/libgomp.c/reduction-14.c: New test. * testsuite/libgomp.c/reduction-15.c: New test. * testsuite/libgomp.c/target-12.c (main): Adjust for omp_target_is_present change for one-past-last element. * testsuite/libgomp.c/target-17.c (foo): Drop tests where the same var is both mapped and privatized. * testsuite/libgomp.c/target-19.c (foo): Adjust for different handling of zero-length array sections. * testsuite/libgomp.c/target-28.c: New test. * testsuite/libgomp.c/target-29.c: New test. * testsuite/libgomp.c/target-30.c: New test. * testsuite/libgomp.c/target-teams-1.c: New test. * testsuite/libgomp.c++/member-6.C: New test. * testsuite/libgomp.c++/member-7.C: New test. * testsuite/libgomp.c++/monotonic-1.C: New test. * testsuite/libgomp.c++/monotonic-2.C: New test. * testsuite/libgomp.c++/nonmonotonic-1.C: New test. * testsuite/libgomp.c++/nonmonotonic-2.C: New test. * testsuite/libgomp.c++/pr66199-3.C: New test. * testsuite/libgomp.c++/pr66199-4.C: New test. * testsuite/libgomp.c++/pr66199-5.C: New test. * testsuite/libgomp.c++/pr66199-6.C: New test. * testsuite/libgomp.c++/pr66199-7.C: New test. * testsuite/libgomp.c++/pr66199-8.C: New test. * testsuite/libgomp.c++/pr66199-9.C: New test. * testsuite/libgomp.c++/reduction-11.C: New test. * testsuite/libgomp.c++/reduction-12.C: New test. * testsuite/libgomp.c++/target-13.C: New test. * testsuite/libgomp.c++/target-14.C: New test. * testsuite/libgomp.c++/target-15.C: New test. * testsuite/libgomp.c++/target-16.C: New test. * testsuite/libgomp.c++/target-17.C: New test. * testsuite/libgomp.c++/target-18.C: New test. * testsuite/libgomp.c++/target-19.C: New test. Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com> From-SVN: r229814
2015-11-05 16:08:08 +01:00
tree, tree, vec<tree> *, tree);
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * testsuite/libgomp.c/atomic-11.c: New test. * testsuite/libgomp.c/atomic-12.c: New test. * testsuite/libgomp.c/atomic-13.c: New test. * testsuite/libgomp.c/atomic-14.c: New test. * testsuite/libgomp.c/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
extern void finish_omp_atomic (enum tree_code, enum tree_code,
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
tree, tree, tree, tree, tree,
bool);
extern void finish_omp_barrier (void);
extern void finish_omp_flush (void);
c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. * langhooks.h (struct lang_hooks_for_decls): Add omp_finish_clause. Add omp_private_outer_ref hook, add another argument to omp_clause_default_ctor hook. * langhooks-def.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define. (LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define. (LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR): Change to hook_tree_tree_tree_tree_null. (LANG_HOOKS_DECLS): Add LANG_HOOKS_OMP_FINISH_CLAUSE and LANG_HOOKS_OMP_PRIVATE_OUTER_REF. * hooks.c (hook_tree_tree_tree_tree_null): New function. * hooks.h (hook_tree_tree_tree_tree_null): New prototype. * tree.def (OMP_TASK): New tree code. * tree.h (OMP_TASK_COPYFN, OMP_TASK_ARG_SIZE, OMP_TASK_ARG_ALIGN, OMP_CLAUSE_PRIVATE_OUTER_REF, OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_COLLAPSE_ITERVAR, OMP_CLAUSE_COLLAPSE_COUNT, OMP_TASKREG_CHECK, OMP_TASKREG_BODY, OMP_TASKREG_CLAUSES, OMP_TASKREG_FN, OMP_TASKREG_DATA_ARG, OMP_TASK_BODY, OMP_TASK_CLAUSES, OMP_TASK_FN, OMP_TASK_DATA_ARG, OMP_CLAUSE_COLLAPSE_EXPR): Define. (enum omp_clause_default_kind): Add OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. (OMP_DIRECTIVE_P): Add OMP_TASK. (OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): New clause codes. (OMP_CLAUSE_SCHEDULE_AUTO): New schedule kind. * tree.c (omp_clause_code_name): Add OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED entries. (omp_clause_num_ops): Likewise. Increase OMP_CLAUSE_LASTPRIVATE num_ops to 2. (walk_tree_1): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Walk OMP_CLAUSE_LASTPRIVATE_STMT. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_SCHEDULE_AUTO, OMP_CLAUSE_UNTIED, OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. (dump_generic_node): Handle OMP_TASK and collapsed OMP_FOR loops. * c-omp.c (c_finish_omp_for): Allow pointer iterators. Remove warning about unsigned iterators. Change decl/init/cond/incr arguments to TREE_VECs, check arguments for all collapsed loops. (c_finish_omp_taskwait): New function. (c_split_parallel_clauses): Put OMP_CLAUSE_COLLAPSE clause to ws_clauses. * c-parser.c (c_parser_omp_for_loop): Parse collapsed loops. Call default_function_array_conversion on init. Add par_clauses argument. If decl is present in parallel's lastprivate clause, change it to shared and add lastprivate clause for decl to OMP_FOR_CLAUSES. Add clauses argument, on success set OMP_FOR_CLAUSES to it. Look up collapse count in clauses. (c_parser_omp_for, c_parser_omp_parallel): Adjust c_parser_omp_for_loop callers. (OMP_FOR_CLAUSE_MASK): Add 1 << PRAGMA_OMP_CLAUSE_COLLAPSE. (c_parser_pragma): Handle PRAGMA_OMP_TASKWAIT. (c_parser_omp_clause_name): Handle collapse and untied clauses. (c_parser_omp_clause_collapse, c_parser_omp_clause_untied): New functions. (c_parser_omp_clause_schedule): Handle schedule(auto). Include correct location in the error message. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE and PRAGMA_OMP_CLAUSE_UNTIED. (OMP_TASK_CLAUSE_MASK): Define. (c_parser_omp_task, c_parser_omp_taskwait): New functions. (c_parser_omp_construct): Handle PRAGMA_OMP_TASK. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Handle OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_REDUCTION_INIT, OMP_CLAUSE_REDUCTION_MERGE, OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Don't handle TREE_STATIC or DECL_EXTERNAL VAR_DECLs in OMP_CLAUSE_DECL. (conver_nonlocal_reference, convert_local_reference, convert_call_expr): Handle OMP_TASK the same as OMP_PARALLEL. Use OMP_TASKREG_* macros rather than OMP_PARALLEL_*. (walk_omp_for): Adjust for OMP_FOR_{INIT,COND,INCR} changes. * tree-gimple.c (is_gimple_stmt): Handle OMP_TASK. * c-tree.h (c_begin_omp_task, c_finish_omp_task): New prototypes. * c-pragma.h (PRAGMA_OMP_TASK, PRAGMA_OMP_TASKWAIT): New. (PRAGMA_OMP_CLAUSE_COLLAPSE, PRAGMA_OMP_CLAUSE_UNTIED): New. * c-typeck.c (c_begin_omp_task, c_finish_omp_task): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. * c-pragma.c (init_pragma): Init omp task and omp taskwait pragmas. * c-common.h (c_finish_omp_taskwait): New prototype. * gimple-low.c (lower_stmt): Handle OMP_TASK. * tree-parloops.c (create_parallel_loop): Create 1 entry vectors for OMP_FOR_{INIT,COND,INCR}. * tree-cfg.c (remove_useless_stmts_1): Handle OMP_* containers. (make_edges): Handle OMP_TASK. * tree-ssa-operands.c (get_expr_operands): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. * tree-inline.c (estimate_num_insns_1): Handle OMP_TASK. * builtin-types.def (BT_PTR_ULONGLONG, BT_PTR_FN_VOID_PTR_PTR, BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New. * omp-builtins.def (BUILT_IN_GOMP_TASK, BUILT_IN_GOMP_TASKWAIT, BUILT_IN_GOMP_LOOP_ULL_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_STATIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_RUNTIME_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): New builtins. * gimplify.c (gimplify_omp_for): Allow pointer type for decl, handle POINTER_PLUS_EXPR. If loop counter has been replaced and original iterator is present in lastprivate clause or if collapse > 1, set OMP_CLAUSE_LASTPRIVATE_STMT. Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. (gimplify_expr): Handle OMP_SECTIONS_SWITCH and OMP_TASK. (enum gimplify_omp_var_data): Add GOVD_PRIVATE_OUTER_REF. (omp_notice_variable): Set GOVD_PRIVATE_OUTER_REF if needed, if it is set, lookup var in outer contexts too. Handle OMP_CLAUSE_DEFAULT_FIRSTPRIVATE. Handle vars that are supposed to be implicitly determined firstprivate for task regions. (gimplify_scan_omp_clauses): Set GOVD_PRIVATE_OUTER_REF if needed, if it is set, lookup var in outer contexts too. Set OMP_CLAUSE_PRIVATE_OUTER_REF if GOVD_PRIVATE_OUTER_REF is set. Handle OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Take region_type as last argument instead of in_parallel and in_combined_parallel. (gimplify_omp_parallel, gimplify_omp_for, gimplify_omp_workshare): Adjust callers. (gimplify_adjust_omp_clauses_1): Set OMP_CLAUSE_PRIVATE_OUTER_REF if GOVD_PRIVATE_OUTER_REF is set. Call omp_finish_clause langhook. (new_omp_context): Set default_kind to OMP_CLAUSE_DEFAULT_UNSPECIFIED for OMP_TASK regions. (omp_region_type): New enum. (struct gimplify_omp_ctx): Remove is_parallel and is_combined_parallel fields, add region_type. (new_omp_context): Take region_type as argument instead of is_parallel and is_combined_parallel. (gimple_add_tmp_var, omp_firstprivatize_variable, omp_notice_variable, omp_is_private, omp_check_private): Adjust ctx->is_parallel and ctx->is_combined_parallel checks. (gimplify_omp_task): New function. (gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. * omp-low.c (extract_omp_for_data): Use schedule(static) for schedule(auto). Handle pointer and unsigned iterators. Compute fd->iter_type. Handle POINTER_PLUS_EXPR increments. Add loops argument. Extract data for collapsed OMP_FOR loops. (expand_parallel_call): Assert sched_kind isn't auto, map runtime schedule to index 3. (struct omp_for_data_loop): New type. (struct omp_for_data): Remove v, n1, n2, step, cond_code fields. Add loop, loops, collapse and iter_type fields. (workshare_safe_to_combine_p): Disallow combined for if iter_type is unsigned long long. Don't combine collapse > 1 loops unless all bounds and steps are constant. Adjust extract_omp_for_data caller. (expand_omp_for_generic): Handle pointer, unsigned and long long iterators. Handle collapsed OMP_FOR loops. Adjust for struct omp_for_data changes. If libgomp function doesn't return boolean_type_node, add comparison of the return value with 0. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle pointer, unsigned and long long iterators. Adjust for struct omp_for_data changes. (expand_omp_for): Assert sched_kind isn't auto, map runtime schedule to index 3. Use GOMP_loop_ull*{start,next} if iter_type is unsigned long long. Allocate loops array, pass it to extract_omp_for_data. For collapse > 1 loops use always expand_omp_for_generic. (omp_context): Add sfield_map and srecord_type fields. (is_task_ctx, lookup_sfield): New functions. (use_pointer_for_field): Use is_task_ctx helper. Change first argument's type from const_tree to tree. Clarify comment. In OMP_TASK disallow copy-in/out sharing. (build_sender_ref): Call lookup_sfield instead of lookup_field. (install_var_field): Add mask argument. Populate both record_type and srecord_type if needed. (delete_omp_context): Destroy sfield_map, clear DECL_ABSTRACT_ORIGIN in srecord_type. (fixup_child_record_type): Also remap FIELD_DECL's DECL_SIZE{,_UNIT} and DECL_FIELD_OFFSET. (scan_sharing_clauses): Adjust install_var_field callers. For firstprivate clauses on explicit tasks allocate the var by value in record_type unconditionally, rather than by reference. Handle OMP_CLAUSE_PRIVATE_OUTER_REF. Scan OMP_CLAUSE_LASTPRIVATE_STMT. Use is_taskreg_ctx instead of is_parallel_ctx. Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. (create_omp_child_function_name): Add task_copy argument, use *_omp_cpyfn* names if it is true. (create_omp_child_function): Add task_copy argument, if true create *_omp_cpyfn* helper function. (scan_omp_parallel): Adjust create_omp_child_function callers. Rename parallel_nesting_level to taskreg_nesting_level. (scan_omp_task): New function. (lower_rec_input_clauses): Don't run constructors for firstprivate explicit task vars which are initialized by *_omp_cpyfn*. Pass outer var ref to omp_clause_default_ctor hook if OMP_CLAUSE_PRIVATE_OUTER_REF or OMP_CLAUSE_LASTPRIVATE. Replace OMP_CLAUSE_REDUCTION_PLACEHOLDER decls in OMP_CLAUSE_REDUCTION_INIT. (lower_send_clauses): Clear DECL_ABSTRACT_ORIGIN if in task to avoid duplicate setting of fields. Handle OMP_CLAUSE_PRIVATE_OUTER_REF. (lower_send_shared_vars): Use srecord_type if non-NULL. Don't copy-out if TREE_READONLY, only copy-in. (expand_task_copyfn): New function. (expand_task_call): New function. (struct omp_taskcopy_context): New type. (task_copyfn_copy_decl, task_copyfn_remap_type, create_task_copyfn): New functions. (lower_omp_parallel): Rename to... (lower_omp_taskreg): ... this. Use OMP_TASKREG_* macros where needed. Call create_task_copyfn if srecord_type is needed. Adjust sender_decl type. (task_shared_vars): New variable. (check_omp_nesting_restrictions): Warn if work-sharing, barrier, master or ordered region is closely nested inside OMP_TASK. Add warnings for barrier if closely nested inside of work-sharing, ordered, or master region. (scan_omp_1): Call check_omp_nesting_restrictions even for GOMP_barrier calls. Rename parallel_nesting_level to taskreg_nesting_level. Handle OMP_TASK. (lower_lastprivate_clauses): Even if some lastprivate is found on a work-sharing construct, continue looking for them on parent parallel construct. (lower_omp_for_lastprivate): Add lastprivate clauses to the beginning of dlist rather than end. Adjust for struct omp_for_data changes. (lower_omp_for): Add rec input clauses before OMP_FOR_PRE_BODY, not after it. Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes, adjust extract_omp_for_data caller. (get_ws_args_for): Adjust extract_omp_for_data caller. (scan_omp_for): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. (lower_omp_single_simple): If libgomp function doesn't return boolean_type_node, add comparison of the return value with 0. (diagnose_sb_1, diagnose_sb_2): Handle collapsed OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes. Handle OMP_TASK. (parallel_nesting_level): Rename to... (taskreg_nesting_level): ... this. (is_taskreg_ctx): New function. (build_outer_var_ref, omp_copy_decl): Use is_taskreg_ctx instead of is_parallel_ctx. (execute_lower_omp): Rename parallel_nesting_level to taskreg_nesting_level. (expand_omp_parallel): Rename to... (expand_omp_taskreg): ... this. Use OMP_TASKREG_* macros where needed. Call omp_task_call for OMP_TASK regions. (expand_omp): Adjust caller, handle OMP_TASK. (lower_omp_1): Adjust lower_omp_taskreg caller, handle OMP_TASK. * bitmap.c (bitmap_default_obstack_depth): New variable. (bitmap_obstack_initialize, bitmap_obstack_release): Do nothing if argument is NULL and bitmap_default_obstack is already initialized. * ipa-struct-reorg.c (do_reorg_1): Call bitmap_obstack_release at the end. * matrix-reorg.c (matrix_reorg): Likewise. cp/ * cp-tree.h (cxx_omp_finish_clause, cxx_omp_create_clause_info, dependent_omp_for_p, begin_omp_task, finish_omp_task, finish_omp_taskwait): New prototypes. (cxx_omp_clause_default_ctor): Add outer argument. (finish_omp_for): Add new clauses argument. * cp-gimplify.c (cxx_omp_finish_clause): New function. (cxx_omp_predetermined_sharing): Moved from semantics.c, rewritten. (cxx_omp_clause_default_ctor): Add outer argument. (cp_genericize_r): Walk OMP_CLAUSE_LASTPRIVATE_STMT. * cp-objcp-common.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define. * parser.c (cp_parser_omp_for_loop): Parse collapsed for loops. Add par_clauses argument. If decl is present in parallel's lastprivate clause, change that clause to shared and add a lastprivate clause for decl to OMP_FOR_CLAUSES. Fix wording of error messages. Adjust finish_omp_for caller. Add clauses argument. Parse loops with random access iterators. (cp_parser_omp_clause_collapse, cp_parser_omp_clause_untied): New functions. (cp_parser_omp_for, cp_parser_omp_parallel): Adjust cp_parser_omp_for_loop callers. (cp_parser_omp_for_cond, cp_parser_omp_for_incr): New helper functions. (cp_parser_omp_clause_name): Handle collapse and untied clauses. (cp_parser_omp_clause_schedule): Handle auto schedule. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE and PRAGMA_OMP_CLAUSE_UNTIED. (OMP_FOR_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_COLLAPSE. (OMP_TASK_CLAUSE_MASK): Define. (cp_parser_omp_task, cp_parser_omp_taskwait): New functions. (cp_parser_omp_construct): Handle PRAGMA_OMP_TASK. (cp_parser_pragma): Handle PRAGMA_OMP_TASK and PRAGMA_OMP_TASKWAIT. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED. Handle OMP_CLAUSE_LASTPRIVATE_STMT. (tsubst_omp_for_iterator): New function. (dependent_omp_for_p): New function. (tsubst_expr) <case OMP_FOR>: Use it. Handle collapsed OMP_FOR loops. Adjust finish_omp_for caller. Handle loops with random access iterators. Adjust for OMP_FOR_{INIT,COND,INCR} changes. (tsubst_expr): Handle OMP_TASK. * semantics.c (cxx_omp_create_clause_info): New function. (finish_omp_clauses): Call it. Handle OMP_CLAUSE_UNTIED and OMP_CLAUSE_COLLAPSE. (cxx_omp_predetermined_sharing): Removed. * semantics.c (finish_omp_for): Allow pointer iterators. Use handle_omp_for_class_iterator and dependent_omp_for_p. Handle collapsed for loops. Adjust c_finish_omp_for caller. Add new clauses argument. Fix check for type dependent cond or incr. Set OMP_FOR_CLAUSES to clauses. Use cp_convert instead of fold_convert to convert incr amount to difference_type. Only fold if not in template. If decl is mentioned in lastprivate clause, set OMP_CLAUSE_LASTPRIVATE_STMT. Handle loops with random access iterators. Adjust for OMP_FOR_{INIT,COND,INCR} changes. (finish_omp_threadprivate): Allow static class members of the current class. (handle_omp_for_class_iterator, begin_omp_task, finish_omp_task, finish_omp_taskwait): New functions. * parser.c (cp_parser_binary_expression): Add prec argument. (cp_parser_assignment_expression): Adjust caller. * cp-tree.h (outer_curly_brace_block): New prototype. * decl.c (outer_curly_brace_block): No longer static. fortran/ * scanner.c (skip_free_comments, skip_fixed_comments): Handle tabs. * parse.c (next_free): Allow tab after !$omp. (decode_omp_directive): Handle !$omp task, !$omp taskwait and !$omp end task. (case_executable): Add ST_OMP_TASKWAIT. (case_exec_markers): Add ST_OMP_TASK. (gfc_ascii_statement): Handle ST_OMP_TASK, ST_OMP_END_TASK and ST_OMP_TASKWAIT. (parse_omp_structured_block, parse_executable): Handle ST_OMP_TASK. * gfortran.h (gfc_find_sym_in_expr): New prototype. (gfc_statement): Add ST_OMP_TASK, ST_OMP_END_TASK and ST_OMP_TASKWAIT. (gfc_omp_clauses): Add OMP_SCHED_AUTO to sched_kind, OMP_DEFAULT_FIRSTPRIVATE to default_sharing. Add collapse and untied fields. (gfc_exec_op): Add EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * f95-lang.c (LANG_HOOKS_OMP_CLAUSE_COPY_CTOR, LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, LANG_HOOKS_OMP_CLAUSE_DTOR, LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define. * trans.h (gfc_omp_clause_default_ctor): Add another argument. (gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op, gfc_omp_clause_dtor, gfc_omp_private_outer_ref): New prototypes. * types.def (BT_ULONGLONG, BT_PTR_ULONGLONG, BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR, BT_FN_VOID_PTR_PTR, BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New. (BT_BOOL): Use integer type with BOOL_TYPE_SIZE rather than boolean_type_node. * dump-parse-tree.c (gfc_show_omp_node): Handle EXEC_OMP_TASK, EXEC_OMP_TASKWAIT, OMP_SCHED_AUTO, OMP_DEFAULT_FIRSTPRIVATE, untied and collapse clauses. (gfc_show_code_node): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * trans.c (gfc_trans_code): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. * st.c (gfc_free_statement): Likewise. * resolve.c (gfc_resolve_blocks, resolve_code): Likewise. (find_sym_in_expr): Rename to... (gfc_find_sym_in_expr): ... this. No longer static. (resolve_allocate_expr, resolve_ordinary_assign): Adjust caller. * match.h (gfc_match_omp_task, gfc_match_omp_taskwait): New prototypes. * openmp.c (resolve_omp_clauses): Allow allocatable arrays in firstprivate, lastprivate, reduction, copyprivate and copyin clauses. (omp_current_do_code): Made static. (omp_current_do_collapse): New variable. (gfc_resolve_omp_do_blocks): Compute omp_current_do_collapse, clear omp_current_do_code and omp_current_do_collapse on return. (gfc_resolve_do_iterator): Handle collapsed do loops. (resolve_omp_do): Likewise, diagnose errorneous collapsed do loops. (OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): Define. (gfc_match_omp_clauses): Handle default (firstprivate), schedule (auto), untied and collapse (n) clauses. (OMP_DO_CLAUSES): Add OMP_CLAUSE_COLLAPSE. (OMP_TASK_CLAUSES): Define. (gfc_match_omp_task, gfc_match_omp_taskwait): New functions. * trans-openmp.c (gfc_omp_private_outer_ref): New function. (gfc_omp_clause_default_ctor): Add outer argument. For allocatable arrays allocate them with the bounds of the outer var if outer var is allocated. (gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op, gfc_omp_clause_dtor): New functions. (gfc_trans_omp_array_reduction): If decl is allocatable array, allocate it with outer var's bounds in OMP_CLAUSE_REDUCTION_INIT and deallocate it in OMP_CLAUSE_REDUCTION_MERGE. (gfc_omp_predetermined_sharing): Return OMP_CLAUSE_DEFAULT_SHARED for assumed-size arrays. (gfc_trans_omp_do): Add par_clauses argument. If dovar is present in lastprivate clause and do loop isn't simple, set OMP_CLAUSE_LASTPRIVATE_STMT. If dovar is present in parallel's lastprivate clause, change it to shared and add lastprivate clause to OMP_FOR_CLAUSES. Handle collapsed do loops. (gfc_trans_omp_directive): Adjust gfc_trans_omp_do callers. (gfc_trans_omp_parallel_do): Likewise. Move collapse clause to OMP_FOR from OMP_PARALLEL. (gfc_trans_omp_clauses): Handle OMP_SCHED_AUTO, OMP_DEFAULT_FIRSTPRIVATE, untied and collapse clauses. (gfc_trans_omp_task, gfc_trans_omp_taskwait): New functions. (gfc_trans_omp_directive): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT. gcc/testsuite/ * gcc.dg/gomp/collapse-1.c: New test. * gcc.dg/gomp/nesting-1.c: New test. * g++.dg/gomp/task-1.C: New test. * g++.dg/gomp/predetermined-1.C: New test. * g++.dg/gomp/tls-4.C: New test. * gfortran.dg/gomp/collapse1.f90: New test. * gfortran.dg/gomp/sharing-3.f90: New test. * gcc.dg/gomp/pr27499.c (foo): Remove is unsigned dg-warning. * g++.dg/gomp/pr27499.C (foo): Likewise. * g++.dg/gomp/for-16.C (foo): Likewise. * g++.dg/gomp/tls-3.C: Remove dg-error, add S::s definition. * g++.dg/gomp/pr34607.C: Adjust dg-error location. * g++.dg/gomp/for-16.C (foo): Add a new dg-error. * gcc.dg/gomp/appendix-a/a.35.4.c: Add dg-warning. * gcc.dg/gomp/appendix-a/a.35.6.c: Likewise. * gfortran.dg/gomp/appendix-a/a.35.4.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise. * gfortran.dg/gomp/omp_parse1.f90: Remove !$omp tab test. * gfortran.dg/gomp/appendix-a/a.33.4.f90: Remove dg-error about allocatable array. * gfortran.dg/gomp/reduction1.f90: Likewise. libgomp/ * configure.ac (LIBGOMP_GNU_SYMBOL_VERSIONING): New AC_DEFINE. Substitute also OMP_*LOCK_25*. * configure: Regenerated. * config.h.in: Regenerated. * Makefile.am (libgomp_la_SOURCES): Add loop_ull.c, iter_ull.c, ptrlock.c and task.c. * Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * task.c: New file. * loop_ull.c: New file. * iter_ull.c: New file. * libgomp.h: Include ptrlock.h. (enum gomp_task_kind): New type. (struct gomp_team): Add task_lock, task_queue, task_count, task_running_count, single_count fields. Add work_share_list_free_lock ifndef HAVE_SYNC_BUILTINS. Remove work_share_lock, generation_mask, oldest_live_gen, num_live_gen and init_work_shares fields, add work work_share_list_alloc, work_share_list_free and work_share_chunk fields. Change work_shares from pointer to pointers into an array. Change ordered_release field into gomp_sem_t ** from flexible array member. Add implicit_task and initial_work_shares fields. Move close to the end of the struct. (struct gomp_team_state): Add single_count, last_work_share, active_level and level fields, remove work_share_generation. (gomp_barrier_handle_tasks): New prototype. (gomp_finish_task): New inline function. (struct gomp_work_share): Move chunk_size, end, incr into transparent union/struct, add chunk_size_ull, end_ll, incr_ll and next_ll fields. Reshuffle fields. Add next_alloc, next_ws, next_free and inline_ordered_team_ids fields, change ordered_team_ids into pointer from flexible array member. Add mode field. Put lock and next into a different cache line from most of the write-once fields. (gomp_iter_ull_static_next, gomp_iter_ull_dynamic_next_locked, gomp_iter_ull_guided_next_locked, gomp_iter_ull_dynamic_next, gomp_iter_ull_guided_next): New prototypes. (gomp_new_icv): New prototype. (struct gomp_thread): Add thread_pool and task fields. (struct gomp_thread_pool): New type. (gomp_new_team): New prototype. (gomp_team_start): Change type of last argument. (gomp_new_work_share): Removed. (gomp_init_work_share, gomp_fini_work_share): New prototypes. (gomp_work_share_init_done): New static inline. (gomp_throttled_spin_count_var, gomp_available_cpus, gomp_managed_threads): New extern decls. (gomp_init_task): New prototype. (gomp_spin_count_var): New extern var decl. (LIBGOMP_GNU_SYMBOL_VERSIONING): Undef if no visibility or no alias support, or if not PIC. (gomp_init_lock_30, gomp_destroy_lock_30, gomp_set_lock_30, gomp_unset_lock_30, gomp_test_lock_30, gomp_init_nest_lock_30, gomp_destroy_nest_lock_30, gomp_set_nest_lock_30, gomp_unset_nest_lock_30, gomp_test_nest_lock_30, gomp_init_lock_25, gomp_destroy_lock_25, gomp_set_lock_25, gomp_unset_lock_25, gomp_test_lock_25, gomp_init_nest_lock_25, gomp_destroy_nest_lock_25, gomp_set_nest_lock_25, gomp_unset_nest_lock_25, gomp_test_nest_lock_25): New prototypes. (omp_lock_symver, strong_alias): Define. (gomp_remaining_threads_count, gomp_remaining_threads_lock): New decls. (gomp_end_task): New. (struct gomp_task_icv, gomp_global_icv): New. (gomp_thread_limit_var, gomp_max_active_levels_var): New. (struct gomp_task): New. (gomp_nthreads_var, gomp_dyn_var, gomp_nest_var, gomp_run_sched_var, gomp_run_sched_chunk): Remove. (gomp_icv): New. (gomp_schedule_type): Reorder enum to match omp_sched_t. * team.c (struct gomp_thread_start_data): Add thread_pool and task fields. (gomp_thread_start): Add gomp_team_barrier_wait call. For non-nested case remove clearing of docked thread thr fields. Use pool fields instead of global gomp_* variables. Use gomp_barrier_wait_last when needed. Initialize ts.active_level. Create tasks for each member thread. (free_team): Only destroy team barrier, task_lock here and free it. (gomp_free_thread): Free last_team if non-NULL. (gomp_team_end): Call gomp_team_barrier_wait instead of gomp_barrier_wait. For nested case call one extra gomp_barrier_wait. Move here some destruction from free_team. Call free_team on pool->last_team if any, rather than freeing current team. Destroy work_share_list_free_lock ifndef HAVE_SYNC_BUILTINS. (gomp_new_icv): New function. (gomp_threads, gomp_threads_size, gomp_threads_used, gomp_threads_dock): Removed. (gomp_thread_destructor): New variable. (gomp_new_thread_pool, gomp_free_pool_helper, gomp_free_thread): New functions. (gomp_team_start): Create new pool if current thread doesn't have one. Use pool fields instead of global gomp_* variables. Initialize thread_pool field for new threads. Clear single_count. Change last argument from ws to team, don't create new team, set ts.work_share to &team->work_shares[0] and clear ts.last_work_share. Don't clear ts.work_share_generation. If number of threads changed, adjust atomically gomp_managed_threads. Use gomp_init_task instead of gomp_new_task, set thr->task to the corresponding implicit_task array entry. Create tasks for each member thread. Initialize ts.level. (initialize_team): Call pthread_key_create on gomp_thread_destructor. (team_destructor): New function. (new_team): Removed. (gomp_new_team): New function. (free_team): Free gomp_work_share blocks chained through next_alloc, instead of freeing work_shares and destroying work_share_lock. (gomp_team_end): Call gomp_fini_work_share. If number of threads changed, adjust atomically gomp_managed_threads. Use gomp_end_task. * barrier.c (GOMP_barrier): Call gomp_team_barrier_wait instead of gomp_barrier_wait. * single.c (GOMP_single_copy_start): Call gomp_team_barrier_wait instead of gomp_barrier_wait. Call gomp_work_share_init_done if gomp_work_share_start returned true. Don't unlock ws->lock. (GOMP_single_copy_end): Call gomp_team_barrier_wait instead of gomp_barrier_wait. (GOMP_single_start): Rewritten if HAVE_SYNC_BUILTINS. Call gomp_work_share_init_done if gomp_work_share_start returned true. Don't unlock ws->lock. * work.c: Include stddef.h. (free_work_share): Use work_share_list_free_lock instead of atomic chaining ifndef HAVE_SYNC_BUILTINS. Add team argument. Call gomp_fini_work_share and then either free ws if orphaned, or put it into work_share_list_free list of the current team. (alloc_work_share, gomp_init_work_share, gomp_fini_work_share): New functions. (gomp_work_share_start, gomp_work_share_end, gomp_work_share_end_nowait): Rewritten. * omp_lib.f90.in Change some tabs to spaces to prevent warnings. (openmp_version): Set to 200805. (omp_sched_kind, omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): New parameters. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New interfaces. * omp_lib.h.in (openmp_version): Set to 200805. (omp_sched_kind, omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): New parameters. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New externals. * loop.c: Include limits.h. (GOMP_loop_runtime_next, GOMP_loop_ordered_runtime_next): Handle GFS_AUTO. (GOMP_loop_runtime_start, GOMP_loop_ordered_runtime_start): Likewise. Use gomp_icv. (gomp_loop_static_start, gomp_loop_dynamic_start): Clear ts.static_trip here. (gomp_loop_static_start, gomp_loop_ordered_static_start): Call gomp_work_share_init_done after gomp_loop_init. Don't unlock ws->lock. (gomp_loop_dynamic_start, gomp_loop_guided_start): Call gomp_work_share_init_done after gomp_loop_init. If HAVE_SYNC_BUILTINS, don't unlock ws->lock, otherwise lock it. (gomp_loop_ordered_dynamic_start, gomp_loop_ordered_guided_start): Call gomp_work_share_init_done after gomp_loop_init. Lock ws->lock. (gomp_parallel_loop_start): Call gomp_new_team instead of gomp_new_work_share. Call gomp_loop_init on &team->work_shares[0]. Adjust gomp_team_start caller. Pass 0 as second argument to gomp_resolve_num_threads. (gomp_loop_init): For GFS_DYNAMIC, multiply ws->chunk_size by incr. If adding ws->chunk_size nthreads + 1 times after end won't overflow, set ws->mode to 1. * libgomp_g.h (GOMP_loop_ull_static_start, GOMP_loop_ull_dynamic_start, GOMP_loop_ull_guided_start, GOMP_loop_ull_runtime_start, GOMP_loop_ull_ordered_static_start, GOMP_loop_ull_ordered_dynamic_start, GOMP_loop_ull_ordered_guided_start, GOMP_loop_ull_ordered_runtime_start, GOMP_loop_ull_static_next, GOMP_loop_ull_dynamic_next, GOMP_loop_ull_guided_next, GOMP_loop_ull_runtime_next, GOMP_loop_ull_ordered_static_next, GOMP_loop_ull_ordered_dynamic_next, GOMP_loop_ull_ordered_guided_next, GOMP_loop_ull_ordered_runtime_next, GOMP_task, GOMP_taskwait): New prototypes. * libgomp.map: Export lock routines also @@OMP_2.0. (GOMP_loop_ordered_dynamic_first, GOMP_loop_ordered_guided_first, GOMP_loop_ordered_runtime_first, GOMP_loop_ordered_static_first): Remove. (GOMP_loop_ull_dynamic_next, GOMP_loop_ull_dynamic_start, GOMP_loop_ull_guided_next, GOMP_loop_ull_guided_start, GOMP_loop_ull_ordered_dynamic_next, GOMP_loop_ull_ordered_dynamic_start, GOMP_loop_ull_ordered_guided_next, GOMP_loop_ull_ordered_guided_start, GOMP_loop_ull_ordered_runtime_next, GOMP_loop_ull_ordered_runtime_start, GOMP_loop_ull_ordered_static_next, GOMP_loop_ull_ordered_static_start, GOMP_loop_ull_runtime_next, GOMP_loop_ull_runtime_start, GOMP_loop_ull_static_next, GOMP_loop_ull_static_start, GOMP_task, GOMP_taskwait): Export @@GOMP_2.0. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_, omp_set_max_active_levels_, omp_set_max_active_levels_8_, omp_get_max_active_levels_, omp_get_level_, omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_, omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_): New exports @@OMP_3.0. * omp.h.in (omp_sched_t): New type. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New prototypes. * env.c (gomp_spin_count_var, gomp_throttled_spin_count_var, gomp_available_cpus, gomp_managed_threads, gomp_max_active_levels_var, gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): New variables. (parse_spincount): New function. (initialize_env): Call gomp_init_num_threads unconditionally. Initialize gomp_available_cpus. Call parse_spincount, initialize gomp_{,throttled_}spin_count_var depending on presence and value of OMP_WAIT_POLICY and GOMP_SPINCOUNT env vars. Handle GOMP_BLOCKTIME env var. Handle OMP_WAIT_POLICY, OMP_MAX_ACTIVE_LEVELS, OMP_THREAD_LIMIT, OMP_STACKSIZE env vars. Handle unit specification for GOMP_STACKSIZE. Initialize gomp_remaining_threads_count and gomp_remaining_threads_lock if needed. Use gomp_global_icv. (gomp_nthreads_var, gomp_dyn_var, gomp_nest_var, gomp_run_sched_var, gomp_run_sched_chunk): Remove. (gomp_global_icv): New. (parse_schedule): Use it. Parse "auto". (omp_set_num_threads): Use gomp_icv. (omp_set_dynamic, omp_get_dynamic, omp_set_nested, omp_get_nested): Likewise. (omp_get_max_threads): Move from parallel.c. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels): New functions, add ialias. (parse_stacksize, parse_wait_policy): New functions. * fortran.c: Rewrite lock wrappers, if symbol versioning provide both wrappers for compatibility and new locks. (omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New ialias_redirect. (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_, omp_set_max_active_levels_, omp_set_max_active_levels_8_, omp_get_max_active_levels_, omp_get_level_, omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_, omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_): New functions. * parallel.c: Include limits.h. (gomp_resolve_num_threads): Add count argument. Rewritten. (GOMP_parallel_start): Call gomp_new_team and pass that as last argument to gomp_team_start. Pass 0 as second argument to gomp_resolve_num_threads. (GOMP_parallel_end): Decrease gomp_remaining_threads_count if gomp_thread_limit_var != ULONG_MAX. (omp_in_parallel): Implement using ts.active_level. (omp_get_max_threads): Move to env.c. (omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level): New functions, add ialias. * sections.c (GOMP_sections_start): Call gomp_work_share_init_done after gomp_sections_init. If HAVE_SYNC_BUILTINS, call gomp_iter_dynamic_next instead of the _locked variant and don't take lock around it, otherwise acquire it before calling gomp_iter_dynamic_next_locked. (GOMP_sections_next): If HAVE_SYNC_BUILTINS, call gomp_iter_dynamic_next instead of the _locked variant and don't take lock around it. (GOMP_parallel_sections_start): Call gomp_new_team instead of gomp_new_work_share. Call gomp_sections_init on &team->work_shares[0]. Adjust gomp_team_start caller. Pass count as second argument to gomp_resolve_num_threads, don't adjust num_threads after the call. Use gomp_icv. * iter.c (gomp_iter_dynamic_next_locked): Don't multiply ws->chunk_size by incr. (gomp_iter_dynamic_next): Likewise. If ws->mode, use more efficient code. * libgomp_f.h.in (omp_lock_25_arg_t, omp_nest_lock_25_arg_t): New types. (omp_lock_25_arg, omp_nest_lock_25_arg): New macros. (omp_check_defines): Check even the compat defines. * config/linux/ptrlock.c: New file. * config/linux/ptrlock.h: New file. * config/linux/wait.h: New file. * config/posix/ptrlock.c: New file. * config/posix/ptrlock.h: New file. * config/linux/bar.h (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes. (gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): New inlines. (gomp_barrier_t): Rewritten. (gomp_barrier_state_t): New typedef. (gomp_barrier_init, gomp_barrier_reinit, gomp_barrier_destroy, gomp_barrier_wait_start): Rewritten. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_barrier_last_thread, gomp_barrier_wait_last): New static inlines. * config/linux/bar.c: Include wait.h instead of libgomp.h and futex.h. (gomp_barrier_wait_end): Rewritten. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake, gomp_barrier_wait_last): New functions. * config/posix/bar.h (gomp_barrier_t): Add generation field. (gomp_barrier_state_t): New typedef. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes. (gomp_barrier_wait_start): Or all but low 2 bits from generation into the return value. Return gomp_barrier_state_t. (gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): New inlines. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_barrier_last_thread, gomp_barrier_wait_last): New static inlines. * config/posix/bar.c (gomp_barrier_init): Clear generation field. (gomp_barrier_wait_end): Change second argument to gomp_barrier_state_t. (gomp_team_barrier_wait, gomp_team_barrier_wait_end, gomp_team_barrier_wake): New functions. * config/linux/mutex.c: Include wait.h instead of libgomp.h and futex.h. (gomp_futex_wake, gomp_futex_wait): New variables. (gomp_mutex_lock_slow): Call do_wait instead of futex_wait. * config/linux/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. Include wait.h instead of libgomp.h and futex.h. (gomp_set_nest_lock_25): Call do_wait instead of futex_wait. * config/posix95/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. * config/posix/lock.c: Rewrite to make locks task owned, for backwards compatibility provide the old entrypoints if symbol versioning. * config/linux/proc.c (gomp_init_num_threads): Use gomp_global_icv. (get_num_procs, gomp_dynamic_max_threads): Use gomp_icv. * config/posix/proc.c, config/mingw32/proc.c: Similarly. * config/linux/powerpc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/alpha/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/x86/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/s390/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/ia64/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/sparc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove. (sys_futex0): Return error code. (futex_wake, futex_wait): If ENOSYS was returned, clear FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry. (cpu_relax, atomic_write_barrier): New static inlines. * config/linux/sem.c: Include wait.h instead of libgomp.h and futex.h. (gomp_sem_wait_slow): Call do_wait instead of futex_wait. * config/linux/affinity.c: Assume HAVE_SYNC_BUILTINS. * config/linux/omp-lock.h (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_nest_lock_t): Change owner into void *, add lock field. * config/posix95/omp-lock.h: Include semaphore.h. (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_lock_t): Use sem_t instead of mutex if semaphores aren't broken. (omp_nest_lock_t): Likewise. Change owner to void *. * config/posix/omp-lock.h: Include semaphore.h. (omp_lock_25_t, omp_nest_lock_25_t): New types. (omp_lock_t): Use sem_t instead of mutex if semaphores aren't broken. (omp_nest_lock_t): Likewise. Add owner field. * testsuite/libgomp.c/collapse-1.c: New test. * testsuite/libgomp.c/collapse-2.c: New test. * testsuite/libgomp.c/collapse-3.c: New test. * testsuite/libgomp.c/icv-1.c: New test. * testsuite/libgomp.c/icv-2.c: New test. * testsuite/libgomp.c/lib-2.c: New test. * testsuite/libgomp.c/lock-1.c: New test. * testsuite/libgomp.c/lock-2.c: New test. * testsuite/libgomp.c/lock-3.c: New test. * testsuite/libgomp.c/loop-4.c: New test. * testsuite/libgomp.c/loop-5.c: New test. * testsuite/libgomp.c/loop-6.c: New test. * testsuite/libgomp.c/loop-7.c: New test. * testsuite/libgomp.c/loop-8.c: New test. * testsuite/libgomp.c/loop-9.c: New test. * testsuite/libgomp.c/nested-3.c: New test. * testsuite/libgomp.c/nestedfn-6.c: New test. * testsuite/libgomp.c/sort-1.c: New test. * testsuite/libgomp.c/task-1.c: New test. * testsuite/libgomp.c/task-2.c: New test. * testsuite/libgomp.c/task-3.c: New test. * testsuite/libgomp.c/task-4.c: New test. * testsuite/libgomp.c++/c++.exp: Add libstdc++-v3 build includes to C++ testsuite default compiler options. * testsuite/libgomp.c++/collapse-1.C: New test. * testsuite/libgomp.c++/collapse-2.C: New test. * testsuite/libgomp.c++/ctor-10.C: New test. * testsuite/libgomp.c++/for-1.C: New test. * testsuite/libgomp.c++/for-2.C: New test. * testsuite/libgomp.c++/for-3.C: New test. * testsuite/libgomp.c++/for-4.C: New test. * testsuite/libgomp.c++/for-5.C: New test. * testsuite/libgomp.c++/loop-8.C: New test. * testsuite/libgomp.c++/loop-9.C: New test. * testsuite/libgomp.c++/loop-10.C: New test. * testsuite/libgomp.c++/task-1.C: New test. * testsuite/libgomp.c++/task-2.C: New test. * testsuite/libgomp.c++/task-3.C: New test. * testsuite/libgomp.c++/task-4.C: New test. * testsuite/libgomp.c++/task-5.C: New test. * testsuite/libgomp.c++/task-6.C: New test. * testsuite/libgomp.fortran/allocatable1.f90: New test. * testsuite/libgomp.fortran/allocatable2.f90: New test. * testsuite/libgomp.fortran/allocatable3.f90: New test. * testsuite/libgomp.fortran/allocatable4.f90: New test. * testsuite/libgomp.fortran/collapse1.f90: New test. * testsuite/libgomp.fortran/collapse2.f90: New test. * testsuite/libgomp.fortran/collapse3.f90: New test. * testsuite/libgomp.fortran/collapse4.f90: New test. * testsuite/libgomp.fortran/lastprivate1.f90: New test. * testsuite/libgomp.fortran/lastprivate2.f90: New test. * testsuite/libgomp.fortran/lib4.f90: New test. * testsuite/libgomp.fortran/lock-1.f90: New test. * testsuite/libgomp.fortran/lock-2.f90: New test. * testsuite/libgomp.fortran/nested1.f90: New test. * testsuite/libgomp.fortran/nestedfn4.f90: New test. * testsuite/libgomp.fortran/strassen.f90: New test. * testsuite/libgomp.fortran/tabs1.f90: New test. * testsuite/libgomp.fortran/tabs2.f: New test. * testsuite/libgomp.fortran/task1.f90: New test. * testsuite/libgomp.fortran/task2.f90: New test. * testsuite/libgomp.fortran/vla4.f90: Add dg-warning. * testsuite/libgomp.fortran/vla5.f90: Likewise. * testsuite/libgomp.c/pr26943-2.c: Likewise. * testsuite/libgomp.c/pr26943-3.c: Likewise. * testsuite/libgomp.c/pr26943-4.c: Likewise. Co-Authored-By: Jakob Blomer <jakob.blomer@ira.uka.de> Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Ulrich Drepper <drepper@redhat.com> From-SVN: r136433
2008-06-06 15:01:54 +02:00
extern void finish_omp_taskwait (void);
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
extern void finish_omp_taskyield (void);
extern void finish_omp_cancel (tree);
extern void finish_omp_cancellation_point (tree);
gcc/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * builtin-types.def (BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR): Remove. (BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): New. * cgraph.h (enum cgraph_simd_clone_arg_type): Add SIMD_CLONE_ARG_TYPE_LINEAR_REF_VARIABLE_STEP, SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP. (struct cgraph_simd_clone_arg): Adjust comment. * omp-builtins.def (BUILT_IN_GOMP_TARGET): Rename GOMP_target_41 to GOMP_target_ext. Add num_teams and thread_limit arguments. (BUILT_IN_GOMP_TARGET_DATA): Rename GOMP_target_data_41 to GOMP_target_data_ext. (BUILT_IN_GOMP_TARGET_UPDATE): Rename GOMP_target_update_41 to GOMP_target_update_ext. (BUILT_IN_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START, BUILT_IN_GOMP_LOOP_NONMONOTONIC_GUIDED_START, BUILT_IN_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT, BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED): New built-ins. * tree-core.h (enum omp_clause_schedule_kind): Add OMP_CLAUSE_SCHEDULE_MASK, OMP_CLAUSE_SCHEDULE_MONOTONIC, OMP_CLAUSE_SCHEDULE_NONMONOTONIC and change OMP_CLAUSE_SCHEDULE_LAST value. * tree.def (OMP_SIMD, CILK_SIMD, CILK_FOR, OMP_DISTRIBUTE, OMP_TASKLOOP, OACC_LOOP): Add OMP_FOR_ORIG_DECLS argument. * tree.h (OMP_FOR_ORIG_DECLS): Use OMP_LOOP_CHECK instead of OMP_FOR_CHECK. Remove comment. * tree-pretty-print.c (dump_omp_clause): Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE and GOMP_MAP_ALWAYS_POINTER. Simplify. Print schedule clause modifiers. * tree-vect-stmts.c (vectorizable_simd_clone_call): Add SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_VARIABLE_STEP cases. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_ALWAYS_TO. (omp_default_clause): Tweak for private/firstprivate/is_device_ptr variables on target construct and use_device_ptr on target data. (omp_check_private): Likewise. (omp_notice_variable): For references check whether what it refers to has mappable type, rather than the reference itself. (omp_is_private): Diagnose linear iteration variables on non-simd constructs. (omp_no_lastprivate): Return true only for Fortran. (gimplify_scan_omp_clauses): Or in GOVD_MAP_ALWAYS_TO for GOMP_MAP_ALWAYS_TO or GOMP_MAP_ALWAYS_TOFROM kinds. Add support for GOMP_MAP_FIRSTPRIVATE_REFERENCE and GOMP_MAP_ALWAYS_POINTER, remove old handling of structure element based array sections. Use GOMP_MAP_ALWAYS_P. Fix up handling of lastprivate and linear when combined with distribute. Gimplify variable low-bound for array reduction. Look through POINTER_PLUS_EXPR when looking for ADDR_EXPR for array section reductions. (gimplify_adjust_omp_clauses_1): For implicit references to variables with reference type and when not ref to scalar or ref to pointer, map what they refer to using tofrom and use GOMP_MAP_FIRSTPRIVATE_REFERENCE for the reference. (gimplify_adjust_omp_clauses): Remove GOMP_MAP_ALWAYS_POINTER from target exit data. Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE. Drop OMP_CLAUSE_MAP_PRIVATE support. Use GOMP_MAP_ALWAYS_P. Diagnose the same var on both firstprivate and lastprivate on distribute construct. (gimplify_omp_for): Fix up handling of predetermined lastprivate or linear iter vars when combined with distribute. (find_omp_teams, computable_teams_clause, optimize_target_teams): New functions. (gimplify_omp_workshare): Call optimize_target_teams. * omp-low.c (struct omp_region): Add sched_modifiers field. (struct omp_for_data): Likewise. (omp_any_child_fn_dumped): New variable. (extract_omp_for_data): Fill in sched_modifiers, and mask out OMP_CLAUSE_SCHEDULE_KIND bits outside of OMP_CLAUSE_SCHEDULE_MASK from sched_kind. (determine_parallel_type): Use only OMP_CLAUSE_SCHEDULE_MASK bits of OMP_CLAUSE_SCHED_KIND. (scan_sharing_clauses): Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE, drop OMP_CLAUSE_MAP_PRIVATE support. Look through POINTER_PLUS_EXPR for array section reductions. (add_taskreg_looptemp_clauses): Add one extra _looptemp_ clause even for distribute parallel for, if there are lastprivate clauses on the for. (lower_rec_input_clauses): Handle non-zero low-bound on array section reductions. (lower_reduction_clauses): Likewise. (lower_send_clauses): Look through POINTER_PLUS_EXPR for array section reductions. (expand_parallel_call): Use nonmonotonic entrypoints for nonmonotonic: dynamic/guided. (expand_omp_taskreg): Call assign_assembler_name_if_neeeded on child_fn if current_function_decl has assembler name set, but child_fn does not. Dump the header and IL of the child function when not in SSA form. (expand_omp_target): Likewise. Pass num_teams and thread_limit arguments to BUILT_IN_GOMP_TARGET. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Initialize the extra _looptemp_ clause to fd->loop.n2. (expand_omp_for): Use nonmonotonic entrypoints for nonmonotonic: dynamic/guided. Initialize region->sched_modifiers. (expand_omp): Clear omp_any_child_fn_dumped. Dump function header again if we have dumped any child functions. (lower_omp_for_lastprivate): Determine the right count variable for distribute simd, or distribute parallel for{, simd}. (lower_omp_target): Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE and GOMP_MAP_ALWAYS_POINTER. Drop OMP_CLAUSE_MAP_PRIVATE support. (simd_clone_clauses_extract): Handle variable step for references and arguments passed by reference. (simd_clone_mangle): Mangle ref/uval/val variable steps. (simd_clone_adjust_argument_types): Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP. (simd_clone_linear_addend): New function. (simd_clone_adjust): Handle variable step like similarly to constant step, use simd_clone_linear_addend to determine the actual step at runtime. gcc/c-family/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> * c-common.h (c_finish_omp_atomic): Add TEST argument. (c_omp_check_loop_iv, c_omp_check_loop_iv_exprs): New prototypes. * c-omp.c (c_finish_omp_atomic): Add TEST argument. Don't call save_expr or create_tmp_var* if TEST is true. (c_finish_omp_for): Store OMP_FOR_ORIG_DECLS always. Don't call add_stmt here. (struct c_omp_check_loop_iv_data): New type. (c_omp_check_loop_iv_r, c_omp_check_loop_iv, c_omp_check_loop_iv_exprs): New functions. (c_omp_split_clauses): Adjust for lastprivate being allowed on distribute. (c_omp_declare_simd_clauses_to_numbers): Change OMP_CLAUSE_LINEAR_VARIABLE_STRIDE OMP_CLAUSE_LINEAR_STEP into numbers. (c_omp_declare_simd_clauses_to_decls): Similarly change those from numbers to PARM_DECLs. gcc/c/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * c-parser.c: Include context.h and gimple-expr.h. (c_parser_omp_clause_schedule): Parse schedule modifiers, diagnose monotonic together with nonmonotonic. (c_parser_omp_for_loop): Call c_omp_check_loop_iv. Call add_stmt here. (OMP_DISTRIBUTE_CLAUSE_MASK): Add lastprivate clause. (c_parser_omp_target_data, c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): Allow GOMP_MAP_ALWAYS_POINTER. (c_parser_omp_target): Likewise. Evaluate num_teams and thread_limit expressions on combined target teams before the target. (c_parser_omp_declare_target): If decl has "omp declare target" or "omp declare target link" attribute, and cgraph or varpool node already exists, then set corresponding flags. Call c_finish_omp_clauses in the parenthesized extended-list syntax case. * c-decl.c (c_decl_attributes): Don't diagnose block scope vars inside declare target. * c-typeck.c (handle_omp_array_sections_1): Allow non-zero low-bound on OMP_CLAUSE_REDUCTION array sections. (handle_omp_array_sections): Encode low-bound into the MEM_REF, either into the constant offset, or for variable low-bound using POINTER_PLUS_EXPR. For structure element based array sections use GOMP_MAP_ALWAYS_POINTER instead of GOMP_MAP_FIRSTPRIVATE_POINTER. (c_finish_omp_clauses): Drop generic_field_head, structure elements are now always mapped even as array section bases, diagnose same var in data sharing and mapping clauses. Diagnose if linear step on declare simd is neither a constant nor a uniform parameter. Look through POINTER_PLUS_EXPR for array section reductions. Diagnose the same var or function appearing multiple times on the same directive. Fix up wording for the to clause if t is neither a FUNCTION_DECL nor a VAR_DECL. Diagnose nonmonotonic modifier on kinds other than dynamic or guided or nonmonotonic modifier together with ordered clause. gcc/cp/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * cp-tree.h (finish_omp_for): Add ORIG_INITS argument. (omp_privatize_field): Add SHARED argument. * parser.c: Include context.h. (cp_parser_omp_clause_schedule): Parse schedule modifiers, diagnose monotonic together with nonmonotonic. (cp_parser_omp_clause_linear): Add DECLARE_SIMD argument. Parse parameter name as linear step as id-expression rather than expression. (cp_parser_omp_all_clauses): Adjust caller. (cp_parser_omp_for_loop_init): Add ORIG_INIT argument, initialize it. Adjust omp_privatize_field caller. (cp_parser_omp_for_loop): Compute orig_inits, pass it's address to finish_omp_for. (OMP_DISTRIBUTE_CLAUSE_MASK): Add lastprivate clause. (cp_parser_omp_target_data, cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): Allow GOMP_MAP_ALWAYS_POINTER and GOMP_MAP_FIRSTPRIVATE_REFERENCE. (cp_parser_omp_target): Likewise. Evaluate num_teams and thread_limit expressions on combined target teams before the target. (cp_parser_omp_declare_target): If decl has "omp declare target" or "omp declare target link" attribute, and cgraph or varpool node already exists, then set corresponding flags. Call finish_omp_clauses in the parenthesized extended-list syntax case. Call cp_parser_require_pragma_eol instead of cp_parser_skip_to_pragma_eol. (cp_parser_omp_end_declare_target): Call cp_parser_require_pragma_eol instead of cp_parser_skip_to_pragma_eol. * decl2.c (cplus_decl_attributes): Don't diagnose block scope vars inside declare target. * pt.c (tsubst_omp_clauses): If OMP_CLAUSE_LINEAR_VARIABLE_STRIDE, use tsubst_omp_clause_decl instead of tsubst_expr on OMP_CLAUSE_LINEAR_STEP. Handle non-static data members in shared clauses. (tsubst_omp_for_iterator): Adjust omp_privatize_field caller. (tsubst_find_omp_teams): New function. (tsubst_expr): Evaluate num_teams and thread_limit expressions on combined target teams before the target. Use OMP_FOR_ORIG_DECLS for all OpenMP/OpenACC/Cilk+ looping constructs. Adjust finish_omp_for caller. * semantics.c (omp_privatize_field): Add SHARED argument, if true, always create artificial var and never put it into the hash table or vector. (handle_omp_array_sections_1): Adjust omp_privatize_field caller. Allow non-zero low-bound on OMP_CLAUSE_REDUCTION array sections. (handle_omp_array_sections): For structure element based array sections use GOMP_MAP_ALWAYS_POINTER instead of GOMP_MAP_FIRSTPRIVATE_POINTER. Encode low-bound into the MEM_REF, either into the constant offset, or for variable low-bound using POINTER_PLUS_EXPR. (finish_omp_clauses): Adjust omp_privatize_field caller. Drop generic_field_head, structure elements are now always mapped even as array section bases, diagnose same var in data sharing and mapping clauses. For references map what they refer to using GOMP_MAP_ALWAYS_POINTER for structure elements and GOMP_MAP_FIRSTPRIVATE_REFERENCE otherwise. Diagnose if linear step on declare simd is neither a constant nor a uniform parameter. Allow non-static data members on shared clauses. Look through POINTER_PLUS_EXPR for array section reductions. Diagnose nonmonotonic modifier on kinds other than dynamic or guided or nonmonotonic modifier together with ordered clause. Diagnose the same var or function appearing multiple times on the same directive. Fix up wording for the to clause if t is neither a FUNCTION_DECL nor a VAR_DECL, use special wording for OVERLOADs and TEMPLATE_ID_EXPR. (handle_omp_for_class_iterator): Add ORIG_DECLS argument. Call c_omp_check_loop_iv_exprs on cond. (finish_omp_for): Add ORIG_INITS argument. Call c_omp_check_loop_iv_exprs on ORIG_INITS elements. Adjust handle_omp_for_class_iterator caller. Call c_omp_check_loop_iv. Call add_stmt. (finish_omp_atomic): Adjust c_finish_omp_atomic caller. gcc/fortran/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> * types.def (BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR): Remove. (BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): New. gcc/testsuite/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> * c-c++-common/gomp/clauses-2.c (foo): Adjust for diagnostics of variables in both data sharing and mapping clauses and for structure element based array sections being mapped rather than privatized. * c-c++-common/gomp/declare-target-2.c: Add various new tests. Adjust expected diagnostics wording in one case. * c-c++-common/gomp/distribute-1.c: New test. * c-c++-common/gomp/element-1.c: New test. * c-c++-common/gomp/pr61486-2.c: Add #pragma omp declare target and #pragma omp end declare target pair around the function. Change s from a parameter to a file scope variable. * c-c++-common/gomp/pr67521.c: Add dg-error directives. * c-c++-common/gomp/reduction-1.c (foo): Don't expect diagnostics on non-zero low-bound in reduction array sections. Add further tests. * c-c++-common/gomp/schedule-modifiers-1.c: New test. * c-c++-common/gomp/target-teams-1.c: New test. * gcc.dg/gomp/declare-simd-1.c: Add scan-assembler-times directives for expected mangling on x86_64/i?86. * gcc.dg/gomp/declare-simd-3.c: New test. * gcc.dg/gomp/declare-simd-4.c: New test. * gcc.dg/gomp/for-20.c: New test. * gcc.dg/gomp/for-21.c: New test. * gcc.dg/gomp/for-22.c: New test. * gcc.dg/gomp/for-23.c: New test. * gcc.dg/gomp/for-24.c: New test. * gcc.dg/gomp/linear-1.c: New test. * gcc.dg/gomp/loop-1.c: New test. * g++.dg/gomp/atomic-17.C: New test. * g++.dg/gomp/clause-1.C (T::test): Don't expect error on non-static data member in shared clause. Add single construct. * g++.dg/gomp/declare-simd-1.C: Add dg-options. Add scan-assembler-times directives for expected mangling on x86_64/i?86. * g++.dg/gomp/declare-simd-3.C: Likewise. * g++.dg/gomp/declare-simd-4.C: New test. * g++.dg/gomp/declare-simd-5.C: New test. * g++.dg/gomp/declare-target-1.C: New test. * g++.dg/gomp/linear-2.C: New test. * g++.dg/gomp/loop-1.C: New test. * g++.dg/gomp/loop-2.C: New test. * g++.dg/gomp/loop-3.C: New test. * g++.dg/gomp/member-2.C (B::m2, B::m4): Don't expect error on non-static data member in shared clause. * g++.dg/gomp/member-3.C: New test. * g++.dg/gomp/member-4.C: New test. * g++.dg/gomp/pr38639.C (foo): Adjust dg-error. (bar): Remove dg-message. * g++.dg/gomp/target-teams-1.C: New test. include/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * gomp-constants.h (GOMP_MAP_FLAG_SPECIAL_2): Define. (GOMP_MAP_FLAG_ALWAYS): Remove. (enum gomp_map_kind): Use GOMP_MAP_FLAG_SPECIAL_2 instead of GOMP_MAP_FLAG_ALWAYS for GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_RELEASE. Add GOMP_MAP_ALWAYS_POINTER and GOMP_MAP_FIRSTPRIVATE_REFERENCE. (GOMP_MAP_ALWAYS_P): Define. (GOMP_TARGET_FLAG_NOWAIT): Adjust comment. libgomp/ 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * libgomp_g.h (GOMP_loop_nonmonotonic_dynamic_next, GOMP_loop_nonmonotonic_dynamic_start, GOMP_loop_nonmonotonic_guided_next, GOMP_loop_nonmonotonic_guided_start, GOMP_loop_ull_nonmonotonic_dynamic_next, GOMP_loop_ull_nonmonotonic_dynamic_start, GOMP_loop_ull_nonmonotonic_guided_next, GOMP_loop_ull_nonmonotonic_guided_start, GOMP_parallel_loop_nonmonotonic_dynamic, GOMP_parallel_loop_nonmonotonic_guided): New prototypes. (GOMP_target_41): Renamed to ... (GOMP_target_ext): ... this. Add num_teams and thread_limit arguments. (GOMP_target_data_41): Renamed to ... (GOMP_target_data_ext): ... this. (GOMP_target_update_41): Renamed to ... (GOMP_target_update_ext): ... this. * libgomp.map (GOMP_4.5): Export GOMP_target_ext, GOMP_target_data_ext and GOMP_target_update_ext instead of GOMP_target_41, GOMP_target_data_41 and GOMP_target_update_41. Export GOMP_loop_nonmonotonic_dynamic_next, GOMP_loop_nonmonotonic_dynamic_start, GOMP_loop_nonmonotonic_guided_next, GOMP_loop_nonmonotonic_guided_start, GOMP_loop_ull_nonmonotonic_dynamic_next, GOMP_loop_ull_nonmonotonic_dynamic_start, GOMP_loop_ull_nonmonotonic_guided_next, GOMP_loop_ull_nonmonotonic_guided_start, GOMP_parallel_loop_nonmonotonic_dynamic and GOMP_parallel_loop_nonmonotonic_guided. * loop.c (GOMP_parallel_loop_nonmonotonic_dynamic, GOMP_parallel_loop_nonmonotonic_guided, GOMP_loop_nonmonotonic_dynamic_start, GOMP_loop_nonmonotonic_guided_start, GOMP_loop_nonmonotonic_dynamic_next, GOMP_loop_nonmonotonic_guided_next): New aliases or functions. * loop_ull.c (GOMP_loop_ull_nonmonotonic_dynamic_start, GOMP_loop_ull_nonmonotonic_guided_start, GOMP_loop_ull_nonmonotonic_dynamic_next, GOMP_loop_ull_nonmonotonic_guided_next): Likewise. * target.c (gomp_map_0len_lookup, gomp_map_val): New inline functions. (gomp_map_vars): Handle GOMP_MAP_ALWAYS_POINTER. For GOMP_MAP_ZERO_LEN_ARRAY_SECTION use gomp_map_0len_lookup. Use gomp_map_val function. (gomp_target_fallback_firstprivate): New static function. (GOMP_target_41): Renamed to ... (GOMP_target_ext): ... this. Add num_teams and thread_limit arguments. Move firstprivate fallback handling into a new function. (GOMP_target_data_41): Renamed to ... (GOMP_target_data_ext): ... this. (GOMP_target_update_41): Renamed to ... (GOMP_target_update_ext): ... this. (gomp_exit_data): For GOMP_MAP_*ZERO_LEN* use gomp_map_0len_lookup instead of gomp_map_lookup. (omp_target_is_present): Use gomp_map_0len_lookup instead of gomp_map_lookup. * testsuite/libgomp.c/target-28.c: Likewise. * testsuite/libgomp.c/monotonic-1.c: New test. * testsuite/libgomp.c/monotonic-2.c: New test. * testsuite/libgomp.c/nonmonotonic-1.c: New test. * testsuite/libgomp.c/nonmonotonic-2.c: New test. * testsuite/libgomp.c/pr66199-5.c: New test. * testsuite/libgomp.c/pr66199-6.c: New test. * testsuite/libgomp.c/pr66199-7.c: New test. * testsuite/libgomp.c/pr66199-8.c: New test. * testsuite/libgomp.c/pr66199-9.c: New test. * testsuite/libgomp.c/reduction-11.c: New test. * testsuite/libgomp.c/reduction-12.c: New test. * testsuite/libgomp.c/reduction-13.c: New test. * testsuite/libgomp.c/reduction-14.c: New test. * testsuite/libgomp.c/reduction-15.c: New test. * testsuite/libgomp.c/target-12.c (main): Adjust for omp_target_is_present change for one-past-last element. * testsuite/libgomp.c/target-17.c (foo): Drop tests where the same var is both mapped and privatized. * testsuite/libgomp.c/target-19.c (foo): Adjust for different handling of zero-length array sections. * testsuite/libgomp.c/target-28.c: New test. * testsuite/libgomp.c/target-29.c: New test. * testsuite/libgomp.c/target-30.c: New test. * testsuite/libgomp.c/target-teams-1.c: New test. * testsuite/libgomp.c++/member-6.C: New test. * testsuite/libgomp.c++/member-7.C: New test. * testsuite/libgomp.c++/monotonic-1.C: New test. * testsuite/libgomp.c++/monotonic-2.C: New test. * testsuite/libgomp.c++/nonmonotonic-1.C: New test. * testsuite/libgomp.c++/nonmonotonic-2.C: New test. * testsuite/libgomp.c++/pr66199-3.C: New test. * testsuite/libgomp.c++/pr66199-4.C: New test. * testsuite/libgomp.c++/pr66199-5.C: New test. * testsuite/libgomp.c++/pr66199-6.C: New test. * testsuite/libgomp.c++/pr66199-7.C: New test. * testsuite/libgomp.c++/pr66199-8.C: New test. * testsuite/libgomp.c++/pr66199-9.C: New test. * testsuite/libgomp.c++/reduction-11.C: New test. * testsuite/libgomp.c++/reduction-12.C: New test. * testsuite/libgomp.c++/target-13.C: New test. * testsuite/libgomp.c++/target-14.C: New test. * testsuite/libgomp.c++/target-15.C: New test. * testsuite/libgomp.c++/target-16.C: New test. * testsuite/libgomp.c++/target-17.C: New test. * testsuite/libgomp.c++/target-18.C: New test. * testsuite/libgomp.c++/target-19.C: New test. Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com> From-SVN: r229814
2015-11-05 16:08:08 +01:00
extern tree omp_privatize_field (tree, bool);
extern tree begin_transaction_stmt (location_t, tree *, int);
extern void finish_transaction_stmt (tree, tree, int, tree);
extern tree build_transaction_expr (location_t, tree, int, tree);
target.c: New file. libgomp/ * target.c: New file. * Makefile.am (libgomp_la_SOURCES): Add target.c. * Makefile.in: Regenerated. * libgomp_g.h (GOMP_task): Add depend argument. (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams, GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_parallel, GOMP_cancel, GOMP_cancellation_point, GOMP_taskgroup_start, GOMP_taskgroup_end, GOMP_parallel_sections): New prototypes. * fortran.c (omp_is_initial_device): Add ialias_redirect. (omp_is_initial_device_): New function. (ULP, STR1, STR2, ialias_redirect): Removed. (omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device_, omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New functions. * libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel, GOMP_sections_end_cancel, GOMP_target, GOMP_target_data, GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export @@GOMP_4.0. (omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation, omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_, omp_set_default_device, omp_set_default_device_, omp_set_default_device_8_, omp_get_default_device, omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_, omp_get_num_teams, omp_get_num_teams_, omp_get_team_num, omp_get_team_num_): Export @@OMP_4.0. * team.c (struct gomp_thread_start_data): Add place field. (gomp_thread_start): Clear thr->thread_pool and thr->task before returning. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. Initialize thr->place. (gomp_new_team): Initialize work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. (gomp_free_pool_helper): Clear thr->thread_pool and thr->task before calling pthread_exit. (gomp_free_thread): No longer static. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. (gomp_team_start): Add flags argument. Set thr->thread_pool->threads_busy to nthreads immediately after creating new pool. Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Handle OpenMP 4.0 affinity. (gomp_team_end): Use gomp_managed_threads_lock instead of gomp_remaining_threads_lock. Use gomp_team_barrier_wait_final instead of gomp_team_barrier_wait. If team->team_cancelled, call gomp_fini_worshare on ws chain starting at team->work_shares_to_free rather than thr->ts.work_share. (initialize_team): Don't call gomp_sem_init here. * sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start caller. (GOMP_parallel_sections, GOMP_sections_end_cancel): New functions. * env.c (gomp_global_icv): Add default_device_var, target_data and bind_var initializers. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New variables. (parse_bind_var, parse_one_place, parse_places_var): New functions. (parse_affinity): Rewritten to construct OMP_PLACES list with unit sized places. (gomp_cancel_var): New global variable. (parse_int): New function. (handle_omp_display_env): New function. (initialize_env): Use it. Initialize default_device_var. Parse OMP_CANCELLATION env var. Use parse_bind_var to parse OMP_PROC_BIND instead of parse_boolean. Use parse_places_var for OMP_PLACES parsing. Don't call parse_affinity if OMP_PLACES has been successfully parsed (and call gomp_init_affinity in that case). (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New functions. * libgomp.h: Include stdlib.h. (ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call): Define. (struct target_mem_desc): Forward declare. (struct gomp_task_icv): Add default_device_var, target_data, bind_var and thread_limit_var fields. (gomp_get_num_devices): New prototype. (gomp_cancel_var): New extern decl. (struct gomp_team): Add work_shares_to_free, work_share_cancelled, team_cancelled and task_queued_count fields. Add comments about task_{,queued_,running_}count. (gomp_cancel_kind): New enum. (gomp_work_share_end_cancel): New prototype. (struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup, copy_ctors_done, dependers, depend_hash, depend_count, num_dependees and depend fields. (struct gomp_taskgroup): New type. (struct gomp_task_depend_entry, struct gomp_dependers_vec): New types. (gomp_finish_task): Free depend_hash if non-NULL. (struct gomp_team_state): Add place_partition_off and place_partition_len fields. (gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list, gomp_places_list_len): New extern decls. (struct gomp_thread): Add place field. (gomp_cpu_affinity, gomp_cpu_affinity_len): Remove. (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New prototypes. (gomp_team_start): Add flags argument. (gomp_thread_limit_var, gomp_remaining_threads_count, gomp_remaining_threads_lock): Remove. (gomp_managed_threads_lock): New variable. (struct gomp_thread_pool): Add threads_busy field. (gomp_free_thread): New prototype. * task.c: Include hashtab.h. (hash_entry_type): New typedef. (htab_alloc, htab_free, htab_hash, htab_eq): New inlines. (gomp_init_task): Clear dependers, depend_hash, depend_count, copy_ctors_done and taskgroup fields. (GOMP_task): Add depend argument, handle depend clauses. If gomp_team_barrier_cancelled or if it's taskgroup has been cancelled, don't queue or start new tasks. Set copy_ctors_done field if needed. Initialize taskgroup field. If copy_ctors_done and already cancelled, don't discard the task. If taskgroup is non-NULL, enqueue the task into taskgroup queue. Increment num_children field in taskgroup. Increment task_queued_count. (gomp_task_run_pre, gomp_task_run_post_remove_parent, gomp_task_run_post_remove_taskgroup): New inline functions. (gomp_task_run_post_handle_depend_hash, gomp_task_run_post_handle_dependers, gomp_task_run_post_handle_depend): New functions. (GOMP_taskwait): Use them. If more than one new tasks have been queued, wake other threads if needed. (gomp_barrier_handle_tasks): Likewise. If gomp_team_barrier_cancelled, don't start any new tasks, just free all tasks. (GOMP_taskgroup_start, GOMP_taskgroup_end): New functions. * omp_lib.f90.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New interfaces. (omp_get_dynamic, omp_get_nested, omp_in_parallel, omp_get_max_threads, omp_get_num_procs, omp_get_num_threads, omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level, omp_in_final): Remove useless use omp_lib_kinds. * omp.h.in (omp_proc_bind_t): New typedef. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New prototypes. * loop.c (gomp_parallel_loop_start): Add flags argument, pass it through to gomp_team_start. (GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start, GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start): Adjust gomp_parallel_loop_start callers. (GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic, GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime, GOMP_loop_end_cancel): New functions. (GOMP_parallel_end): Add ialias_redirect. * hashtab.h: New file. * libgomp.texi (Environment Variables): Minor cleanup, update section refs to OpenMP 4.0rc2. (OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these environment variables. * work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set team->work_shares_to_free to thr->ts.work_share before calling free_work_share. (gomp_work_share_end_cancel): New function. * config/linux/proc.c: Include errno.h. (gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables. (gomp_cpuset_popcount): Add cpusetsize argument, use it instead of sizeof (cpu_set_t) to determine number of iterations. Fix up check extern decl. Use CPU_COUNT_S if available, or CPU_COUNT if gomp_cpuset_size is sizeof (cpu_set_t). (gomp_init_num_threads): Initialize gomp_cpuset_size, gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Free and clear gomp_cpusetp if it didn't contain any logical CPUs. (get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp is NULL. Use gomp_cpusetp instead of &cpuset and pass gomp_get_cpuset_size instead of sizeof (cpu_set_t) to pthread_getaffinity_np. Check gomp_places_list instead of gomp_cpu_affinity. Adjust gomp_cpuset_popcount caller. * config/linux/bar.c (gomp_barrier_wait_end, gomp_barrier_wait_last): Use BAR_* defines. (gomp_team_barrier_wait_end): Likewise. Clear BAR_CANCELLED from state where needed. Set work_share_cancelled to 0 on last thread. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden. Add cpusetsize argument. (gomp_cpuset_size, gomp_cpusetp): Declare. * config/linux/affinity.c: Include errno.h, stdio.h and string.h. (affinity_counter): Remove. (CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define if CPU_ALLOC_SIZE isn't defined. (gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try silently create OMP_PLACES=threads, if it is non-NULL afterwards, bind current thread to the first place. (gomp_init_thread_affinity): Rewritten. Add place argument, just pthread_setaffinity_np to gomp_places_list[place]. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New functions. * config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add awaited_final field. (gomp_barrier_init): Initialize awaited_final field. (gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. Use BAR_* defines. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * config/posix/bar.c (gomp_barrier_init): Clear cancellable field. (gomp_barrier_wait_end): Use BAR_* defines. (gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state. Set work_share_cancelled to 0 on last thread, use __atomic_load_n. Use BAR_* defines. (gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New functions. * config/posix/affinity.c (gomp_init_thread_affinity): Add place argument. (gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus, gomp_affinity_remove_cpu, gomp_affinity_copy_place, gomp_affinity_same_place, gomp_affinity_finalize_place_list, gomp_affinity_init_level, gomp_affinity_print_place): New stubs. * config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST, BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define. (gomp_barrier_t): Add cancellable field. (gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New prototypes. (gomp_barrier_wait_start): Preserve BAR_CANCELLED bit. (gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final, gomp_team_barrier_cancelled): New inline functions. (gomp_barrier_wait_start, gomp_barrier_last_thread, gomp_team_barrier_set_task_pending, gomp_team_barrier_clear_task_pending, gomp_team_barrier_set_waiting_for_tasks, gomp_team_barrier_waiting_for_tasks, gomp_team_barrier_done): Use BAR_* defines. * barrier.c (GOMP_barrier_cancel): New function. * omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false, omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close, omp_proc_bind_spread): New params. (omp_get_cancellation, omp_get_proc_bind, omp_set_default_device, omp_get_default_device, omp_get_num_devices, omp_get_num_teams, omp_get_team_num, omp_is_initial_device): New externals. * parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point): New functions. (gomp_resolve_num_threads): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. If not nested, just return minimum of max_num_threads and icv->thread_limit_var and if thr->thread_pool, set threads_busy to the returned value. Otherwise, don't update atomically gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy. (GOMP_parallel_end): Adjust for thread_limit now being in icv->thread_limit_var. Use UINT_MAX instead of ULONG_MAX as infinity. Adjust threads_busy in the pool rather than gomp_remaining_threads_count. Remember team->nthreads and call gomp_team_end before adjusting threads_busy, if not nested afterwards, just set it to 1 non-atomically. Add ialias. (GOMP_parallel_start): Adjust gomp_team_start caller. * testsuite/libgomp.c/atomic-14.c: Add parens to make it valid. * testsuite/libgomp.c/affinity-1.c: New test. * testsuite/libgomp.c/atomic-15.c: New test. * testsuite/libgomp.c/atomic-16.c: New test. * testsuite/libgomp.c/atomic-17.c: New test. * testsuite/libgomp.c/cancel-for-1.c: New test. * testsuite/libgomp.c/cancel-for-2.c: New test. * testsuite/libgomp.c/cancel-parallel-1.c: New test. * testsuite/libgomp.c/cancel-parallel-2.c: New test. * testsuite/libgomp.c/cancel-parallel-3.c: New test. * testsuite/libgomp.c/cancel-sections-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-1.c: New test. * testsuite/libgomp.c/cancel-taskgroup-2.c: New test. * testsuite/libgomp.c/depend-1.c: New test. * testsuite/libgomp.c/depend-2.c: New test. * testsuite/libgomp.c/depend-3.c: New test. * testsuite/libgomp.c/depend-4.c: New test. * testsuite/libgomp.c/for-1.c: New test. * testsuite/libgomp.c/for-1.h: New file. * testsuite/libgomp.c/for-2.c: New test. * testsuite/libgomp.c/for-2.h: New file. * testsuite/libgomp.c/for-3.c: New test. * testsuite/libgomp.c/pr58392.c: New test. * testsuite/libgomp.c/simd-1.c: New test. * testsuite/libgomp.c/simd-2.c: New test. * testsuite/libgomp.c/simd-3.c: New test. * testsuite/libgomp.c/simd-4.c: New test. * testsuite/libgomp.c/simd-5.c: New test. * testsuite/libgomp.c/simd-6.c: New test. * testsuite/libgomp.c/target-1.c: New test. * testsuite/libgomp.c/target-2.c: New test. * testsuite/libgomp.c/target-3.c: New test. * testsuite/libgomp.c/target-4.c: New test. * testsuite/libgomp.c/target-5.c: New test. * testsuite/libgomp.c/target-6.c: New test. * testsuite/libgomp.c/target-7.c: New test. * testsuite/libgomp.c/taskgroup-1.c: New test. * testsuite/libgomp.c/thread-limit-1.c: New test. * testsuite/libgomp.c/thread-limit-2.c: New test. * testsuite/libgomp.c/thread-limit-3.c: New test. * testsuite/libgomp.c/udr-1.c: New test. * testsuite/libgomp.c/udr-2.c: New test. * testsuite/libgomp.c/udr-3.c: New test. * testsuite/libgomp.c++/affinity-1.C: New test. * testsuite/libgomp.c++/atomic-10.C: New test. * testsuite/libgomp.c++/atomic-11.C: New test. * testsuite/libgomp.c++/atomic-12.C: New test. * testsuite/libgomp.c++/atomic-13.C: New test. * testsuite/libgomp.c++/atomic-14.C: New test. * testsuite/libgomp.c++/atomic-15.C: New test. * testsuite/libgomp.c++/cancel-for-1.C: New test. * testsuite/libgomp.c++/cancel-for-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-1.C: New test. * testsuite/libgomp.c++/cancel-parallel-2.C: New test. * testsuite/libgomp.c++/cancel-parallel-3.C: New test. * testsuite/libgomp.c++/cancel-sections-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-1.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-2.C: New test. * testsuite/libgomp.c++/cancel-taskgroup-3.C: New test. * testsuite/libgomp.c++/cancel-test.h: New file. * testsuite/libgomp.c++/for-9.C: New test. * testsuite/libgomp.c++/for-10.C: New test. * testsuite/libgomp.c++/for-11.C: New test. * testsuite/libgomp.c++/simd-1.C: New test. * testsuite/libgomp.c++/simd-2.C: New test. * testsuite/libgomp.c++/simd-3.C: New test. * testsuite/libgomp.c++/simd-4.C: New test. * testsuite/libgomp.c++/simd-5.C: New test. * testsuite/libgomp.c++/simd-6.C: New test. * testsuite/libgomp.c++/simd-7.C: New test. * testsuite/libgomp.c++/simd-8.C: New test. * testsuite/libgomp.c++/target-1.C: New test. * testsuite/libgomp.c++/target-2.C: New test. * testsuite/libgomp.c++/target-2-aux.cc: New file. * testsuite/libgomp.c++/target-3.C: New test. * testsuite/libgomp.c++/taskgroup-1.C: New test. * testsuite/libgomp.c++/udr-1.C: New test. * testsuite/libgomp.c++/udr-2.C: New test. * testsuite/libgomp.c++/udr-3.C: New test. * testsuite/libgomp.c++/udr-4.C: New test. * testsuite/libgomp.c++/udr-5.C: New test. * testsuite/libgomp.c++/udr-6.C: New test. * testsuite/libgomp.c++/udr-7.C: New test. * testsuite/libgomp.c++/udr-8.C: New test. * testsuite/libgomp.c++/udr-9.C: New test. gcc/ * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION, formatting fixes, use pp_colon instead of pp_character (..., ':'), similarly pp_right_paren. (dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP, allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0 clauses. (omp_declare_simd_clauses_equal, omp_remove_redundant_declare_simd_attrs): New functions. (attribute_value_equal): Use omp_declare_simd_clauses_equal. (walk_tree_1): Handle new OpenMP 4.0 clauses. * tree.h (OMP_LOOP_CHECK): Define. (OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND, OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it. (OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES, OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY, OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE, OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND, OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND, OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT, OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR, OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SIMDLEN_EXPR): Define. (OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_. (omp_remove_redundant_declare_simd_attrs): New prototype. * gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS): New codes. (GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE. * omp-low.c (struct omp_context): Add cancel_label and cancellable fields. (target_nesting_level): New variable. (extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and OMP_CLAUSE_DIST_SCHEDULE. Don't fallback to library implementation for collapse > 1 static schedule unless ordered. (get_ws_args_for): Add par_stmt argument. Handle combined loops. (determine_parallel_type): Adjust get_ws_args_for caller. (install_var_field): Handle mask & 4 for double indirection. (scan_sharing_clauses): Ignore shared clause on teams construct. Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses. (create_omp_child_function): If inside target or declare target constructs, set "omp declare target" attribute on the child function. (find_combined_for): New function. (scan_omp_parallel): Handle combined loops. (scan_omp_target, scan_omp_teams): New functions. (check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting restrictions and set ctx->cancellable for cancellable constructs. (scan_omp_1_stmt): Call check_omp_nesting_restrictions also on selected builtin calls. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS. (build_omp_barrier): Add lhs argument, return gimple rather than tree. (omp_clause_aligned_alignment): New function. (lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR on decls. (lower_rec_input_clauses): Add FD argument. Ignore shared clauses on teams constructs. Handle user defined reductions and new OpenMP 4.0 clauses. (lower_reduction_clauses): Don't set placeholder to address of ref if it has already the right type. (lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_. (expand_parallel_call): Use the new non-_start suffixed builtins, handle OMP_CLAUSE_PROC_BIND, don't call the outlined function and GOMP_parallel_end after the call. (expand_task_call): Handle OMP_CLAUSE_DEPEND. (expand_omp_for_init_counts): Handle combined loops. (expand_omp_for_init_vars): Add inner_stmt argument, handle combined loops. (expand_omp_for_generic): Likewise. Use GOMP_loop_end_cancel at the end of cancellable loops. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Likewise. Handle collapse > 1 loops. (expand_omp_simd): Handle combined loops. (expand_omp_for): Add inner_stmt argument, adjust callers of expand_omp_for* functions, use expand_omp_for_static*chunk even for collapse > 1 unless ordered. (expand_omp_sections): Use GOMP_sections_end_cancel at the end of cancellable sections. (expand_omp_single): Remove need_barrier variable, just rely on gimple_omp_return_nowait_p. Adjust build_omp_barrier caller. (expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS. (expand_omp_atomic_load, expand_omp_atomic_store, expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p. (expand_omp_target): New function. (expand_omp): Handle combined loops. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET. (build_omp_regions_1): Immediately close region for GF_OMP_TARGET_KIND_UPDATE. (maybe_add_implicit_barrier_cancel): New function. (lower_omp_sections): Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_omp_single): Likewise. Add clobber after the barrier. (lower_omp_taskgroup): New function. (lower_omp_for): Handle combined loops. Adjust lower_rec_input_clauses caller. Handle cancellation. (lower_depend_clauses): New function. (lower_omp_taskreg): Lower depend clauses. Adjust lower_rec_input_clauses caller. Add clobber after the call. Handle cancellation. (lower_omp_target, lower_omp_teams): New functions. (lower_omp_1): Handle cancellation. Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel and GOMP_cancellation_point calls. (lower_omp): Fold stmts inside of target region. (diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * builtin-types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL. Don't handle BUILT_IN_GOMP_PARALLEL_END. * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_DISTRIBUTE. (dump_gimple_omp_target, dump_gimple_omp_teams): New functions. (dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP. (dump_gimple_omp_return): Print lhs if it has any. (dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle gimple_omp_atomic_seq_cst_p. (pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS. * langhooks.c (lhd_omp_mappable_type): New function. * tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment. * langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type hook. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP, GOVD_ALIGNED and GOVD_MAP_TO_ONLY. (enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and ORT_TARGET. (struct gimplify_omp_ctx): Add combined_loop field. (gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt on stmts inside of target region. (is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP. (omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED, ORT_TARGET and ORT_TARGET_DATA. (omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED. Handle GOVD_MAP. (omp_notice_threadprivate_variable): Complain about threadprivate variables in target region. (omp_notice_variable): Complain about vars with non-mappable type in target region. Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA. (omp_check_private): Ignore ORT_TARGET* regions. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses. (find_combined_omp_for): New function. (gimplify_omp_for): Handle gimplification of combined loops. (gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA, OMP_TEAMS. (gimplify_omp_target_update): New function. (gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST. (gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP. (gimplify_body): If fndecl has "omp declare target" attribute, add implicit ORT_TARGET context around it. * tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET, OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes. * tree-nested.c (convert_nonlocal_reference_stmt, convert_local_reference_stmt, convert_gimple_call): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * omp-builtins.def (BUILT_IN_GOMP_TASK): Use BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT. (BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE, BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL, BUILT_IN_GOMP_LOOP_END_CANCEL, BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM, BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START, BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL, BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL, BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins. (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove. * tree-inline.c (remap_gimple_stmt, estimate_num_insns): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New functions. (walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. Walk optional lhs on GIMPLE_OMP_RETURN. (walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO, GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION, GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE, GF_OMP_ATOMIC_SEQ_CST): New. (gimple_build_omp_taskgroup, gimple_build_omp_target, gimple_build_omp_teams): New prototypes. (gimple_has_substatements): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. (gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of GIMPLE_OMP_SINGLE as end of range. (gimple_omp_return_set_lhs, gimple_omp_return_lhs, gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p, gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p, gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p, gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses, gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses, gimple_omp_target_kind, gimple_omp_target_set_kind, gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr, gimple_omp_target_set_child_fn, gimple_omp_target_data_arg, gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg, gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr, gimple_omp_teams_set_clauses): New inlines. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause codes. (enum omp_clause_depend_kind, enum omp_clause_map_kind, enum omp_clause_proc_bind_kind): New. (union omp_clause_subcode): Add depend_kind, map_kind and proc_bind_kind fields. * tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP. * langhooks-def.h (lhd_omp_mappable_type): New prototype. (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to 201307 instead of 201107. * c-common.c (DEF_FUNCTION_TYPE_8): Define. (c_common_attribute_table): Add "omp declare target" and "omp declare simd" attributes. (handle_omp_declare_target_attribute, handle_omp_declare_simd_attribute): New functions. * c-omp.c: Include c-pragma.h. (c_finish_omp_taskgroup): New function. (c_finish_omp_atomic): Add swapped argument, if true, build the operation first with rhs, lhs arguments and use NOP_EXPR build_modify_expr. (c_finish_omp_for): Add code argument, pass it down to make_code. (c_omp_split_clauses): New function. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New functions. * c-common.h (omp_clause_mask): New type. (OMP_CLAUSE_MASK_1): Define. (omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=, omp_clause_mask::operator |=, omp_clause_mask::operator ~, omp_clause_mask::operator |, omp_clause_mask::operator &, omp_clause_mask::operator <<, omp_clause_mask::operator >>, omp_clause_mask::operator ==): New methods. (enum c_omp_clause_split): New. (c_finish_omp_taskgroup): New prototype. (c_finish_omp_atomic): Add swapped argument. (c_finish_omp_for): Add code argument. (c_omp_split_clauses): New prototype. (c_split_parallel_clauses): Removed. (c_omp_declare_simd_clauses_to_numbers, c_omp_declare_simd_clauses_to_decls): New prototypes. * c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD, PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS. Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED, PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR, PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH, PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP, PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS, PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND, PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS, PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP, PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and PRAGMA_OMP_CLAUSE_UNIFORM. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define. gcc/fortran/ * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION. * f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define. * types.def (DEF_FUNCTION_TYPE_8): Document. (BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove. (BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT, BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT, BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_8): Define. gcc/c/ * c-lang.h (current_omp_declare_target_attribute): New extern decl. * c-parser.c: Include c-lang.h. (struct c_parser): Change tokens to c_token *. Add tokens_buf field. Change tokens_avail type to unsigned int. (c_parser_consume_token): If parser->tokens isn't &parser->tokens_buf[0], increment parser->tokens. (c_parser_consume_pragma): Likewise. (enum pragma_context): Add pragma_struct and pragma_param. (c_parser_external_declaration): Adjust c_parser_declaration_or_fndef caller. (c_parser_declaration_or_fndef): Add omp_declare_simd_clauses argument, if it is non-vNULL vector, call c_finish_omp_declare_simd. Adjust recursive call. (c_parser_struct_or_union_specifier): Use pragma_struct instead of pragma_external. (c_parser_parameter_declaration): Use pragma_param instead of pragma_external. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement): Adjust c_parser_declaration_or_fndef callers. (c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass it through to c_parser_conditional_expression. (c_parser_conditional_expression): Add omp_atomic_lhs argument, pass it through to c_parser_binary_expression. Adjust recursive call. (c_parser_binary_expression): Remove prec argument, add omp_atomic_lhs argument instead. Always start from PREC_NONE, if omp_atomic_lhs is non-NULL and one of the arguments of toplevel binop matches it, use build2 instead of parser_build_binary_op. (c_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION. Handle pragma_struct and pragma_param the same as pragma_external. (c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (c_parser_omp_variable_list): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. (c_parser_omp_clause_collapse): Fully fold collapse expression. (c_parser_omp_clause_reduction): Handle user defined reductions. (c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind, c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned, c_parser_omp_clause_linear, c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen, c_parser_omp_clause_depend, c_parser_omp_clause_map, c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule, c_parser_omp_clause_proc_bind, c_parser_omp_clause_to, c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions. (c_parser_omp_all_clauses): Add finish_p argument. Don't call c_finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (c_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to c_finish_omp_atomic. Handle OpenMP 4.0 atomic forms. (c_parser_omp_for_loop): Add CODE argument, pass it through to c_finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. Adjust c_parser_binary_expression, c_parser_declaration_or_fndef and c_finish_omp_for callers. (omp_split_clauses): New function. (c_parser_omp_simd): New function. (c_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (c_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (c_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (c_parser_omp_taskgroup, c_parser_omp_cancel, c_parser_omp_cancellation_point, c_parser_omp_distribute, c_parser_omp_teams, c_parser_omp_target_data, c_parser_omp_target_update, c_parser_omp_target, c_parser_omp_declare_simd, c_finish_omp_declare_simd, c_parser_omp_declare_target, c_parser_omp_end_declare_target, c_parser_omp_declare_reduction, c_parser_omp_declare): New functions. (c_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust c_parser_omp_for, c_parser_omp_parallel and c_parser_omp_sections callers. (c_parse_file): Initialize tparser.tokens and the_parser->tokens here. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * c-typeck.c: Include tree-inline.h. (c_finish_omp_cancel, c_finish_omp_cancellation_point, handle_omp_array_sections_1, handle_omp_array_sections, c_clone_omp_udr, c_find_omp_placeholder_r): New functions. (c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (c_tree_equal): New function. * c-tree.h (temp_store_parm_decls, temp_pop_parm_decls, c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New prototypes. * c-decl.c (current_omp_declare_target_attribute): New variable. (c_decl_attributes): New function. (start_decl, start_function): Use it instead of decl_attributes. (temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup, c_check_omp_declare_reduction_r): New functions. gcc/cp/ * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_TASKGROUP. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and OMP_DISTRIBUTE. Handle is_invisiref_parm decls in OMP_CLAUSE_REDUCTION. (cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like OMP_FOR. (cxx_omp_privatize_by_reference): Return true for is_invisiref_parm decls. (cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info caller. * pt.c (apply_late_template_attributes): For "omp declare simd" attribute call tsubst_omp_clauses, c_omp_declare_simd_clauses_to_decls, finish_omp_clauses and c_omp_declare_simd_clauses_to_numbers. (instantiate_class_template_1): Call cp_check_omp_declare_reduction for UDRs. (tsubst_decl): Handle UDRs. (tsubst_omp_clauses): Add declare_simd argument, if true don't call finish_omp_clauses. Handle new OpenMP 4.0 clauses. Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on OMP_CLAUSE_REDUCTION. (tsubst_expr): For UDRs call pushdecl and cp_check_omp_declare_reduction. Adjust tsubst_omp_clauses callers. Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP. Adjust finish_omp_atomic caller. (tsubst_omp_udr): New function. (instantiate_decl): For UDRs at block scope, don't call start_preparsed_function/finish_function. Call tsubst_omp_udr. * semantics.c (cxx_omp_create_clause_info): Add need_dtor argument, use it instead of need_default_ctor || need_copy_ctor. (struct cp_check_omp_declare_reduction_data): New type. (handle_omp_array_sections_1, handle_omp_array_sections, omp_reduction_id, omp_reduction_lookup, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r, cp_check_omp_declare_reduction, clone_omp_udr, find_omp_placeholder_r, finish_omp_reduction_clause): New functions. (finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined reductions. (finish_omp_for): Add CODE argument, use it instead of hardcoded OMP_FOR. Adjust c_finish_omp_for caller. (finish_omp_atomic): Add seq_cst argument, adjust c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0 atomic variants. (finish_omp_cancel, finish_omp_cancellation_point): New functions. * decl2.c (mark_used): Force immediate instantiation of DECL_OMP_DECLARE_REDUCTION_P decls. (is_late_template_attribute): Return true for "omp declare simd" attribute. (cp_omp_mappable_type): New function. (cplus_decl_attributes): Add implicit "omp declare target" attribute if requested. * parser.c (cp_debug_parser): Print parser->colon_doesnt_start_class_def_p. (cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New functions. (enum pragma_context): Add pragma_member and pragma_objc_icode. (cp_parser_binary_expression): Handle no_toplevel_fold_p even for binary operations other than comparison. (cp_parser_linkage_specification): Call cp_ensure_no_omp_declare_simd if needed. (cp_parser_namespace_definition): Likewise. (cp_parser_init_declarator): Call cp_finalize_omp_declare_simd. (cp_parser_direct_declarator): Pass declarator to cp_parser_late_return_type_opt. (cp_parser_late_return_type_opt): Add declarator argument, call cp_parser_late_parsing_omp_declare_simd for declare simd. (cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd. Parse UDRs before all other methods. (cp_parser_member_specification_opt): Use pragma_member instead of pragma_external. (cp_parser_member_declaration): Call cp_finalize_omp_declare_simd. (cp_parser_function_definition_from_specifiers_and_declarator, cp_parser_save_member_function_body): Likewise. (cp_parser_late_parsing_for_member): Handle UDRs specially. (cp_parser_next_token_starts_class_definition_p): Don't allow CPP_COLON if colon_doesnt_start_class_def_p flag is true. (cp_parser_objc_interstitial_code): Use pragma_objc_icode instead of pragma_external. (cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names. (cp_parser_omp_var_list_no_open): Parse array sections for OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses. Add COLON argument, if non-NULL, allow parsing to end with a colon rather than close paren. (cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open caller. (cp_parser_omp_clause_reduction): Handle user defined reductions. (cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind, cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen, cp_parser_omp_clause_depend, cp_parser_omp_clause_map, cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule, cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to, cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New functions. (cp_parser_omp_all_clauses): Add finish_p argument. Don't call finish_omp_clauses if it is false. Handle new OpenMP 4.0 clauses. (cp_parser_omp_atomic): Parse seq_cst clause, pass true if it is present to finish_omp_atomic. Handle new OpenMP 4.0 atomic forms. (cp_parser_omp_for_loop): Add CODE argument, pass it through to finish_omp_for. Change last argument to cclauses, and adjust uses to grab parallel clauses from the array of all the split clauses. (cp_omp_split_clauses): New function. (cp_parser_omp_simd): New function. (cp_parser_omp_for): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs, and call c_parser_omp_simd when parsing for simd. (cp_parser_omp_sections_scope): If section-sequence doesn't start with #pragma omp section, require exactly one structured-block instead of sequence of statements. (cp_parser_omp_sections): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_parallel): Add p_name, mask and cclauses arguments. Allow the function to be called also when parsing combined constructs. (cp_parser_omp_taskgroup, cp_parser_omp_cancel, cp_parser_omp_cancellation_point, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target_update, cp_parser_omp_target, cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd, cp_parser_omp_declare_target, cp_parser_omp_end_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction, cp_parser_omp_declare): New functions. (cp_parser_omp_construct): Add p_name and mask vars. Handle PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS. Adjust cp_parser_omp_for, cp_parser_omp_parallel and cp_parser_omp_sections callers. (cp_parser_pragma): Handle PRAGMA_OMP_CANCEL, PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP, PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET. Handle pragma_member and pragma_objc_icode like pragma_external. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. (OMP_PARALLEL_CLAUSE_MASK): Likewise. Add OMP_CLAUSE_PROC_BIND. (OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1. Add OMP_CLAUSE_DEPEND. (OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK, OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK, OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_DECLARE_SIMD_CLAUSE_MASK): Define. * parser.h (struct cp_omp_declare_simd_data): New type. (struct cp_parser): Add colon_doesnt_start_class_def_p and omp_declare_simd fields. * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define. * cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p bit. (DECL_OMP_DECLARE_REDUCTION_P): Define. (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro. (struct saved_scope): Add omp_declare_target_attribute field. (cp_omp_mappable_type, omp_reduction_id, cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction, finish_omp_cancel, finish_omp_cancellation_point): New prototypes. (finish_omp_for): Add CODE argument. (finish_omp_atomic): Add seq_cst argument. (cxx_omp_create_clause_info): Add need_dtor argument. gcc/testsuite/ * c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics. Remove error test that is now valid in OpenMP 4.0. * c-c++-common/gomp/atomic-16.c: New test. * c-c++-common/gomp/cancel-1.c: New test. * c-c++-common/gomp/depend-1.c: New test. * c-c++-common/gomp/depend-2.c: New test. * c-c++-common/gomp/map-1.c: New test. * c-c++-common/gomp/pr58472.c: New test. * c-c++-common/gomp/sections1.c: New test. * c-c++-common/gomp/simd1.c: New test. * c-c++-common/gomp/simd2.c: New test. * c-c++-common/gomp/simd3.c: New test. * c-c++-common/gomp/simd4.c: New test. * c-c++-common/gomp/simd5.c: New test. * c-c++-common/gomp/single1.c: New test. * g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections parser. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/clause-3.C: Adjust error messages. * g++.dg/gomp/declare-simd-1.C: New test. * g++.dg/gomp/declare-simd-2.C: New test. * g++.dg/gomp/depend-1.C: New test. * g++.dg/gomp/depend-2.C: New test. * g++.dg/gomp/target-1.C: New test. * g++.dg/gomp/target-2.C: New test. * g++.dg/gomp/taskgroup-1.C: New test. * g++.dg/gomp/teams-1.C: New test. * g++.dg/gomp/udr-1.C: New test. * g++.dg/gomp/udr-2.C: New test. * g++.dg/gomp/udr-3.C: New test. * g++.dg/gomp/udr-4.C: New test. * g++.dg/gomp/udr-5.C: New test. * g++.dg/gomp/udr-6.C: New test. * gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches. * gcc.dg/autopar/outer-2.c: Likewise. * gcc.dg/autopar/outer-3.c: Likewise. * gcc.dg/autopar/outer-4.c: Likewise. * gcc.dg/autopar/outer-5.c: Likewise. * gcc.dg/autopar/outer-6.c: Likewise. * gcc.dg/autopar/parallelization-1.c: Likewise. * gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections parser. * gcc.dg/gomp/clause-1.c: Adjust error messages. * gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime instead of GOMP_parallel_loop_runtime_start. * gcc.dg/gomp/declare-simd-1.c: New test. * gcc.dg/gomp/declare-simd-2.c: New test. * gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections parser. Add further #pragma omp sections nesting tests. * gcc.dg/gomp/target-1.c: New test. * gcc.dg/gomp/target-2.c: New test. * gcc.dg/gomp/taskgroup-1.c: New test. * gcc.dg/gomp/teams-1.c: New test. * gcc.dg/gomp/udr-1.c: New test. * gcc.dg/gomp/udr-2.c: New test. * gcc.dg/gomp/udr-3.c: New test. * gcc.dg/gomp/udr-4.c: New test. * gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error. Co-Authored-By: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
extern bool cxx_omp_create_clause_info (tree, tree, bool, bool,
bool, bool);
extern tree baselink_for_fns (tree);
extern void finish_static_assert (tree, tree, location_t,
bool);
extern tree finish_decltype_type (tree, bool, tsubst_flags_t);
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
extern tree finish_trait_expr (enum cp_trait_kind, tree, tree);
extern tree build_lambda_expr (void);
extern tree build_lambda_object (tree);
extern tree begin_lambda_type (tree);
extern tree lambda_capture_field_type (tree, bool, bool);
extern tree lambda_return_type (tree);
extern tree lambda_proxy_type (tree);
extern tree lambda_function (tree);
Implement return type deduction for normal functions with -std=c++1y. * cp-tree.h (FNDECL_USED_AUTO): New macro. (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P): Remove. (dependent_lambda_return_type_node): Remove. (CPTI_DEPENDENT_LAMBDA_RETURN_TYPE): Remove. (struct language_function): Add x_auto_return_pattern field. (current_function_auto_return_pattern): New. (enum tsubst_flags): Add tf_partial. * decl.c (decls_match): Handle auto return comparison. (duplicate_decls): Adjust error message for auto return. (cxx_init_decl_processing): Remove dependent_lambda_return_type_node. (cp_finish_decl): Don't do auto deduction for functions. (grokdeclarator): Allow auto return without trailing return type in C++1y mode. (check_function_type): Defer checking of deduced return type. (start_preparsed_function): Set current_function_auto_return_pattern. (finish_function): Set deduced return type to void if not previously deduced. * decl2.c (change_return_type): Handle error_mark_node. (mark_used): Always instantiate functions with deduced return type. Complain about use if deduction isn't done. * parser.c (cp_parser_lambda_declarator_opt): Use 'auto' for initial return type. (cp_parser_lambda_body): Don't deduce return type in a template. (cp_parser_conversion_type_id): Allow auto in C++1y. * pt.c (instantiate_class_template_1): Don't mess with LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P. (tsubst_copy_and_build): Likewise. (fn_type_unification, tsubst): Don't reduce the template parm level of 'auto' during deduction. (unify): Compare 'auto' specially. (get_bindings): Change test. (always_instantiate_p): Always instantiate functions with deduced return type. (do_auto_deduction): Handle error_mark_node and lambda context. Don't check for use in initializer. (contains_auto_r): Remove. * search.c (lookup_conversions_r): Handle auto conversion function. * semantics.c (lambda_return_type): Handle null return. Don't mess with dependent_lambda_return_type_node. (apply_deduced_return_type): Rename from apply_lambda_return_type. * typeck.c (merge_types): Handle auto. (check_return_expr): Do auto deduction. * typeck2.c (add_exception_specifier): Fix complain check. From-SVN: r185768
2012-03-24 21:56:08 +01:00
extern void apply_deduced_return_type (tree, tree);
extern tree add_capture (tree, tree, tree, bool, bool);
extern tree add_default_capture (tree, tree, tree);
extern tree build_capture_proxy (tree);
extern void insert_capture_proxy (tree);
extern void insert_pending_capture_proxies (void);
extern bool is_capture_proxy (tree);
extern bool is_normal_capture_proxy (tree);
extern void register_capture_members (tree);
extern tree lambda_expr_this_capture (tree, bool);
extern void maybe_generic_this_capture (tree, tree);
extern tree maybe_resolve_dummy (tree, bool);
extern tree current_nonlambda_function (void);
extern tree nonlambda_method_basetype (void);
extern tree current_nonlambda_scope (void);
extern bool generic_lambda_fn_p (tree);
extern void maybe_add_lambda_conv_op (tree);
extern bool is_lambda_ignored_entity (tree);
extern bool lambda_static_thunk_p (tree);
extern tree finish_builtin_launder (location_t, tree,
tsubst_flags_t);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
/* in tree.c */
extern int cp_tree_operand_length (const_tree);
extern int cp_tree_code_length (enum tree_code);
[multiple changes] 2009-09-01 Diego Novillo <dnovillo@google.com> * c-lang.c (lang_hooks): Remove const qualifier. java/ChangeLog * lang.c (lang_hooks): Remove const qualifier. objc/ChangeLog * objc-lang.c (lang_hooks): Remove const qualifier. objcp/ChangeLog * objcp-lang.c (lang_hooks): Remove const qualifier. ada/ChangeLog * gcc-interface/misc.c (lang_hooks): Remove const qualifier. fortran/ChangeLog * f95-lang.c (lang_hooks): Remove const qualifier. cp/ChangeLog * cp-lang.c (lang_hooks): Remove const qualifier. 2009-09-01 Diego Novillo <dnovillo@google.com> * cgraph.c (cgraph_node_for_decl): New. * cgraph.h (cgraph_node_for_decl): Declare. * tree.c (host_integerp): Return 0 if T is NULL. 2009-09-01 Diego Novillo <dnovillo@google.com> * tree.h (struct alias_pair): Move from varasm.c. (alias_pairs): Likewise. (TYPE_MAXVAL): Define. (TYPE_MINVAL): Define. (iterative_hash_host_wide_int): Declare. (remove_unreachable_alias_pairs): Declare. * tree-pass.h (pass_ipa_free_lang_data): Declare. * diagnostic.c (default_diagnostic_starter): Make extern. (default_diagnostic_finalizer): Make extern. * diagnostic.h (default_diagnostic_starter): Declare. (default_diagnostic_finalizer): Declare. (default_tree_printer): Declare. * toplev.c (default_tree_printer): Make extern. 2009-09-01 Richard Guenther <rguenther@suse.de> Diego Novillo <dnovillo@google.com> * cgraph.c (cgraph_add_new_function): Remove gimplification. * cgraphunit.c (cgraph_expand_function): Do not emit associated thunks from here. (cgraph_emit_thunks): New. (cgraph_optimize): Call it. Return if any IPA pass finds an error. * varasm.c (finish_aliases_1): Ignore errorneous aliases used by thunks. 2009-09-01 Simon Baldwin <simonb@google.com> Rafael Espindola <espindola@google.com> Richard Guenther <rguenther@suse.de> Doug Kwan <dougkwan@google.com> Diego Novillo <dnovillo@google.com> * tree.c: Include tree-pass.h, langhooks-def.h, diagnostic.h, cgraph.h, timevar.h, except.h and debug.h. (free_lang_data_in_type): New. (need_assembler_name_p): New. (free_lang_data_in_block): New. (free_lang_data_in_decl): New. (struct free_lang_data_d): New. (add_tree_to_fld_list): New. (find_decls_types_r): New. (get_eh_types_for_runtime): New. (find_decls_types_in_eh_region): New. (find_decls_types_in_node): New. (find_decls_types_in_var): New. (free_lang_data_in_cgraph): New. (free_lang_data): New. (gate_free_lang_data): New. (pass_ipa_free_lang_data): New. 2009-09-01 Diego Novillo <dnovillo@google.com> * timevar.def (TV_IPA_FREE_LANG_DATA): Define. * langhooks.h (struct lang_hooks): Add field free_lang_data. (lang_hooks): Remove const qualifier. * ipa.c (cgraph_remove_unreachable_nodes): Call remove_unreachable_alias_pairs. * except.c (add_type_for_runtime): Check if TYPE has already been converted. (lookup_type_for_runtime): Likewise. (check_handled): Handle converted types. * varasm.c (remove_unreachable_alias_pairs): New. * gimple.c: Include demangle.h. (gimple_decl_printable_name): New. (gimple_fold_obj_type_ref): New. * gimple.h (gimple_decl_printable_name): Declare. (gimple_fold_obj_type_ref): Declare. * passes.c (init_optimization_passes): Add pass pass_ipa_free_lang_data. * langhooks-def.h (LANG_HOOKS_FREE_LANG_DATA): Define. (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_FREE_LANG_DATA. testsuite/ChangeLog 2009-09-01 Diego Novillo <dnovillo@google.com> * gcc.dg/gomp/combined-1.c: Adjust expected pattern. * g++.dg/tree-prof/inline_mismatch_args.C: Likewise. * g++.dg/warn/unit-1.C: Likewise. * g++.dg/ipa/iinline-1.C: Likewise. * g++.dg/template/cond2.C: Adjust expected line location for the error. * g++.dg/template/pr35240.C: Likewise. cp/ChangeLog 2009-09-01 Doug Kwan <dougkwan@google.com> * tree.c (cp_fix_function_decl_p): New. (cp_free_lang_data): New. 2009-09-01 Diego Novillo <dnovillo@google.com> * Make-lang.in (decl2.o): Add dependency on $(POINTER_SET_H). * decl2.c: Include pointer-set.h. (collect_candidates_for_java_method_aliases): New. (cp_write_global_declarations): Call it. Add local variable CANDIDATES. If set, call build_java_method_aliases. (build_java_method_aliases): Add argument CANDIDATES. Use it to determine if FNDECL should get a hidden alias. * cp-objcp-common.h (LANG_HOOKS_FREE_LANG_DATA): Define. * cp-tree.h (cp_free_lang_data): Declare. 2009-09-03 Richard Guenther <rguenther@suse.de> * method.c (use_thunk): Use cgraph_finalize_function to hand off thunks to the cgraph. * semantics.c (emit_associated_thunks): Do not emit thunks for really extern functions. From-SVN: r151360
2009-09-03 06:07:12 +02:00
void cp_free_lang_data (tree t);
extern tree force_target_expr (tree, tree, tsubst_flags_t);
extern tree build_target_expr_with_type (tree, tree, tsubst_flags_t);
extern void lang_check_failed (const char *, int,
const char *) ATTRIBUTE_NORETURN;
extern tree stabilize_expr (tree, tree *);
extern void stabilize_call (tree, tree *);
extern bool stabilize_init (tree, tree *);
re PR c++/13684 (local static object variable constructed once but ctors and dtors called multiple times on same memory when called in multiple threads) PR c++/13684 * cp/decl.c (expand_static_init): Use thread-safety API. (register_dtor_fn): Return the call, don't expand it. * cp/tree.c (add_stmt_to_compound): New fn. (stabilize_call): Use it. * gimplify.c (gimplify_cleanup_point_expr): Handle CLEANUP_EH_ONLY. (gimple_push_cleanup): Add eh_only parm. (gimplify_target_expr): Pass it. * c.opt (-fno-threadsafe-statics): New option. * c-opts.c (c_common_handle_option): Handle it. * c-common.h (flag_threadsafe_statics): Declare it. * c-common.c (flag_threadsafe_statics): Record it. * doc/invoke.texi: Document it. * tsystem.h (_GNU_SOURCE): Define. * gthr-posix.h (__gthread_recursive_mutex_t): New typedef. (__GTHREAD_RECURSIVE_MUTEX_INIT): New macro. (__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION): New macro. (__gthread_recursive_mutex_init_function): New fn. (__gthread_recursive_mutex_lock): New fn. (__gthread_recursive_mutex_trylock): New fn. (__gthread_recursive_mutex_unlock): New fn. * gthr-solaris.h, gthr-single.h, gthr-dce.h: Likewise. * gthr-win32.h, gthr-vxworks.h: Likewise. * gthr.h: Document. * libsupc++/guard.cc (static_mutex): Internal class implementing a recursive mutex which controls initialization of local statics. (__gnu_cxx::recursive_init): New exception class. (__cxa_guard_acquire): Deal with locking and recursion detection. (acquire_1, __cxa_guard_abort, __cxa_guard_release): Likewise. From-SVN: r86687
2004-08-28 04:33:54 +02:00
extern tree add_stmt_to_compound (tree, tree);
extern void init_tree (void);
extern bool pod_type_p (const_tree);
extern bool layout_pod_type_p (const_tree);
extern bool std_layout_type_p (const_tree);
extern bool trivial_type_p (const_tree);
extern bool trivially_copyable_p (const_tree);
extern bool type_has_unique_obj_representations (const_tree);
extern bool scalarish_type_p (const_tree);
extern bool type_has_nontrivial_default_init (const_tree);
extern bool type_has_nontrivial_copy_init (const_tree);
c-common.c (const_strip_array_types): New. * c-common.c (const_strip_array_types): New. * c-common.h (lang_missing_noreturn_ok_p): Delete. (const_strip_array_types): New. * c-objc-common.c (c_disregard_inline_limits, c_warn_unused_global_decl): Constify. * c-tree.h (c_disregard_inline_limits, c_warn_unused_global_decl, c_vla_type_p, c_incomplete_type_error): Likewise. * c-typeck.c (c_incomplete_type_error, c_vla_type_p): Likewise. * hooks.c (hook_bool_const_tree_false): New. * hooks.h (hook_bool_const_tree_false): Likewise. * langhooks-def.h (lhd_warn_unused_global_decl, lhd_incomplete_type_error, lhd_expr_size, lhd_tree_inlining_disregard_inline_limits, lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, LANG_HOOKS_GENERIC_TYPE_P, LANG_HOOKS_TYPE_MAX_SIZE): Constify. * langhooks.c (lhd_warn_unused_global_decl, lhd_incomplete_type_error, lhd_tree_inlining_disregard_inline_limits, lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, lhd_expr_size): Likewise. * langhooks.h (lang_hooks_for_tree_inlining, lang_hooks_for_tree_dump, lang_hooks_for_types, lang_hooks_for_decls, lang_hooks): Likewise. * pointer-set.c (pointer_set_t, pointer_set_create, pointer_set_contains, insert_aux, pointer_set_insert, pointer_set_traverse, pointer_map_t, pointer_map_create, pointer_map_contains, pointer_map_insert, pointer_map_traverse): Likewise. * pointer-set.h (pointer_set_contains, pointer_set_insert, pointer_set_traverse, pointer_map_contains, pointer_map_insert, pointer_map_traverse): Likewise. * predict.c (assert_is_empty): Likewise. * tree-affine.c (free_name_expansion): Likewise. * tree-cfg.c (edge_to_cases_cleanup): Likewise. * tree.c (size_in_bytes, max_int_size_in_bytes): Likewise. * tree.h (size_in_bytes, max_int_size_in_bytes): Likewise. ada: * misc.c (gnat_type_max_size): Constify. cp: * cp-objcp-common.c (cxx_warn_unused_global_decl, cp_expr_size): Constify. * cp-tree.h (local_variable_p, nonstatic_local_decl_p, class_tmpl_impl_spec_p, cp_auto_var_in_fn_p, cp_type_quals, cxx_incomplete_type_diagnostic, cxx_incomplete_type_error, cxx_warn_unused_global_decl, cp_expr_size): Likewise. * decl.c (local_variable_p, nonstatic_local_decl_p): Likewise. * tree.c (class_tmpl_impl_spec_p, cp_auto_var_in_fn_p): Likewise. * typeck.c (cp_type_quals): Likewise. * typeck2.c (cxx_incomplete_type_diagnostic, cxx_incomplete_type_error): Likewise. From-SVN: r127560
2007-08-16 16:31:21 +02:00
extern bool class_tmpl_impl_spec_p (const_tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int zero_init_p (const_tree);
extern bool check_abi_tag_redeclaration (const_tree, const_tree, const_tree);
extern bool check_abi_tag_args (tree, tree);
extern tree strip_typedefs (tree, bool * = NULL);
extern tree strip_typedefs_expr (tree, bool * = NULL);
extern tree copy_binfo (tree, tree, tree,
tree *, int);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int member_p (const_tree);
extern cp_lvalue_kind real_lvalue_p (const_tree);
extern cp_lvalue_kind lvalue_kind (const_tree);
extern bool glvalue_p (const_tree);
extern bool obvalue_p (const_tree);
extern bool xvalue_p (const_tree);
extern bool bitfield_p (const_tree);
Bootstrapped/regtested on x86_64-linux, ok for trunk? 2016-04-25 Marek Polacek <polacek@redhat.com> PR c++/70744 * call.c (build_conditional_expr_1): Call cp_stabilize_reference instead of stabilize_reference. (build_over_call): Likewise. * cp-tree.h (cp_stabilize_reference): Declare. * tree.c (cp_stabilize_reference): New function. * typeck.c (cp_build_unary_op): Call cp_stabilize_reference instead of stabilize_reference. (unary_complex_lvalue): Likewise. (cp_build_modify_expr): Likewise. * g++.dg/ext/cond2.C: New test. diff --git gcc/cp/call.c gcc/cp/call.c index 11f2d42..476e806 100644 --- gcc/cp/call.c +++ gcc/cp/call.c @@ -4634,7 +4634,7 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, /* Make sure that lvalues remain lvalues. See g++.oliva/ext1.C. */ if (real_lvalue_p (arg1)) - arg2 = arg1 = stabilize_reference (arg1); + arg2 = arg1 = cp_stabilize_reference (arg1); else arg2 = arg1 = save_expr (arg1); } @@ -7644,8 +7644,9 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) || (TREE_CODE (arg) == TARGET_EXPR && !unsafe_copy_elision_p (fa, arg))) { - tree to = stabilize_reference (cp_build_indirect_ref (fa, RO_NULL, - complain)); + tree to = cp_stabilize_reference (cp_build_indirect_ref (fa, + RO_NULL, + complain)); val = build2 (INIT_EXPR, DECL_CONTEXT (fn), to, arg); return val; @@ -7655,7 +7656,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) && trivial_fn_p (fn) && !DECL_DELETED_FN (fn)) { - tree to = stabilize_reference + tree to = cp_stabilize_reference (cp_build_indirect_ref (argarray[0], RO_NULL, complain)); tree type = TREE_TYPE (to); tree as_base = CLASSTYPE_AS_BASE (type); diff --git gcc/cp/cp-tree.h gcc/cp/cp-tree.h index ec92718..0e46ae1 100644 --- gcc/cp/cp-tree.h +++ gcc/cp/cp-tree.h @@ -6494,6 +6494,7 @@ extern cp_lvalue_kind real_lvalue_p (const_tree); extern cp_lvalue_kind lvalue_kind (const_tree); extern bool lvalue_or_rvalue_with_address_p (const_tree); extern bool xvalue_p (const_tree); +extern tree cp_stabilize_reference (tree); extern bool builtin_valid_in_constant_expr_p (const_tree); extern tree build_min (enum tree_code, tree, ...); extern tree build_min_nt_loc (location_t, enum tree_code, diff --git gcc/cp/tree.c gcc/cp/tree.c index 112c8c7..137186f 100644 --- gcc/cp/tree.c +++ gcc/cp/tree.c @@ -296,6 +296,46 @@ xvalue_p (const_tree ref) return (lvalue_kind (ref) == clk_rvalueref); } +/* C++-specific version of stabilize_reference. */ + +tree +cp_stabilize_reference (tree ref) +{ + switch (TREE_CODE (ref)) + { + /* We need to treat specially anything stabilize_reference doesn't + handle specifically. */ + case VAR_DECL: + case PARM_DECL: + case RESULT_DECL: + CASE_CONVERT: + case FLOAT_EXPR: + case FIX_TRUNC_EXPR: + case INDIRECT_REF: + case COMPONENT_REF: + case BIT_FIELD_REF: + case ARRAY_REF: + case ARRAY_RANGE_REF: + case COMPOUND_EXPR: + case ERROR_MARK: + break; + default: + cp_lvalue_kind kind = lvalue_kind (ref); + if ((kind & ~clk_class) != clk_none) + { + tree type = unlowered_expr_type (ref); + bool rval = !!(kind & clk_rvalueref); + type = cp_build_reference_type (type, rval); + /* This inhibits warnings in, eg, cxx_mark_addressable + (c++/60955). */ + warning_sentinel s (extra_warnings); + ref = build_static_cast (type, ref, tf_error); + } + } + + return stabilize_reference (ref); +} + /* Test whether DECL is a builtin that may appear in a constant-expression. */ diff --git gcc/cp/typeck.c gcc/cp/typeck.c index cef5604..7e12009 100644 --- gcc/cp/typeck.c +++ gcc/cp/typeck.c @@ -5912,7 +5912,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert, { tree real, imag; - arg = stabilize_reference (arg); + arg = cp_stabilize_reference (arg); real = cp_build_unary_op (REALPART_EXPR, arg, 1, complain); imag = cp_build_unary_op (IMAGPART_EXPR, arg, 1, complain); real = cp_build_unary_op (code, real, 1, complain); @@ -6112,7 +6112,7 @@ unary_complex_lvalue (enum tree_code code, tree arg) tree lvalue = TREE_OPERAND (arg, 0); if (TREE_SIDE_EFFECTS (lvalue)) { - lvalue = stabilize_reference (lvalue); + lvalue = cp_stabilize_reference (lvalue); arg = build2 (TREE_CODE (arg), TREE_TYPE (arg), lvalue, TREE_OPERAND (arg, 1)); } @@ -7496,7 +7496,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs, case PREINCREMENT_EXPR: if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0))) lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs), - stabilize_reference (TREE_OPERAND (lhs, 0)), + cp_stabilize_reference (TREE_OPERAND (lhs, 0)), TREE_OPERAND (lhs, 1)); newrhs = cp_build_modify_expr (TREE_OPERAND (lhs, 0), modifycode, rhs, complain); @@ -7516,7 +7516,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs, case MODIFY_EXPR: if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0))) lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs), - stabilize_reference (TREE_OPERAND (lhs, 0)), + cp_stabilize_reference (TREE_OPERAND (lhs, 0)), TREE_OPERAND (lhs, 1)); newrhs = cp_build_modify_expr (TREE_OPERAND (lhs, 0), modifycode, rhs, complain); @@ -7665,7 +7665,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs, not intervene between the lvalue-to-rvalue conversion and the side effect associated with any single compound assignment operator. -- end note ] */ - lhs = stabilize_reference (lhs); + lhs = cp_stabilize_reference (lhs); rhs = rvalue (rhs); rhs = stabilize_expr (rhs, &init); newrhs = cp_build_binary_op (input_location, diff --git gcc/testsuite/g++.dg/ext/cond2.C gcc/testsuite/g++.dg/ext/cond2.C index e69de29..d9f1d59 100644 --- gcc/testsuite/g++.dg/ext/cond2.C +++ gcc/testsuite/g++.dg/ext/cond2.C @@ -0,0 +1,28 @@ +// PR c++/70744 +// { dg-do run } +// { dg-options "" } + +static void +fn1 (void) +{ + int x = 2; + ++x ? : 42; + if (x != 3) + __builtin_abort (); + --x ? : 42; + if (x != 2) + __builtin_abort (); + x++ ? : 42; + if (x != 3) + __builtin_abort (); + x-- ? : 42; + if (x != 2) + __builtin_abort (); +} + +int +main () +{ + fn1 (); + return 0; +} From-SVN: r235438
2016-04-26 13:32:26 +02:00
extern tree cp_stabilize_reference (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern bool builtin_valid_in_constant_expr_p (const_tree);
extern tree build_min (enum tree_code, tree, ...);
extern tree build_min_nt_loc (location_t, enum tree_code,
...);
extern tree build_min_non_dep (enum tree_code, tree, ...);
extern tree build_min_non_dep_op_overload (enum tree_code, tree, 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
extern tree build_min_non_dep_call_vec (tree, tree, vec<tree, va_gc> *);
extern vec<tree, va_gc>* vec_copy_and_insert (vec<tree, va_gc>*, tree, unsigned);
extern tree build_cplus_new (tree, tree, tsubst_flags_t);
extern tree build_aggr_init_expr (tree, tree);
extern tree get_target_expr (tree);
extern tree get_target_expr_sfinae (tree, tsubst_flags_t);
extern tree build_cplus_array_type (tree, tree);
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
extern tree build_array_of_n_type (tree, int);
extern bool array_of_runtime_bound_p (tree);
extern tree build_array_copy (tree);
extern tree build_vec_init_expr (tree, tree, tsubst_flags_t);
extern void diagnose_non_constexpr_vec_init (tree);
extern tree hash_tree_cons (tree, tree, tree);
extern tree hash_tree_chain (tree, tree);
2006-06-06 13:44:09 +02:00
extern tree build_qualified_name (tree, tree, tree, bool);
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
extern tree build_ref_qualified_type (tree, cp_ref_qualifier);
extern int is_overloaded_fn (tree);
extern tree dependent_name (tree);
extern tree get_fns (tree);
extern tree get_first_fn (tree);
extern tree ovl_cons (tree, tree);
extern tree build_overload (tree, tree);
extern tree ovl_scope (tree);
extern const char *cxx_printable_name (tree, int);
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
extern const char *cxx_printable_name_translate (tree, int);
Implement P0012R1, Make exception specifications part of the type system. gcc/cp/ * cp-tree.h (enum tsubst_flags): Add tf_fndecl_type. (flag_noexcept_type, ce_type): New. * call.c (build_conv): Add ck_fnptr. (enum conversion_kind): Change ck_tsafe to ck_fnptr. (convert_like_real): Likewise. (standard_conversion): Likewise. Allow function pointer conversions for pointers to member functions. (reference_compatible_p): Allow function pointer conversions. (direct_reference_binding): Likewise. (reference_binding): Reference-compatible is no longer a subset of reference-related. (is_subseq): Also strip ck_lvalue after next_conversion. * class.c (instantiate_type): Check fnptr_conv_p. (resolve_address_of_overloaded_function): Likewise. * cvt.c (can_convert_tx_safety): Now static. (noexcept_conv_p, fnptr_conv_p, strip_fnptr_conv): New. * decl.c (flag_noexcept_type): Define. (cxx_init_decl_processing): Set it. (bad_specifiers): Check it. (grokdeclarator) [cdk_function]: Add exception-spec to type here. * lambda.c (maybe_add_lambda_conv_op): Add exception-spec to returned pointer. * mangle.c (struct globals): Add need_cxx1z_warning. (mangle_decl): Check it. (write_exception_spec): New. (write_function_type): Call it. (canonicalize_for_substitution): Handle exception spec. (write_type): Likewise. (write_encoding): Set processing_template_decl across mangling of partially-instantiated type. * pt.c (determine_specialization): Pass tf_fndecl_type. (tsubst_decl, fn_type_unification): Likewise. (tsubst): Strip tf_fndecl_type, pass it to tsubst_exception_specification. (convert_nontype_argument_function): Handle function pointer conversion. (convert_nontype_argument): Likewise. (unify, for_each_template_parm_r): Walk into noexcept-specifier. * rtti.c (ptr_initializer): Encode noexcept. * tree.c (canonical_eh_spec): New. (build_exception_variant): Use it. * typeck.c (composite_pointer_type): Handle fnptr conversion. (comp_except_specs): Compare canonical EH specs. (structural_comptypes): Call it. gcc/c-family/ * c.opt (Wc++1z-compat): New. * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_noexcept_function_type. libstdc++-v3/ * include/bits/c++config (_GLIBCXX_NOEXCEPT_PARM) (_GLIBCXX_NOEXCEPT_QUAL): New. * include/std/type_traits (is_function): Use them. * libsubc++/new (launder): Likewise. * libsupc++/cxxabi.h (__pbase_type_info::__masks): Add __noexcept_mask. * libsupc++/pbase_type_info.cc (__do_catch): Handle function pointer conversion. libiberty/ * cp-demangle.c (is_fnqual_component_type): New. (d_encoding, d_print_comp_inner, d_print_mod_list): Use it. (FNQUAL_COMPONENT_CASE): New. (d_make_comp, has_return_type, d_print_comp_inner) (d_print_function_type): Use it. (next_is_type_qual): New. (d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec. include/ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC. From-SVN: r241944
2016-11-08 00:09:29 +01:00
extern tree canonical_eh_spec (tree);
extern tree build_exception_variant (tree, tree);
extern tree bind_template_template_parm (tree, tree);
extern tree array_type_nelts_total (tree);
extern tree array_type_nelts_top (tree);
extern tree break_out_target_exprs (tree);
extern tree build_ctor_subob_ref (tree, tree, tree);
extern tree replace_placeholders (tree, tree, bool * = NULL);
extern tree get_type_decl (tree);
extern tree decl_namespace_context (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern bool decl_anon_ns_mem_p (const_tree);
extern tree lvalue_type (tree);
extern tree error_type (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int varargs_function_p (const_tree);
extern bool really_overloaded_fn (tree);
extern bool cp_tree_equal (tree, tree);
c-common.h (lang_post_pch_load): New variable. * c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-07-29 19:59:31 +02:00
extern tree no_linkage_check (tree, bool);
extern void debug_binfo (tree);
extern tree build_dummy_object (tree);
extern tree maybe_dummy_object (tree, tree *);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int is_dummy_object (const_tree);
attribs.c (c_common_attribute_table): Move table and handlers to c-common.c. * attribs.c (c_common_attribute_table): Move table and handlers to c-common.c. (format_attribute_table, lang_attribute_table, lang_attribute_common): Remove. (init_attributes): Replace NULL pointers with pointers to the empty table. (handle_packed_attribute, handle_nocommon_attribute, handle_common_attribute, handle_noreturn_attribute, handle_noinline_attribute, handle_always_inline_attribute, handle_used_attribute, handle_unused_attribute, handle_const_attribute, handle_transparent_union_attribute, handle_constructor_attribute, handle_destructor_attribute, handle_mode_attribute, handle_section_attribute, handle_aligned_attribute, handle_weak_attribute, handle_alias_attribute, handle_visibility_attribute, handle_no_instrument_function_attribute, handle_malloc_attribute, handle_no_limit_stack_attribute, handle_pure_attribute, handle_deprecated_attribute, handle_vector_size_attribute, vector_size_helper): Move to c-common.c. * c-common.c (c_common_attribute_table, handle_packed_attribute, handle_nocommon_attribute, handle_common_attribute, handle_noreturn_attribute, handle_noinline_attribute, handle_always_inline_attribute, handle_used_attribute, handle_unused_attribute, handle_const_attribute, handle_transparent_union_attribute, handle_constructor_attribute, handle_destructor_attribute, handle_mode_attribute, handle_section_attribute, handle_aligned_attribute, handle_weak_attribute, handle_alias_attribute, handle_visibility_attribute, handle_no_instrument_function_attribute, handle_malloc_attribute, handle_no_limit_stack_attribute, handle_pure_attribute, handle_deprecated_attribute, handle_vector_size_attribute, vector_size_helper): Move from attribs.c. * c-common.h (c_common_attribute_table, c_common_format_attribute_table): New. * c-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine. * langhooks-def.h (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE): New. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (struct lang_hooks): 3 new attribute hooks. * target-def.h (TARGET_ATTRIBUTE_TABLE): Default to NULL. * target.h: Update comment. * tree.c (default_target_attribute_table): Remove. * tree.h (default_target_attribute_table, format_attribute_table, lang_attribute_table, lang_attribute_common): Remove. ada: * misc.c (gnat_init): Don't set lang_attribute_common. cp: * cp-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE): Redefine. * cp-tree.h (cp_attribute_table): Rename. * decl.c (lang_attribute_table): Remove declaration. (cxx_init_decl_processing): Don't set it. * tree.c (cp_attribute_table): Rename. objc: * objc-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine. From-SVN: r52730
2002-04-24 22:41:04 +02:00
extern const struct attribute_spec cxx_attribute_table[];
extern tree make_ptrmem_cst (tree, tree);
extern tree cp_build_type_attribute_variant (tree, tree);
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
extern tree cp_build_reference_type (tree, bool);
extern tree move (tree);
extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t);
#define cp_build_qualified_type(TYPE, QUALS) \
cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
extern bool cv_qualified_p (const_tree);
extern tree cv_unqualified (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern special_function_kind special_function_p (const_tree);
extern int count_trees (tree);
extern int char_type_p (tree);
extern void verify_stmt_tree (tree);
extern linkage_kind decl_linkage (tree);
extern duration_kind decl_storage_duration (tree);
extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
void*, hash_set<tree> *);
#define cp_walk_tree(tp,func,data,pset) \
walk_tree_1 (tp, func, data, pset, cp_walk_subtrees)
#define cp_walk_tree_without_duplicates(tp,func,data) \
walk_tree_without_duplicates_1 (tp, func, data, cp_walk_subtrees)
2006-06-06 13:44:09 +02:00
extern tree rvalue (tree);
extern tree convert_bitfield_to_declared_type (tree);
2006-06-06 13:44:09 +02:00
extern tree cp_save_expr (tree);
extern bool cast_valid_in_integral_constant_expression_p (tree);
extern bool cxx_type_hash_eq (const_tree, const_tree);
extern tree cxx_copy_lang_qualifiers (const_tree, const_tree);
2006-06-06 13:44:09 +02:00
extern void cxx_print_statistics (void);
extern bool maybe_warn_zero_as_null_pointer_constant (tree, location_t);
/* in ptree.c */
extern void cxx_print_xnode (FILE *, tree, int);
extern void cxx_print_decl (FILE *, tree, int);
extern void cxx_print_type (FILE *, tree, int);
extern void cxx_print_identifier (FILE *, tree, int);
opts-common.c (handle_option, [...]): Add diagnostic_context parameter. * opts-common.c (handle_option, handle_generated_option, read_cmdline_option, set_option): Add diagnostic_context parameter. Update calls among these functions. (set_option): Don't use global_dc. * opts.c (read_cmdline_options): Pass global_dc to read_cmdline_option. (decode_options): Pass global_dc to enable_warning_as_error. (common_handle_option): Pass global_dc to enable_warning_as_error. (enable_warning_as_error): Add diagnostic_context parameter. Document parameters. Don't use global_dc. Pass diagnostic_context parameter to handle_generated_option. * opts.h (set_option, handle_option, handle_generated_option, read_cmdline_option, enable_warning_as_error): Add diagnostic_context parameter. * Makefile.in (lto-opts.o): Update dependencies. * coretypes.h (struct diagnostic_context, diagnostic_context): Declare here. * diagnostic.h (diagnostic_context): Don't declare typedef here. * gcc.c (process_command): Pass global_dc to read_cmdline_option. * langhooks-def.h (struct diagnostic_context): Don't declare here. (lhd_print_error_function, lhd_initialize_diagnostics): Declare using diagnostic_context typedef. * langhooks.c (lhd_initialize_diagnostics): Declare using diagnostic_context typedef. * langhooks.h (struct diagnostic_context): Don't declare here. (initialize_diagnostics, print_error_function): Declare using diagnostic_context typedef. * lto-opts.c: Include diagnostic.h. (lto_reissue_options): Pass global_dc to set_option. Pass DK_UNSPECIFIED not 0. * plugin.c (plugins_internal_error_function): Declare using diagnostic_context typedef. * plugin.h (struct diagnostic_context): Don't declare here. (plugins_internal_error_function): Declare using diagnostic_context typedef. c-family: * c-common.h (struct diagnostic_context): Don't declare here. (c_common_initialize_diagnostics): Declare using diagnostic_context typedef. * c-opts.c (c_common_handle_option): Pass global_dc to handle_generated_option. cp: * cp-tree.h (cxx_print_error_function, cxx_initialize_diagnostics): Declare using diagnostic_context typedef. From-SVN: r164991
2010-10-05 16:28:39 +02:00
extern void cxx_print_error_function (diagnostic_context *,
const char *,
struct diagnostic_info *);
/* in typeck.c */
extern bool cxx_mark_addressable (tree, bool = false);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int string_conv_p (const_tree, const_tree, int);
extern tree cp_truthvalue_conversion (tree);
extern tree condition_conversion (tree);
extern tree require_complete_type (tree);
extern tree require_complete_type_sfinae (tree, tsubst_flags_t);
extern tree complete_type (tree);
extern tree complete_type_or_else (tree, tree);
extern tree complete_type_or_maybe_complain (tree, tree, tsubst_flags_t);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern int type_unknown_p (const_tree);
Implement P0012R1, Make exception specifications part of the type system. gcc/cp/ * cp-tree.h (enum tsubst_flags): Add tf_fndecl_type. (flag_noexcept_type, ce_type): New. * call.c (build_conv): Add ck_fnptr. (enum conversion_kind): Change ck_tsafe to ck_fnptr. (convert_like_real): Likewise. (standard_conversion): Likewise. Allow function pointer conversions for pointers to member functions. (reference_compatible_p): Allow function pointer conversions. (direct_reference_binding): Likewise. (reference_binding): Reference-compatible is no longer a subset of reference-related. (is_subseq): Also strip ck_lvalue after next_conversion. * class.c (instantiate_type): Check fnptr_conv_p. (resolve_address_of_overloaded_function): Likewise. * cvt.c (can_convert_tx_safety): Now static. (noexcept_conv_p, fnptr_conv_p, strip_fnptr_conv): New. * decl.c (flag_noexcept_type): Define. (cxx_init_decl_processing): Set it. (bad_specifiers): Check it. (grokdeclarator) [cdk_function]: Add exception-spec to type here. * lambda.c (maybe_add_lambda_conv_op): Add exception-spec to returned pointer. * mangle.c (struct globals): Add need_cxx1z_warning. (mangle_decl): Check it. (write_exception_spec): New. (write_function_type): Call it. (canonicalize_for_substitution): Handle exception spec. (write_type): Likewise. (write_encoding): Set processing_template_decl across mangling of partially-instantiated type. * pt.c (determine_specialization): Pass tf_fndecl_type. (tsubst_decl, fn_type_unification): Likewise. (tsubst): Strip tf_fndecl_type, pass it to tsubst_exception_specification. (convert_nontype_argument_function): Handle function pointer conversion. (convert_nontype_argument): Likewise. (unify, for_each_template_parm_r): Walk into noexcept-specifier. * rtti.c (ptr_initializer): Encode noexcept. * tree.c (canonical_eh_spec): New. (build_exception_variant): Use it. * typeck.c (composite_pointer_type): Handle fnptr conversion. (comp_except_specs): Compare canonical EH specs. (structural_comptypes): Call it. gcc/c-family/ * c.opt (Wc++1z-compat): New. * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_noexcept_function_type. libstdc++-v3/ * include/bits/c++config (_GLIBCXX_NOEXCEPT_PARM) (_GLIBCXX_NOEXCEPT_QUAL): New. * include/std/type_traits (is_function): Use them. * libsubc++/new (launder): Likewise. * libsupc++/cxxabi.h (__pbase_type_info::__masks): Add __noexcept_mask. * libsupc++/pbase_type_info.cc (__do_catch): Handle function pointer conversion. libiberty/ * cp-demangle.c (is_fnqual_component_type): New. (d_encoding, d_print_comp_inner, d_print_mod_list): Use it. (FNQUAL_COMPONENT_CASE): New. (d_make_comp, has_return_type, d_print_comp_inner) (d_print_function_type): Use it. (next_is_type_qual): New. (d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec. include/ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC. From-SVN: r241944
2016-11-08 00:09:29 +01:00
enum { ce_derived, ce_type, ce_normal, ce_exact };
extern bool comp_except_specs (const_tree, const_tree, int);
extern bool comptypes (tree, tree, int);
extern bool same_type_ignoring_top_level_qualifiers_p (tree, tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern bool compparms (const_tree, const_tree);
extern int comp_cv_qualification (const_tree, const_tree);
extern int comp_cv_qualification (int, int);
extern int comp_cv_qual_signature (tree, tree);
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code, bool);
extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool);
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
extern tree cxx_alignas_expr (tree);
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
extern tree cxx_sizeof_nowarn (tree);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern tree is_bitfield_expr_with_lowered_type (const_tree);
extern tree unlowered_expr_type (const_tree);
extern tree decay_conversion (tree,
tsubst_flags_t,
bool = true);
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
extern tree build_class_member_access_expr (cp_expr, tree, tree, bool,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
extern tree finish_class_member_access_expr (cp_expr, tree, bool,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern tree build_x_indirect_ref (location_t, tree,
ref_operator, tsubst_flags_t);
re PR c/40885 (build_indirect_ref i18n problems) 2009-12-17 Shujing Zhao <pearly.zhao@oracle.com> PR c/40885 * c-common.h (ref_operator): New type. (build_indirect_ref): Adjust prototype with new argument. * c-typeck.c (build_indirect_ref): Accept ref_operator as argument and emit the diagnostics for easy translation. (build_array_ref): Update calls to build_indirect_ref. * c-omp.c (c_finish_omp_atomic): Likewise. * c-parser.c (c_parser_unary_expression, c_parser_postfix_expression_after_primary): Likewise. cp/ 2009-12-17 Shujing Zhao <pearly.zhao@oracle.com> * typeck.c (build_indirect_ref): Update the argument. (build_x_indirect_ref): Likewise. (cp_build_indirect_ref): Update the argument and emit the diagnostics for easy translation. (build_class_member_access_expr, build_array_ref, get_member_function_from_ptrfunc): Update calls. * cp-tree.h (build_x_indirect_ref, cp_build_indirect_ref): Update prototypes. * call.c (build_new_op, convert_like_real, build_x_va_arg, build_over_call): Update calls. * class.c (build_base_path, build_simple_base_path, build_vfn_ref): Likewise. * decl.c (start_preparsed_function): Likewise. * except.c (expand_start_catch_block, build_throw): Likewise. * init.c (emit_mem_initializers, expand_virtual_init, expand_virtual_init, build_new_1, build_vec_init, build_delete, build_vec_delete): Likewise. * parser.c (cp_parser_unary_expression): Likewise. * pt.c (tsubst_copy_and_build): Likewise. * rtti.c (build_headof, get_tinfo_decl_dynamic, get_typeid): Likewise. * semantics.c (finish_non_static_data_member, thisify_lambda_field): Likewise. * tree.c (build_dummy_object, stabilize_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. testsuite/ 2009-12-17 Shujing Zhao <pearly.zhao@oracle.com> * g++.old-deja/g++.mike/net31.C: Make expected dg-error strings explicit. * g++.old-deja/g++.bugs/900213_02.C: Likewise. * g++.old-deja/g++.bugs/900215_02.C: Likewise. From-SVN: r155302
2009-12-17 04:22:22 +01:00
extern tree cp_build_indirect_ref (tree, ref_operator,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern tree build_array_ref (location_t, tree, tree);
extern tree cp_build_array_ref (location_t, tree, tree,
tsubst_flags_t);
re PR c++/52422 ([C++11][SFINAE] Hard errors with void or arithmetic expressions) /cp 2012-04-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52422 * cp-tree.h (build_addr_func, decay_conversion, get_member_function_from_ptrfunc, build_m_component_ref, convert_member_func_to_ptr): Add tsubst_flags_t parameter. * typeck.c (cp_default_conversion): Add. (decay_conversion, default_conversion, get_member_function_from_ptrfunc, convert_member_func_to_ptr): Add tsubst_flags_t parameter and use it throughout. (cp_build_indirect_ref, cp_build_array_ref, cp_build_function_call_vec, convert_arguments, build_x_binary_op, cp_build_binary_op, cp_build_unary_op, build_reinterpret_cast_1, build_const_cast_1, expand_ptrmemfunc_cst, convert_for_initialization): Adjust. * init.c (build_vec_init): Adjust. * decl.c (grok_reference_init, get_atexit_node): Likewise. * rtti.c (build_dynamic_cast_1, tinfo_base_init): Likewise. * except.c (build_throw): Likewise. * typeck2.c (build_x_arrow): Likewise. (build_m_component_ref): Add tsubst_flags_t parameter and use it throughout. * pt.c (convert_nontype_argument): Adjust. * semantics.c (finish_asm_stmt, maybe_add_lambda_conv_op): Likewise. * decl2.c (build_offset_ref_call_from_tree): Likewise. * call.c (build_addr_func): Add tsubst_flags_t parameter and use it throughout. (build_call_a, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, build_over_call, build_special_member_call): Adjust. * cvt.c (cp_convert_to_pointer, force_rvalue, build_expr_type_conversion): Likewise. /testsuite 2012-04-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52422 * g++.dg/cpp0x/sfinae33.C: New. * g++.dg/cpp0x/sfinae34.C: Likewise. From-SVN: r186565
2012-04-18 12:21:43 +02:00
extern tree get_member_function_from_ptrfunc (tree *, tree, tsubst_flags_t);
extern tree cp_build_function_call_nary (tree, tsubst_flags_t, ...)
ATTRIBUTE_SENTINEL;
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
extern tree cp_build_function_call_vec (tree, vec<tree, va_gc> **,
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
tsubst_flags_t);
extern tree build_x_binary_op (location_t,
enum tree_code, tree,
re PR c++/19564 (-Wparentheses does not work with the C++ front-end) PR c++/19564 PR c++/19756 gcc/: * c-typeck.c (parser_build_binary_op): Move parentheses warnings to warn_about_parentheses in c-common.c. * c-common.c (warn_about_parentheses): New function. * c-common.h (warn_about_parentheses): Declare. * doc/invoke.texi (Warning Options): Update -Wparentheses description. gcc/cp/: * parser.c (cp_parser_expression_stack_entry): Add field lhs_type. (cp_parser_binary_expression): Track tree code of left hand side of expression. Use it when calling build_x_binary_op. (cp_parser_selection_statement): Add if_p parameter. Change all callers. Warn about ambiguous else. (cp_parser_statement): Add if_p parameter. Change all callers. (cp_parser_implicitly_scoped_statement): Likewise. * typeck.c (build_x_binary_op): Add parameters arg1_code and arg2_code. Change all callers. Call warn_about_parentheses. * cp-tree.h (build_x_binary_op): Update declaration. gcc/testsuite/: * g++.dg/warn/Wparentheses-5.C: New test. * g++.dg/warn/Wparentheses-6.C: New test. * g++.dg/warn/Wparentheses-7.C: New test. * g++.dg/warn/Wparentheses-8.C: New test. * g++.dg/warn/Wparentheses-9.C: New test. * g++.dg/warn/Wparentheses-10.C: New test. * g++.dg/warn/Wparentheses-11.C: New test. * g++.dg/warn/Wparentheses-12.C: New test. * g++.dg/warn/Wparentheses-13.C: New test. * g++.dg/warn/Wparentheses-14.C: New test. * g++.dg/warn/Wparentheses-15.C: New test. * g++.dg/warn/Wparentheses-16.C: New test. * g++.dg/warn/Wparentheses-17.C: New test. * g++.dg/warn/Wparentheses-18.C: New test. * g++.dg/warn/Wparentheses-19.C: New test. * g++.dg/warn/Wparentheses-20.C: New test. * g++.dg/warn/Wparentheses-21.C: New test. libstdc++-v3/: * include/bits/locale_facets.tcc (num_get<>::_M_extract_float): Add parentheses around && within || to avoid warning. (num_get<>::_M_extract_int): Likewise. (money_get<>::_M_extract): Likewise. (num_get<>::do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, void*&)): Add parentheses around & within | to avoid warning. (num_put<>::do_put(iter_type, ios_base&, char_type, const void*)): Likewise. * include/bits/streambuf_iterator.h (istreambuf_iterator::equal): Add parentheses around && within || to avoid warning. * libsupc++/tinfo.cc (__do_dyncast): Likewise. * src/locale.cc (locale::_S_normalize_category): Likewise. * include/bits/stl_tree.h (_Rb_tree<>::_M_insert_unique): Add braces to avoid ambiguous else warning. * src/strstream.cc (strstreambuf::_M_free): Likewise. * src/tree.cc (_Rb_tree_rebalance_for_erase): Likewise. From-SVN: r119855
2006-12-14 06:49:06 +01:00
enum tree_code, tree,
enum tree_code, tree *,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern tree build_x_array_ref (location_t, tree, tree,
tsubst_flags_t);
extern tree build_x_unary_op (location_t,
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
enum tree_code, cp_expr,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern tree cp_build_addressof (location_t, tree,
tsubst_flags_t);
extern tree cp_build_addr_expr (tree, tsubst_flags_t);
extern tree cp_build_unary_op (enum tree_code, tree, bool,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern tree unary_complex_lvalue (enum tree_code, tree);
extern tree build_x_conditional_expr (location_t, tree, tree, tree,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern tree build_x_compound_expr_from_list (tree, expr_list_kind,
tsubst_flags_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
extern tree build_x_compound_expr_from_vec (vec<tree, va_gc> *,
const char *, tsubst_flags_t);
extern tree build_x_compound_expr (location_t, tree, tree,
tsubst_flags_t);
java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. gcc/java/ * java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. * expr.c (force_evaluation_order): Same. * typeck.c: Add location to build_decl or PUSH_FIELD calls. * class.c: Same. * decl.c: Same. * jcf-parse.c: Same. * constants.c: Same. * resource.c: Same. * except.c: Same. * builtins.c: Same. * expr.c: Same. * java-tree.h (PUSH_FIELD): Add location field. gcc/objc/ * objc-act.c (finish_var_decl): Pass location to finish_decl. (objc_get_parm_info): Same. (get_super_receiver): Same. * objc-act.c (objc_build_component_ref): Pass location to build_compound_ref. (build_module_initializer_routine): Pass location to c_end_compound_stmt. (objc_generate_static_init_call): Pass location to build_stmt. (build_typed_selector_reference): New location argument. (build_selector_reference): Same. (objc_substitute_decl): Pass location to build_array_ref. (next_sjlj_build_try_catch_finally): Pass location to build_stmt. (objc_begin_catch_clause): Same. (objc_finish_try_stmt): Same. (objc_finish_catch_clause): Pass location to c_end_compound_stmt. (objc_build_throw_stmt): New argument. (generate_shared_structures): Pass location to build_c_cast. (objc_build_message_expr): Use local location. (objc_finish_message_expr): Use input_location. (build_objc_method_call): New argument. (objc_build_selector_expr): Same. (get_super_receiver): Pass location to build_c_cast, build_modify_expr, build_compound_expr. * objc-act.c: Add location to all calls to start_struct, build_decl, finish_struct. gcc/ * tree-pretty-print.c (dump_generic_node): Dump column numbers. * gimple-pretty-print.c (dump_gimple_stmt): Same. * gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs created. * c-parser.c (c_parser_binary_expression): Use current column while building binary operations. * common.opt (fshow-column): Enable by default. * tree-vrp.c (check_array_ref): Use warning_at. (check_array_bounds): Use location from call back if expr has no location. * tree.h: Add location argument to maybe_fold_*. * tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*. (maybe_fold_offset_to_array_ref): Add location argument and use it. (maybe_fold_offset_to_component_ref): Same. (maybe_fold_offset_to_reference): Same. (maybe_fold_offset_to_address): Same. (maybe_fold_stmt_indirect): Same. (maybe_fold_stmt_addition): Same. (fold_stmt_r): Pass location to maybe_fold_*. (fold_gimple_assign): Same. * c-tree.h: Add location argument to finish_decl, default_function_array_conversion, store_init_value. * c-decl.c (define_label): Use error_at. (c_make_fname_decl): Pass location to finish_decl. (finish_decl): New location argument. (build_compound_literal): Pass location to store_init_value. (grokdeclarator): Pass location to finish_decl. (grokfield): Same. * c-typeck.c (array_to_pointer_conversion): New location argument. (function_to_pointer_conversion): Same. (default_function_array_conversion): Same. (parser_build_unary_op): Pass location to overflow_warning. (parser_build_binary_op): Same. Use warning_at. (build_unary_op): Pass location to array_to_pointer_conversion. (build_c_cast): Pass location to digest_init. (build_modify_expr): New location argument. (convert_for_assignment): Same. (store_init_value): Same. (digest_init): Same. (output_init_element): Pass location to digest_init and array_to_pointer_conversion. (c_finish_return): Pass location to convert_for_assignment. * gimplify.c (gimplify_conversion): Pass location to maybe_fold_offset_to_address. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location to maybe_fold_stmt_addition. * c-omp.c (c_finish_omp_atomic): Pass new location to build_modify_expr. (c_finish_omp_for): Same. * c-common.c (overflow_warning): New argument. * c-common.h: New argument to build_modify_expr, overflow_warning. * c-parser.c (c_parser_declaration_or_fndef): Pass location to finish_decl. (c_parser_initializer): Pass location to default_function_array_conversion. (c_parser_initelt): Same. (c_parser_initval): Same. (c_parser_asm_operands): Same. (c_parser_expr_no_commas): Same. Pass location to build_modify_expr. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Add location info to stack. Use it. (c_parser_unary_expression): Pass location to default_function_array_conversion, parser_build_unary_op, build_indirect_ref, c_parser_postfix_expression_after_primary. (c_parser_postfix_expression_after_primary): New location argument. Use it. (c_parser_expression_conv): Pass location to default_function_array_conversion. (c_parser_expr_list): Same. (c_parser_omp_atomic): Same. (c_parser_omp_for_loop): Same. * c-tree.h: (struct c_declarator): Add comment to id_loc. (build_array_declarator): New argument. * c-decl.c (build_array_declarator): Add location argument. (grokdeclarator): Set id_loc for cdk_array. * c-parser.c (c_parser_direct_declarator_inner): Pass location to build_array_declarator. * tree.c (build_omp_clause): Add location argument. * tree.h (OMP_CLAUSE_HAS_LOCATION): New macro. (OMP_CLAUSE_LOCATION): New macro. (struct tree_omp_clause): Add location field. (build_omp_clause): Add argument. * testsuite/gcc.dg/gomp/for-1.c: Fix column. * cp/pt.c (tsubst_omp_for_iterator): Pass location to build_omp_clause. * cp/parser.c (cp_parser_omp_var_list_no_open): Same. (cp_parser_omp_clause_collapse): Same. (cp_parser_omp_clause_default): Same. (cp_parser_omp_clause_if): Same. (cp_parser_omp_clause_nowait): Same. (cp_parser_omp_clause_num_threads): Same. (cp_parser_omp_clause_ordered): Same. (cp_parser_omp_clause_schedule): Same. (cp_parser_omp_clause_untied): Same. (cp_parser_omp_for_loop): Same. (cp_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (c_start_case): Add location argument. (c_process_expr_stmt): Same. (c_finish_goto_*): Same. * tree-parloops.c (initialize_reductions): Pass location to build_omp_clause. (create_parallel_loop): Same. * fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same. (gfc_trans_omp_reduction_list): Same. (gfc_trans_omp_clauses): Same. (gfc_trans_omp_do): Same. * c-typeck.c (c_finish_goto_label): Same. (c_finish_goto_ptr): New location argument. (c_start_case): Same. (emit_side_effect_warnings): Same. (c_process_expr_stmt): Same. (c_finish_stmt_expr): Same. (c_finish_omp_clauses): Use error_at instead of error. * gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to build_omp_clause. * c-omp.c (c_split_parallel_clauses): New location argument. * tree-nested.c (convert_nonlocal_reference_stmt): Pass location to build_omp_clause. (convert_local_reference_stmt): Same. (convert_gimple_call): Same. * c-common.h (c_split_parallel_clauses): New argument. * c-parser.c (c_parser_statement_after_labels): Pass location to c_finish_goto_label. (c_parser_switch_statement): Pass location to c_start_case. (c_parser_for_statement): Pass location to c_finish_expr_stmt, and c_process_expr_stmt. (c_parser_omp_variable_list): Add location argument. (c_parser_omp_clause_collapse): Pass location to build_omp_clause. (c_parser_omp_clause_default): Same. (c_parser_omp_clause_if): Same. (c_parser_omp_clause_num_threads): Same. (-c_parser_omp_clause_ordered): Same. (c_parser_omp_clause_reduction): Pass location to c_parser_omp_variable_list. (c_parser_omp_clause_schedule): Pass location to build_omp_clause. (c_parser_omp_clause_untied): Same. (c_parser_omp_for_loop): Pass location to c_process_expr_stmt. (c_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (check_for_loop_decls, undeclared_variable, build_component_ref, build_array_ref, build_external_ref, c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op, build_conditional_expr, build_compound_expr, c_cast_expr, build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr, c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New argument. * c-semantics.c (build_stmt): Same. (build_case_label): Same. * c-decl.c (c_finish_incomplete_decl): Pass location on down. (undeclared_variable): New argument. (make_label): Same. (lookup_label): Pass location on down. (define_label): Same. (finish_decl): Same. (build_compound_literal): Same. (finish_struct): Same. (finish_function): Do not set location here. (check_for_loop_decls): New argument. * tree.c (save_expr): Set location. (build_empty_stmt): New argument. * tree.h (build_empty_stmt): New argument to build_empty_stmt. (CAN_HAVE_LOCATION_P): Make sure we have a non empty node. * builtins.c (gimplify_va_arg_expr): Use locations. (expand_builtin_sync_operation): Same. * c-typeck.c (build_component_ref): New argument. (build_array_ref): Same. (build_external_ref): Same. (c_expr_sizeof_expr): Same. (c_expr_sizeof_type): Same. (parser_build_unary_op): Same. (build_conditional_expr): Same. (build_compound_expr): Pass location on down. (build_compound_expr): New argument. (build_c_cast): Same. (c_cast_expr): Same. (build_asm_expr): Same. (c_finish_return): Same. (c_process_expr_stmt): Pass location on down. (c_finish_stmt_expr): New argument. (push_clenaup): Same. (c_finish_omp_parallel): Same. (c_finish_omp_task): Same. * gimplify.c (gimplify_call_expr): Pass location on down. * c-omp.c (c_finish_omp_master): New argument. (c_finish_omp_critical): Same. (c_finish_omp_ordered): Same. (c_finish_omp_barrier): Same. (-c_finish_omp_taskwait): Same. (c_finish_omp_atomic): Same. (c_finish_omp_flush): Same. * tree-inline.c (copy_tree_body_r): Pass location on down. (inline_forbidden_p): Remove use of input_location. * c-gimplify.c (c_build_bind_expr): New argument. * c-common.c (c_common_truthvalue_conversion): Pass location on down. (c_sizeof_or_alignof_type): New argument. (c_alignof_expr): Same. (build_va_arg): Same. (c_add_case_label): Same. * c-common.h (c_sizeof_or_alignof_type, c_alignof_expr, c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label, c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt, c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered, c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush, c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses): New argument. * stub-objc.c (objc_build_selector_expr): Same. (objc_build_throw_stmt): Same. * c-parser.c (c_parser_declaration_or_fndef): Pass location on down. (c_parser_initelt): Same. (c_parser_compound_statement): Same. (c_parser_compound_statement_nostart): Same. (c_parser_label): Same. (c_parser_statement_after_labels): Same. (c_parser_if_body): Same. (c_parser_else_body): Same. (c_parser_if_statement): Same. (c_parser_switch_statement): Same. (c_parser_while_statement): Same. (c_parser_do_statement): Same. (c_parser_for_statement): Same. (c_parser_asm_statement): Same. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Same. (c_parser_cast_expression): Same. (c_parser_unary_expression): Same. (c_parser_sizeof_expression): Same. (c_parser_alignof_expression): Same. (c_parser_postfix_expression): Same. (c_parser_expression): Same. (c_parser_objc_receiver): Same. (c_parser_omp_variable_list): Same. (c_parser_omp_structured_block): Same. (c_parser_omp_atomic): New argument. (c_parser_omp_barrier): Same. (c_parser_omp_critical): Same. (c_parser_omp_flush): Pass location on down. (c_parser_omp_for_loop): New argument. (c_parser_omp_for): Same. (c_parser_omp_master): Same. (c_parser_omp_ordered): Same. (c_parser_omp_sections_scope): Same. (c_parser_omp_sections): Same. (c_parser_omp_parallel): Same. (c_parser_omp_single): Same. (c_parser_omp_task): Same. (c_parser_omp_taskwait): Pass location on down. (c_parser_omp_construct): Same. (c_parser_omp_threadprivate): Same. * dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h, builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c, tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c, c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c, c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c, emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c, rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h, tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c, config/i386/i386.c, stmt.c: Add location argument to the following function definitions and/or function calls: build_decl, objcp_start_struct, objcp_finish_struct, start_struct, finish_struct, PUSH_FIELD, create_artificial_label, cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl, build_compound_literal, parser_xref_tag, resolve_overloaded_builtin, do_case, c_finish_bc_stmt, build_compound_literal, build_function_call. * c-decl.c (build_compound_literal): Add location argument. Make all diagnostic calls use location. (start_struct): Same. (finish_struct): Same. (start_enum): Same. (build_enumerator): Same. (start_function): Same. (grokdeclarator): Make all diagnostic calls use location. (store_parm_decls_oldstyle): Same. * c-typeck.c (build_function_call): Add location argument. Make all diagnostic calls use location. (do_case): Same. (c_finish_bc_stmt): Same. * tree-nested.c (get_trampoline_type): Add argument. Pass location to build_decl. (lookup_tramp_for_decl): Pass location to get_trampoline_type. * rtl.h (RTL_LOCATION): New. * c-common.c (c_add_case_label): Add location argument. Make all diagnostic calls use location. * c-common.h: Add location argument to make_fname_decl, do_case, c_add_case_label, build_function_call, resolve_overloaded_builtin. * c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc. Set it appropriately for every case. Pass enum_loc to start_enum call. Pass value_loc first to build_enumerator. Pass enum_loc to parser_xref_tag. (c_parser_struct_or_union_specifier): Save location. Use it for start_struct, finish_struct, and parser_xref_tag. gcc/testsuite/ * gcc.dg/old-style-prom-3.c: Add column info. * gcc.dg/overflow-warn-1.c * gcc.dg/gomp/pr27415.c * gcc.dg/gomp/for-1.c: Same. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/c99-tag-3.c: Same. * gcc.dg/Wredundant-decls-2.c: Same. * gcc.dg/func-ptr-conv-1.c: Same. * gcc.dg/asm-wide-1.c: Same. * gcc.dg/nofixed-point-2.c: Same. * gcc.dg/cpp/line3.c: Same. * gcc.dg/array-10.c: Same. * gcc.dg/c99-vla-jump-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/Wshadow-3.c: Same. * gcc.dg/c90-const-expr-8.c: Same. * gcc.dg/label-decl-2.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/c90-const-expr-5.c: Same. * gcc.dg/builtins-30.c: Same. * gcc.dg/Warray-bounds.c: Same. * gcc.dg/Wcxx-compat-2.c: Same. * gcc.dg/tree-ssa/col-1.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/cast-function-1.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/vla-8.c: Same. * gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct line. * gcc.dg/label-decl-2.c: Move label diagnostic to correct line. * gcc.dg/old-style-prom-3.c: Check for error on the correct line. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/builtins-30.c: Same. Test for columns. gcc/objcp/ * objcp-decl.h (c_end_compound_stmt): New argument. * objcp-decl.c (objcp_start_struct): Add argument. (objcp_finish_struct): Same. gcc/cp/ * typeck.c (cp_build_binary_op): Pass location to overflow_warning. (build_modify_expr): New arg. * semantics.c (finish_unary_op_expr): Pass location to overflow_warning. (handle_omp_for_class_iterator): Pass location to build_modify_expr. * typeck.c (cxx_sizeof_or_alignof_type): Pass location to c_sizeof_or_alignof_type. (build_array_ref): New argument. (build_compound_expr): Same. (build_const_cast): Same. (build_ptrmemfunc): Pass location to build_c_cast. * init.c (avoid_placement_new_aliasing): Pass location to build_stmt. (build_vec_delete_1): Pass location to cp_build_modify_expr, build_compound_expr. * class.c (build_vtbl_ref_1): Pass location to build_array_ref. * decl.c (poplevel): Pass location to c_build_bind_expr. (finish_case_label): Pass location to build_case_label. (finish_constructor_body): Same. (finish_destructor_body): Pass location to build_stmt. (cxx_maybe_build_cleanup): Same, but to build_compound_expr. * call.c (build_new_op): Pass location to build_array_ref. (build_x_va_arg): Pass location to build_va_arg. * except.c (expand_end_catch_block): Pass location to build_stmt. * cp-tree.h (build_array_ref): New argument. (build_compound_expr): Same. (build_c_cast): Same. * cp-gimplify.c (gimplify_if_stmt): Pass location on down. (gimplify_switch_stmt): Same. * typeck2.c (split_nonconstant_init_1): Same. * pt.c (tsubst_copy): Same. * semantics.c (add_decl_expr): Same. (do_poplevel): Same. (push_cleanup): Same. (finish_goto_stmt): Same. (finish_expr_stmt): Same. (begin_if_stmt): Same. (begin_while_stmt): Same. (begin_do_stmt): Same. (finish_return_stmt): Same. (begin_for_stmt): Same. (finish_break_stmt): Same. (finish_continue_stmt): Same. (begin_switch_stmt): Same. (begin_try_block): Same. (begin_handler): Same. (finish_asm_stmt): Same. (finish_label_stmt): Same. (finish_stmt_expr_expr): Same. (finalize_nrv_r): Same. (finish_omp_atomic): Same. * name-lookup.c (do_using_directive): Same. * decl2.c (grok_array_decl): Same. * parser.c (cp_parser_cast_expression): Same. (cp_parser_selection_statement): Same. (cp_parser_implicitly_scoped_statement): Same. (cp_parser_objc_selector_expression): Same. (cp_parser_objc_synchronized_statement): Same. (cp_parser_objc_throw_statement): Same. (cp_parser_omp_critical): Same. (cp_parser_omp_master): Same. * typeck.c (build_function_call): Add location argument. * init.c: Add location argument to all build_decl calls. * class.c: Same. * method.c: Same. * rtti.c: Same. * tree.c: Same. * pt.c: Same. * semantics.c: Same. * lex.c: Same. * decl2.c: Same. * cp-gimplify.c: Same. * decl.c: Same. (cp_make_fname_decl): Add location argument. Pass location ot build_decl. (finish_case_label): Same. * cp-tree.h (finish_case_label): Add location argument. * parser.c (cp_parser_label_for_labeled_statement): Pass location to finish_case_label. gcc/fortran/ * trans-array.c (gfc_trans_allocate_array_storage): Pass location on down. (gfc_trans_array_constructor_value): Same. (gfc_trans_scalarized_loop_end): Same. (gfc_conv_ss_startstride): Same. (gfc_trans_g77_array): Same. (gfc_trans_dummy_array_bias): Same. (gfc_conv_array_parameter): Same. (structure_alloc_comps): Same. * trans-expr.c (gfc_conv_function_call): Same. (fill_with_spaces): Same. (gfc_trans_string_copy): Same. (gfc_trans_scalar_assign): Same. * trans-stmt.c (gfc_trans_goto): Same. (gfc_trans_if_1): Same. (gfc_trans_simple_do): Same. (gfc_trans_do): Same. (gfc_trans_do_while): Same. (gfc_trans_logical_select): Same. (gfc_trans_select): Same. (gfc_trans_forall_loop): Same. (gfc_trans_nested_forall_loop): Same. (generate_loop_for_temp_to_lhs): Same. (generate_loop_for_rhs_to_temp): Same. (gfc_trans_forall_1): Same. (gfc_trans_where_assign): Same. (gfc_trans_where_3): Same. (gfc_trans_allocate): Same. * trans.c (gfc_finish_block): Same. (gfc_trans_runtime_check): Same. (gfc_call_malloc): Same. (gfc_allocate_with_status): Same. (gfc_call_free): Same. (gfc_deallocate_with_status): Same. (gfc_call_realloc): Same. (gfc_trans_code): Same. * trans-decl.c (gfc_init_default_dt): Same. (gfc_generate_constructors): Same. * trans-io.c (gfc_trans_io_runtime_check): Same. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same. (gfc_conv_intrinsic_fdate): Same. (gfc_conv_intrinsic_ttynam): Same. (gfc_conv_intrinsic_minmax): Same. (gfc_conv_intrinsic_minmax_char): Same. (gfc_conv_intrinsic_anyall): Same. (gfc_conv_intrinsic_count): Same. (gfc_conv_intrinsic_arith): Same. (gfc_conv_intrinsic_minmaxloc): Same. (gfc_conv_intrinsic_minmaxval): Same. (gfc_conv_intrinsic_rrspacing): Same. (gfc_conv_intrinsic_array_transfer): Same. (gfc_conv_intrinsic_trim): Same. (gfc_conv_intrinsic_repeat): Same. From-SVN: r148442
2009-06-13 00:06:47 +02:00
extern tree build_compound_expr (location_t, tree, tree);
extern tree cp_build_compound_expr (tree, tree, tsubst_flags_t);
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
extern tree build_static_cast (tree, tree, tsubst_flags_t);
extern tree build_reinterpret_cast (tree, tree, tsubst_flags_t);
extern tree build_const_cast (tree, tree, tsubst_flags_t);
java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. gcc/java/ * java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. * expr.c (force_evaluation_order): Same. * typeck.c: Add location to build_decl or PUSH_FIELD calls. * class.c: Same. * decl.c: Same. * jcf-parse.c: Same. * constants.c: Same. * resource.c: Same. * except.c: Same. * builtins.c: Same. * expr.c: Same. * java-tree.h (PUSH_FIELD): Add location field. gcc/objc/ * objc-act.c (finish_var_decl): Pass location to finish_decl. (objc_get_parm_info): Same. (get_super_receiver): Same. * objc-act.c (objc_build_component_ref): Pass location to build_compound_ref. (build_module_initializer_routine): Pass location to c_end_compound_stmt. (objc_generate_static_init_call): Pass location to build_stmt. (build_typed_selector_reference): New location argument. (build_selector_reference): Same. (objc_substitute_decl): Pass location to build_array_ref. (next_sjlj_build_try_catch_finally): Pass location to build_stmt. (objc_begin_catch_clause): Same. (objc_finish_try_stmt): Same. (objc_finish_catch_clause): Pass location to c_end_compound_stmt. (objc_build_throw_stmt): New argument. (generate_shared_structures): Pass location to build_c_cast. (objc_build_message_expr): Use local location. (objc_finish_message_expr): Use input_location. (build_objc_method_call): New argument. (objc_build_selector_expr): Same. (get_super_receiver): Pass location to build_c_cast, build_modify_expr, build_compound_expr. * objc-act.c: Add location to all calls to start_struct, build_decl, finish_struct. gcc/ * tree-pretty-print.c (dump_generic_node): Dump column numbers. * gimple-pretty-print.c (dump_gimple_stmt): Same. * gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs created. * c-parser.c (c_parser_binary_expression): Use current column while building binary operations. * common.opt (fshow-column): Enable by default. * tree-vrp.c (check_array_ref): Use warning_at. (check_array_bounds): Use location from call back if expr has no location. * tree.h: Add location argument to maybe_fold_*. * tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*. (maybe_fold_offset_to_array_ref): Add location argument and use it. (maybe_fold_offset_to_component_ref): Same. (maybe_fold_offset_to_reference): Same. (maybe_fold_offset_to_address): Same. (maybe_fold_stmt_indirect): Same. (maybe_fold_stmt_addition): Same. (fold_stmt_r): Pass location to maybe_fold_*. (fold_gimple_assign): Same. * c-tree.h: Add location argument to finish_decl, default_function_array_conversion, store_init_value. * c-decl.c (define_label): Use error_at. (c_make_fname_decl): Pass location to finish_decl. (finish_decl): New location argument. (build_compound_literal): Pass location to store_init_value. (grokdeclarator): Pass location to finish_decl. (grokfield): Same. * c-typeck.c (array_to_pointer_conversion): New location argument. (function_to_pointer_conversion): Same. (default_function_array_conversion): Same. (parser_build_unary_op): Pass location to overflow_warning. (parser_build_binary_op): Same. Use warning_at. (build_unary_op): Pass location to array_to_pointer_conversion. (build_c_cast): Pass location to digest_init. (build_modify_expr): New location argument. (convert_for_assignment): Same. (store_init_value): Same. (digest_init): Same. (output_init_element): Pass location to digest_init and array_to_pointer_conversion. (c_finish_return): Pass location to convert_for_assignment. * gimplify.c (gimplify_conversion): Pass location to maybe_fold_offset_to_address. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location to maybe_fold_stmt_addition. * c-omp.c (c_finish_omp_atomic): Pass new location to build_modify_expr. (c_finish_omp_for): Same. * c-common.c (overflow_warning): New argument. * c-common.h: New argument to build_modify_expr, overflow_warning. * c-parser.c (c_parser_declaration_or_fndef): Pass location to finish_decl. (c_parser_initializer): Pass location to default_function_array_conversion. (c_parser_initelt): Same. (c_parser_initval): Same. (c_parser_asm_operands): Same. (c_parser_expr_no_commas): Same. Pass location to build_modify_expr. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Add location info to stack. Use it. (c_parser_unary_expression): Pass location to default_function_array_conversion, parser_build_unary_op, build_indirect_ref, c_parser_postfix_expression_after_primary. (c_parser_postfix_expression_after_primary): New location argument. Use it. (c_parser_expression_conv): Pass location to default_function_array_conversion. (c_parser_expr_list): Same. (c_parser_omp_atomic): Same. (c_parser_omp_for_loop): Same. * c-tree.h: (struct c_declarator): Add comment to id_loc. (build_array_declarator): New argument. * c-decl.c (build_array_declarator): Add location argument. (grokdeclarator): Set id_loc for cdk_array. * c-parser.c (c_parser_direct_declarator_inner): Pass location to build_array_declarator. * tree.c (build_omp_clause): Add location argument. * tree.h (OMP_CLAUSE_HAS_LOCATION): New macro. (OMP_CLAUSE_LOCATION): New macro. (struct tree_omp_clause): Add location field. (build_omp_clause): Add argument. * testsuite/gcc.dg/gomp/for-1.c: Fix column. * cp/pt.c (tsubst_omp_for_iterator): Pass location to build_omp_clause. * cp/parser.c (cp_parser_omp_var_list_no_open): Same. (cp_parser_omp_clause_collapse): Same. (cp_parser_omp_clause_default): Same. (cp_parser_omp_clause_if): Same. (cp_parser_omp_clause_nowait): Same. (cp_parser_omp_clause_num_threads): Same. (cp_parser_omp_clause_ordered): Same. (cp_parser_omp_clause_schedule): Same. (cp_parser_omp_clause_untied): Same. (cp_parser_omp_for_loop): Same. (cp_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (c_start_case): Add location argument. (c_process_expr_stmt): Same. (c_finish_goto_*): Same. * tree-parloops.c (initialize_reductions): Pass location to build_omp_clause. (create_parallel_loop): Same. * fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same. (gfc_trans_omp_reduction_list): Same. (gfc_trans_omp_clauses): Same. (gfc_trans_omp_do): Same. * c-typeck.c (c_finish_goto_label): Same. (c_finish_goto_ptr): New location argument. (c_start_case): Same. (emit_side_effect_warnings): Same. (c_process_expr_stmt): Same. (c_finish_stmt_expr): Same. (c_finish_omp_clauses): Use error_at instead of error. * gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to build_omp_clause. * c-omp.c (c_split_parallel_clauses): New location argument. * tree-nested.c (convert_nonlocal_reference_stmt): Pass location to build_omp_clause. (convert_local_reference_stmt): Same. (convert_gimple_call): Same. * c-common.h (c_split_parallel_clauses): New argument. * c-parser.c (c_parser_statement_after_labels): Pass location to c_finish_goto_label. (c_parser_switch_statement): Pass location to c_start_case. (c_parser_for_statement): Pass location to c_finish_expr_stmt, and c_process_expr_stmt. (c_parser_omp_variable_list): Add location argument. (c_parser_omp_clause_collapse): Pass location to build_omp_clause. (c_parser_omp_clause_default): Same. (c_parser_omp_clause_if): Same. (c_parser_omp_clause_num_threads): Same. (-c_parser_omp_clause_ordered): Same. (c_parser_omp_clause_reduction): Pass location to c_parser_omp_variable_list. (c_parser_omp_clause_schedule): Pass location to build_omp_clause. (c_parser_omp_clause_untied): Same. (c_parser_omp_for_loop): Pass location to c_process_expr_stmt. (c_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (check_for_loop_decls, undeclared_variable, build_component_ref, build_array_ref, build_external_ref, c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op, build_conditional_expr, build_compound_expr, c_cast_expr, build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr, c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New argument. * c-semantics.c (build_stmt): Same. (build_case_label): Same. * c-decl.c (c_finish_incomplete_decl): Pass location on down. (undeclared_variable): New argument. (make_label): Same. (lookup_label): Pass location on down. (define_label): Same. (finish_decl): Same. (build_compound_literal): Same. (finish_struct): Same. (finish_function): Do not set location here. (check_for_loop_decls): New argument. * tree.c (save_expr): Set location. (build_empty_stmt): New argument. * tree.h (build_empty_stmt): New argument to build_empty_stmt. (CAN_HAVE_LOCATION_P): Make sure we have a non empty node. * builtins.c (gimplify_va_arg_expr): Use locations. (expand_builtin_sync_operation): Same. * c-typeck.c (build_component_ref): New argument. (build_array_ref): Same. (build_external_ref): Same. (c_expr_sizeof_expr): Same. (c_expr_sizeof_type): Same. (parser_build_unary_op): Same. (build_conditional_expr): Same. (build_compound_expr): Pass location on down. (build_compound_expr): New argument. (build_c_cast): Same. (c_cast_expr): Same. (build_asm_expr): Same. (c_finish_return): Same. (c_process_expr_stmt): Pass location on down. (c_finish_stmt_expr): New argument. (push_clenaup): Same. (c_finish_omp_parallel): Same. (c_finish_omp_task): Same. * gimplify.c (gimplify_call_expr): Pass location on down. * c-omp.c (c_finish_omp_master): New argument. (c_finish_omp_critical): Same. (c_finish_omp_ordered): Same. (c_finish_omp_barrier): Same. (-c_finish_omp_taskwait): Same. (c_finish_omp_atomic): Same. (c_finish_omp_flush): Same. * tree-inline.c (copy_tree_body_r): Pass location on down. (inline_forbidden_p): Remove use of input_location. * c-gimplify.c (c_build_bind_expr): New argument. * c-common.c (c_common_truthvalue_conversion): Pass location on down. (c_sizeof_or_alignof_type): New argument. (c_alignof_expr): Same. (build_va_arg): Same. (c_add_case_label): Same. * c-common.h (c_sizeof_or_alignof_type, c_alignof_expr, c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label, c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt, c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered, c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush, c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses): New argument. * stub-objc.c (objc_build_selector_expr): Same. (objc_build_throw_stmt): Same. * c-parser.c (c_parser_declaration_or_fndef): Pass location on down. (c_parser_initelt): Same. (c_parser_compound_statement): Same. (c_parser_compound_statement_nostart): Same. (c_parser_label): Same. (c_parser_statement_after_labels): Same. (c_parser_if_body): Same. (c_parser_else_body): Same. (c_parser_if_statement): Same. (c_parser_switch_statement): Same. (c_parser_while_statement): Same. (c_parser_do_statement): Same. (c_parser_for_statement): Same. (c_parser_asm_statement): Same. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Same. (c_parser_cast_expression): Same. (c_parser_unary_expression): Same. (c_parser_sizeof_expression): Same. (c_parser_alignof_expression): Same. (c_parser_postfix_expression): Same. (c_parser_expression): Same. (c_parser_objc_receiver): Same. (c_parser_omp_variable_list): Same. (c_parser_omp_structured_block): Same. (c_parser_omp_atomic): New argument. (c_parser_omp_barrier): Same. (c_parser_omp_critical): Same. (c_parser_omp_flush): Pass location on down. (c_parser_omp_for_loop): New argument. (c_parser_omp_for): Same. (c_parser_omp_master): Same. (c_parser_omp_ordered): Same. (c_parser_omp_sections_scope): Same. (c_parser_omp_sections): Same. (c_parser_omp_parallel): Same. (c_parser_omp_single): Same. (c_parser_omp_task): Same. (c_parser_omp_taskwait): Pass location on down. (c_parser_omp_construct): Same. (c_parser_omp_threadprivate): Same. * dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h, builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c, tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c, c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c, c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c, emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c, rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h, tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c, config/i386/i386.c, stmt.c: Add location argument to the following function definitions and/or function calls: build_decl, objcp_start_struct, objcp_finish_struct, start_struct, finish_struct, PUSH_FIELD, create_artificial_label, cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl, build_compound_literal, parser_xref_tag, resolve_overloaded_builtin, do_case, c_finish_bc_stmt, build_compound_literal, build_function_call. * c-decl.c (build_compound_literal): Add location argument. Make all diagnostic calls use location. (start_struct): Same. (finish_struct): Same. (start_enum): Same. (build_enumerator): Same. (start_function): Same. (grokdeclarator): Make all diagnostic calls use location. (store_parm_decls_oldstyle): Same. * c-typeck.c (build_function_call): Add location argument. Make all diagnostic calls use location. (do_case): Same. (c_finish_bc_stmt): Same. * tree-nested.c (get_trampoline_type): Add argument. Pass location to build_decl. (lookup_tramp_for_decl): Pass location to get_trampoline_type. * rtl.h (RTL_LOCATION): New. * c-common.c (c_add_case_label): Add location argument. Make all diagnostic calls use location. * c-common.h: Add location argument to make_fname_decl, do_case, c_add_case_label, build_function_call, resolve_overloaded_builtin. * c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc. Set it appropriately for every case. Pass enum_loc to start_enum call. Pass value_loc first to build_enumerator. Pass enum_loc to parser_xref_tag. (c_parser_struct_or_union_specifier): Save location. Use it for start_struct, finish_struct, and parser_xref_tag. gcc/testsuite/ * gcc.dg/old-style-prom-3.c: Add column info. * gcc.dg/overflow-warn-1.c * gcc.dg/gomp/pr27415.c * gcc.dg/gomp/for-1.c: Same. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/c99-tag-3.c: Same. * gcc.dg/Wredundant-decls-2.c: Same. * gcc.dg/func-ptr-conv-1.c: Same. * gcc.dg/asm-wide-1.c: Same. * gcc.dg/nofixed-point-2.c: Same. * gcc.dg/cpp/line3.c: Same. * gcc.dg/array-10.c: Same. * gcc.dg/c99-vla-jump-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/Wshadow-3.c: Same. * gcc.dg/c90-const-expr-8.c: Same. * gcc.dg/label-decl-2.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/c90-const-expr-5.c: Same. * gcc.dg/builtins-30.c: Same. * gcc.dg/Warray-bounds.c: Same. * gcc.dg/Wcxx-compat-2.c: Same. * gcc.dg/tree-ssa/col-1.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/cast-function-1.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/vla-8.c: Same. * gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct line. * gcc.dg/label-decl-2.c: Move label diagnostic to correct line. * gcc.dg/old-style-prom-3.c: Check for error on the correct line. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/builtins-30.c: Same. Test for columns. gcc/objcp/ * objcp-decl.h (c_end_compound_stmt): New argument. * objcp-decl.c (objcp_start_struct): Add argument. (objcp_finish_struct): Same. gcc/cp/ * typeck.c (cp_build_binary_op): Pass location to overflow_warning. (build_modify_expr): New arg. * semantics.c (finish_unary_op_expr): Pass location to overflow_warning. (handle_omp_for_class_iterator): Pass location to build_modify_expr. * typeck.c (cxx_sizeof_or_alignof_type): Pass location to c_sizeof_or_alignof_type. (build_array_ref): New argument. (build_compound_expr): Same. (build_const_cast): Same. (build_ptrmemfunc): Pass location to build_c_cast. * init.c (avoid_placement_new_aliasing): Pass location to build_stmt. (build_vec_delete_1): Pass location to cp_build_modify_expr, build_compound_expr. * class.c (build_vtbl_ref_1): Pass location to build_array_ref. * decl.c (poplevel): Pass location to c_build_bind_expr. (finish_case_label): Pass location to build_case_label. (finish_constructor_body): Same. (finish_destructor_body): Pass location to build_stmt. (cxx_maybe_build_cleanup): Same, but to build_compound_expr. * call.c (build_new_op): Pass location to build_array_ref. (build_x_va_arg): Pass location to build_va_arg. * except.c (expand_end_catch_block): Pass location to build_stmt. * cp-tree.h (build_array_ref): New argument. (build_compound_expr): Same. (build_c_cast): Same. * cp-gimplify.c (gimplify_if_stmt): Pass location on down. (gimplify_switch_stmt): Same. * typeck2.c (split_nonconstant_init_1): Same. * pt.c (tsubst_copy): Same. * semantics.c (add_decl_expr): Same. (do_poplevel): Same. (push_cleanup): Same. (finish_goto_stmt): Same. (finish_expr_stmt): Same. (begin_if_stmt): Same. (begin_while_stmt): Same. (begin_do_stmt): Same. (finish_return_stmt): Same. (begin_for_stmt): Same. (finish_break_stmt): Same. (finish_continue_stmt): Same. (begin_switch_stmt): Same. (begin_try_block): Same. (begin_handler): Same. (finish_asm_stmt): Same. (finish_label_stmt): Same. (finish_stmt_expr_expr): Same. (finalize_nrv_r): Same. (finish_omp_atomic): Same. * name-lookup.c (do_using_directive): Same. * decl2.c (grok_array_decl): Same. * parser.c (cp_parser_cast_expression): Same. (cp_parser_selection_statement): Same. (cp_parser_implicitly_scoped_statement): Same. (cp_parser_objc_selector_expression): Same. (cp_parser_objc_synchronized_statement): Same. (cp_parser_objc_throw_statement): Same. (cp_parser_omp_critical): Same. (cp_parser_omp_master): Same. * typeck.c (build_function_call): Add location argument. * init.c: Add location argument to all build_decl calls. * class.c: Same. * method.c: Same. * rtti.c: Same. * tree.c: Same. * pt.c: Same. * semantics.c: Same. * lex.c: Same. * decl2.c: Same. * cp-gimplify.c: Same. * decl.c: Same. (cp_make_fname_decl): Add location argument. Pass location ot build_decl. (finish_case_label): Same. * cp-tree.h (finish_case_label): Add location argument. * parser.c (cp_parser_label_for_labeled_statement): Pass location to finish_case_label. gcc/fortran/ * trans-array.c (gfc_trans_allocate_array_storage): Pass location on down. (gfc_trans_array_constructor_value): Same. (gfc_trans_scalarized_loop_end): Same. (gfc_conv_ss_startstride): Same. (gfc_trans_g77_array): Same. (gfc_trans_dummy_array_bias): Same. (gfc_conv_array_parameter): Same. (structure_alloc_comps): Same. * trans-expr.c (gfc_conv_function_call): Same. (fill_with_spaces): Same. (gfc_trans_string_copy): Same. (gfc_trans_scalar_assign): Same. * trans-stmt.c (gfc_trans_goto): Same. (gfc_trans_if_1): Same. (gfc_trans_simple_do): Same. (gfc_trans_do): Same. (gfc_trans_do_while): Same. (gfc_trans_logical_select): Same. (gfc_trans_select): Same. (gfc_trans_forall_loop): Same. (gfc_trans_nested_forall_loop): Same. (generate_loop_for_temp_to_lhs): Same. (generate_loop_for_rhs_to_temp): Same. (gfc_trans_forall_1): Same. (gfc_trans_where_assign): Same. (gfc_trans_where_3): Same. (gfc_trans_allocate): Same. * trans.c (gfc_finish_block): Same. (gfc_trans_runtime_check): Same. (gfc_call_malloc): Same. (gfc_allocate_with_status): Same. (gfc_call_free): Same. (gfc_deallocate_with_status): Same. (gfc_call_realloc): Same. (gfc_trans_code): Same. * trans-decl.c (gfc_init_default_dt): Same. (gfc_generate_constructors): Same. * trans-io.c (gfc_trans_io_runtime_check): Same. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same. (gfc_conv_intrinsic_fdate): Same. (gfc_conv_intrinsic_ttynam): Same. (gfc_conv_intrinsic_minmax): Same. (gfc_conv_intrinsic_minmax_char): Same. (gfc_conv_intrinsic_anyall): Same. (gfc_conv_intrinsic_count): Same. (gfc_conv_intrinsic_arith): Same. (gfc_conv_intrinsic_minmaxloc): Same. (gfc_conv_intrinsic_minmaxval): Same. (gfc_conv_intrinsic_rrspacing): Same. (gfc_conv_intrinsic_array_transfer): Same. (gfc_conv_intrinsic_trim): Same. (gfc_conv_intrinsic_repeat): Same. From-SVN: r148442
2009-06-13 00:06:47 +02:00
extern tree build_c_cast (location_t, tree, tree);
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
extern cp_expr build_c_cast (location_t loc, tree type,
cp_expr expr);
extern tree cp_build_c_cast (tree, tree, tsubst_flags_t);
C++ FE: expression ranges gcc/ChangeLog: * convert.c (convert_to_real_1): When converting from a REAL_TYPE, preserve the location of EXPR in the result. * tree.c (get_pure_location): Make non-static. (set_source_range): Return the resulting location_t. (make_location): New function. * tree.h (get_pure_location): New decl. (get_finish): New inline function. (set_source_range): Convert return type from void to location_t. (make_location): New decl. gcc/cp/ChangeLog: * cp-tree.h (class cp_expr): New class. (finish_parenthesized_expr): Convert return type and param to cp_expr. (perform_koenig_lookup): Convert return type and param from tree to cp_expr. (finish_increment_expr): Likewise. (finish_unary_op_expr): Likewise. (finish_id_expression): Likewise for return type. (build_class_member_access_expr): Likewise for param. (finish_class_member_access_expr): Likewise. (build_x_unary_op): Likewise. (build_c_cast): New decl. (build_x_modify_expr): Convert return type from tree to cp_expr. * cvt.c (cp_convert_and_check): When warning about conversions, attempt to use the location of "expr" if available, otherwise falling back to the old behavior of using input_location. * name-lookup.c (lookup_arg_dependent_1): Convert return type from tree to cp_expr. (lookup_arg_dependent): Likewise; also for local "ret". * name-lookup.h (lookup_arg_dependent): Likewise for return type. * parser.c (cp_lexer_previous_token): Skip past purged tokens. (struct cp_parser_expression_stack_entry): Convert field "lhs" to cp_expr. (cp_parser_identifier): Likewise for return type. Use cp_expr ctor to preserve the token's location. (cp_parser_string_literal): Likewise, building up a meaningful location for the case where a compound string literal is built by concatentation. (cp_parser_userdef_char_literal): Likewise for return type. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_statement_expr): Convert return type to cp_expr. Generate a suitable location for the expr and return it via the cp_expr ctor. (cp_parser_fold_expression): Convert return type to cp_expr. (cp_parser_primary_expression): Likewise, and for locals "expr", "lam", "id_expression", "decl". Use cp_expr ctor when parsing literals, to preserve the spelling location of the token. Preserve the locations of parentheses. Preserve location when calling objc_lookup_ivar. Preserve the location for "this" tokens. Generate suitable locations for "__builtin_va_arg" constructs and for Objective C 2.0 dot-syntax. Set the location for the result of finish_id_expression. (cp_parser_primary_expression): Convert return type from tree to cp_expr. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): Likewise. Also for local "id". (cp_parser_postfix_expression): Likewise, also for local "postfix_expression". Generate suitable locations for C++-style casts, "_Cilk_spawn" constructs. Convert local "initializer" to cp_expr and use it to preserve the location of compound literals. Capture the location of the closing parenthesis of a call site via cp_parser_parenthesized_expression_list, and use it to build a source range for a call. Use cp_expr in ternary expression. (cp_parser_postfix_dot_deref_expression): Convert param from tree to cp_expr. Generate and set a location. (cp_parser_parenthesized_expression_list): Add "close_paren_loc" out-param, and write back to it. (cp_parser_unary_expression): Convert return type from tree to cp_expr. Also for locals "cast_expression" and "expression". Generate and use suitable locations for addresses of labels and for cast expressions. Call cp_expr::set_location where necessary. Preserve the locations of negated numeric literals. (cp_parser_new_expression): Generate meaningful locations/ranges. (cp_parser_cast_expression): Convert return type from tree to cp_expr; also for local "expr". Use the paren location to generate a meaningful range for the expression. (cp_parser_binary_expression): Convert return type from tree to cp_expr; also for local "rhs". Generate a meaningful location for the expression, and use it. Replace call to protected_set_expr_location by converting a build2 to a build2_loc and using the location in the call to build_x_binary_op, adding a cp_expr::set_location to the latter case. (cp_parser_question_colon_clause): Convert param from tree to cp_expr; also for local "assignment_expr". Set the spelling range of the expression. (cp_parser_assignment_expression): Likewise for return type and locals "expr" and "rhs". Build a meaningful spelling range for the expression. Remove saving of input_location in favor of a call to cp_expr::set_location. (cp_parser_expression): Convert return type and locals "expression" and "assignment_expression" to cp_expr. Build a meaningful spelling range for assignment expressions. (cp_parser_constant_expression): Likewise for return type and local "expression". (cp_parser_builtin_offsetof): Convert return type and local "expr" to cp_expr. Generate suitable locations. (cp_parser_lambda_expression): Convert return return type to cp_expr. (cp_parser_operator_function_id): Likewise. (cp_parser_operator): Likewise. Generate a meaningful range, using cp_expr's ctor to return it. (cp_parser_template_id): When converting a token to CPP_TEMPLATE_ID, update the location. (cp_parser_initializer_clause): Convert return type and local "initializer" to cp_expr. (cp_parser_braced_list): Likewise for return type. Generate suitable locations. (cp_parser_lookup_name): Likewise for return type. Use cp_expr's ctor to preserve the location_t of the name. (cp_parser_simple_cast_expression): Likewise for return type. (cp_parser_functional_cast): Convert return type and local "cast" to cp_expr. Generate suitable locations. (cp_parser_objc_expression): Convert return type to cp_expr.k Generate (cp_parser_objc_message_expression): Generate suitable locations. (cp_parser_objc_encode_expression): Convert return type to cp_expr. Generate suitable locations. (cp_parser_objc_protocol_expression): Generate suitable locations. (cp_parser_objc_selector_expression): Generate suitable locations. (cp_parser_omp_for_cond): Attempt to use the location of "cond" for the binary op. (cp_parser_transaction_expression): Issue the tm-not-enabled error at the location of the __transaction_foo token, rather than at input_location. * semantics.c (finish_parenthesized_expr): Convert return type and param to cp_expr. Preserve location. (perform_koenig_lookup): Likewise for return type and param. (finish_increment_expr): Likewise. Generate suitable locations. (finish_unary_op_expr): Likewise for return type and local "result". Generate suitable locations. (finish_id_expression): Convert return type to cp_expr and use cp_expr ctor to preserve location information. * typeck.c (build_class_member_access_expr): Convert param to cp_expr. (finish_class_member_access_expr): Likewise. (cp_build_binary_op): Convert a build2 to a build2_loc. (build_x_unary_op): Convert param from tree to cp_expr. (build_nop): Preserve the location of EXPR. (build_c_cast): Provide an overloaded variant that takes a cp_expr and returns a cp_expr. (build_x_modify_expr): Convert return type from tree to cp_expr. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template14.C: Move dg-error directive. * g++.dg/gomp/loop-1.C: Update dg-error locations. * g++.dg/plugin/diagnostic-test-expressions-1.C: New file, adapted from gcc.dg/plugin/diagnostic-test-expressions-1.c. * g++.dg/plugin/plugin.exp (plugin_test_list): Add the above. * g++.dg/template/crash55.C: Update dg-error directives. * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. * g++.dg/template/pr64100.C: Update location of dg-error directive. * g++.dg/template/ref3.C: Add XFAIL (PR c++/68699). * g++.dg/ubsan/pr63956.C: Update dg directives to reflect improved location information. * g++.dg/warn/pr35635.C (func3): Update location of a dg-warning. * g++.dg/warn/Wconversion-real-integer2.C: Update location of dg-warning; add a dg-message. * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm: New file, based on objc.dg/plugin/diagnostic-test-expressions-1.m. * obj-c++.dg/plugin/plugin.exp: New file, based on objc.dg/plugin/plugin.exp. From-SVN: r231293
2015-12-04 19:09:54 +01:00
extern cp_expr build_x_modify_expr (location_t, tree,
enum tree_code, tree,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
re PR c/70756 (Wrong column number shown for "error: invalid use of flexible array member") PR c/70756 * c-common.c (pointer_int_sum): Call size_in_bytes_loc instead of size_in_bytes and pass LOC to it. * c-decl.c (build_compound_literal): Pass LOC down to c_incomplete_type_error. * c-tree.h (require_complete_type): Adjust declaration. (c_incomplete_type_error): Likewise. * c-typeck.c (require_complete_type): Add location parameter, pass it down to c_incomplete_type_error. (c_incomplete_type_error): Add location parameter, pass it down to error_at. (build_component_ref): Pass location down to c_incomplete_type_error. (default_conversion): Pass location down to require_complete_type. (build_array_ref): Likewise. (build_function_call_vec): Likewise. (convert_arguments): Likewise. (build_unary_op): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (c_finish_omp_clauses): Likewise. * call.c (build_new_op_1): Pass LOC to cp_build_modify_expr. * cp-tree.h (cp_build_modify_expr): Update declaration. (cxx_incomplete_type_error, cxx_incomplete_type_diagnostic): New inline overloads. * cp-ubsan.c (cp_ubsan_dfs_initialize_vtbl_ptrs): Pass INPUT_LOCATION to cp_build_modify_expr. * decl2.c (set_guard): Likewise. (handle_tls_init): Likewise. * init.c (perform_member_init): Likewise. (expand_virtual_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (get_temp_regvar): Likewise. (build_vec_init): Likewise. * method.c (do_build_copy_assign): Likewise. (assignable_expr): Likewise. * semantics.c (finish_omp_for): Likewise. * typeck.c (cp_build_binary_op): Pass LOCATION to pointer_diff and cp_pointer_int_sum. (cp_pointer_int_sum): Add location parameter. Pass it down to pointer_int_sum. (pointer_diff): Add location parameter. Use it. (build_modify_expr): Pass location down to cp_build_modify_expr. (cp_build_modify_expr): Add location parameter. Use it. (build_x_modify_expr): Pass location down to cp_build_modify_expr. * typeck2.c (cxx_incomplete_type_diagnostic, cxx_incomplete_type_error): Add location parameter. * langhooks-def.h (lhd_incomplete_type_error): Adjust declaration. * langhooks.c (lhd_incomplete_type_error): Add location parameter. * langhooks.h (incomplete_type_error): Likewise. * tree.c (size_in_bytes_loc): Renamed from size_in_bytes. Add location parameter, pass it down to incomplete_type_error. * tree.h (size_in_bytes): New inline overload. (size_in_bytes_loc): Renamed from size_in_bytes. * c-c++-common/pr70756-2.c: New test. * c-c++-common/pr70756.c: New test. From-SVN: r236180
2016-05-12 17:28:08 +02:00
extern tree cp_build_modify_expr (location_t, tree,
enum tree_code, tree,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern tree convert_for_initialization (tree, tree, tree, int,
impl_conv_rhs, tree, int,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern int comp_ptr_ttypes (tree, tree);
2006-06-06 13:44:09 +02:00
extern bool comp_ptr_ttypes_const (tree, tree);
extern bool error_type_p (const_tree);
extern bool ptr_reasonably_similar (const_tree, const_tree);
extern tree build_ptrmemfunc (tree, tree, int, bool,
tsubst_flags_t);
c-common.c (const_strip_array_types): New. * c-common.c (const_strip_array_types): New. * c-common.h (lang_missing_noreturn_ok_p): Delete. (const_strip_array_types): New. * c-objc-common.c (c_disregard_inline_limits, c_warn_unused_global_decl): Constify. * c-tree.h (c_disregard_inline_limits, c_warn_unused_global_decl, c_vla_type_p, c_incomplete_type_error): Likewise. * c-typeck.c (c_incomplete_type_error, c_vla_type_p): Likewise. * hooks.c (hook_bool_const_tree_false): New. * hooks.h (hook_bool_const_tree_false): Likewise. * langhooks-def.h (lhd_warn_unused_global_decl, lhd_incomplete_type_error, lhd_expr_size, lhd_tree_inlining_disregard_inline_limits, lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, LANG_HOOKS_GENERIC_TYPE_P, LANG_HOOKS_TYPE_MAX_SIZE): Constify. * langhooks.c (lhd_warn_unused_global_decl, lhd_incomplete_type_error, lhd_tree_inlining_disregard_inline_limits, lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, lhd_expr_size): Likewise. * langhooks.h (lang_hooks_for_tree_inlining, lang_hooks_for_tree_dump, lang_hooks_for_types, lang_hooks_for_decls, lang_hooks): Likewise. * pointer-set.c (pointer_set_t, pointer_set_create, pointer_set_contains, insert_aux, pointer_set_insert, pointer_set_traverse, pointer_map_t, pointer_map_create, pointer_map_contains, pointer_map_insert, pointer_map_traverse): Likewise. * pointer-set.h (pointer_set_contains, pointer_set_insert, pointer_set_traverse, pointer_map_contains, pointer_map_insert, pointer_map_traverse): Likewise. * predict.c (assert_is_empty): Likewise. * tree-affine.c (free_name_expansion): Likewise. * tree-cfg.c (edge_to_cases_cleanup): Likewise. * tree.c (size_in_bytes, max_int_size_in_bytes): Likewise. * tree.h (size_in_bytes, max_int_size_in_bytes): Likewise. ada: * misc.c (gnat_type_max_size): Constify. cp: * cp-objcp-common.c (cxx_warn_unused_global_decl, cp_expr_size): Constify. * cp-tree.h (local_variable_p, nonstatic_local_decl_p, class_tmpl_impl_spec_p, cp_auto_var_in_fn_p, cp_type_quals, cxx_incomplete_type_diagnostic, cxx_incomplete_type_error, cxx_warn_unused_global_decl, cp_expr_size): Likewise. * decl.c (local_variable_p, nonstatic_local_decl_p): Likewise. * tree.c (class_tmpl_impl_spec_p, cp_auto_var_in_fn_p): Likewise. * typeck.c (cp_type_quals): Likewise. * typeck2.c (cxx_incomplete_type_diagnostic, cxx_incomplete_type_error): Likewise. From-SVN: r127560
2007-08-16 16:31:21 +02:00
extern int cp_type_quals (const_tree);
extern int type_memfn_quals (const_tree);
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
extern cp_ref_qualifier type_memfn_rqual (const_tree);
extern tree apply_memfn_quals (tree, cp_cv_quals, cp_ref_qualifier);
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
extern bool cp_has_mutable_p (const_tree);
extern bool at_least_as_qualified_p (const_tree, const_tree);
extern void cp_apply_type_quals_to_decl (int, tree);
extern tree build_ptrmemfunc1 (tree, tree, tree);
extern void expand_ptrmemfunc_cst (tree, tree *, tree *);
extern tree type_after_usual_arithmetic_conversions (tree, tree);
extern tree common_pointer_type (tree, tree);
extern tree composite_pointer_type (tree, tree, tree, tree,
composite_pointer_operation,
tsubst_flags_t);
extern tree merge_types (tree, tree);
extern tree strip_array_domain (tree);
extern tree check_return_expr (tree, bool *);
c-tree.h: Add argument to c_objc_common_truthvalue_conversion, parser_build_binary_op. * c-tree.h: Add argument to c_objc_common_truthvalue_conversion, parser_build_binary_op. * c-decl.c (build_enumerator): Pass location to build_binary_op. * c-typeck.c (build_array_ref): Same. (parser_build_unary_op): New location argument. (pointer_diff): Pass location to build_binary_op, c_objc_common_truthvalue_conversion. (build_modify_expr): Same. (build_unary_op): New location argument. (build_binary_op): New location argument. (c_objc_common_truthvalue_conversion): Pass location to c_*common_truthvalue_conversion. * c-convert.c (convert): Same. * c-common.c (binary_op_error): New location argument. (pointer_int_sum): Pass location to build_binary_op. (c_common_truthvalue_conversion): New location argument. (warn_for_sign_compare): Same. * c-common.h: Add location argument to c_common_truthvalue_conversion, binary_op_error, build_binary_op, warn_for_sign_compare. * c-parser.c (c_parser_condition): Pass location to c_*common_truthvalue_conversion. (c_parser_conditional_expression): Save condition's location and pass it on down. (c_parser_binary_expression): Same, but for the binary operator's location. (c_parser_omp_for_loop): Pass location to c_objc_common_truthvalue_conversion. objc/ * objc-act.c (next_sjlj_build_enter_and_setjmp): Call c_common_truthvalue_conversion with location. (next_sjlj_build_catch_list): Same. (next_sjlj_build_try_catch_finally): Same. testsuite/ * gcc.dg/Walways-true-1.c: Test column numbers. * gcc.dg/c90-const-expr-5.c: Same. * gcc.dg/compare4.c: Same. * gcc.dg/Werror-1.c: Same. cp/ * typeck.c (build_array_ref): Pass location to cp_build_binary_op. (get_member_function_from_ptrfunc): Same. (build_x_binary_op): Same. (build_binary_op): Same. (cp_build_binary_op): New location argument. (pointer_diff): Pass location to cp_build_binary_op. (cp_truthvalue_conversion): Pass location to build_binary_op. (convert_ptrmem): Pass location to cp_build_binary_op. (cp_build_modify_expr): Same. (build_ptrmemfunc): Same. * init.c (expand_cleanup_for_base): Pass location to c_common_truthvalue_conversion. (build_new_1): Pass location to cp_build_binary_op. (build_vec_delete_1): Pass location to *build_binary_op, c_common_truthvalue_conversion. (build_vec_init): Same. (build_delete): Same. * decl.c (compute_array_index_type): Same. * call.c (build_new_op): Same. * rtti.c (build_dynamic_cast_1): Same. * cp-tree.h: Add argument to cp_build_binary_op. * semantics.c (handle_omp_for_class_iterator): Pass location to *build_binary_op, c_common_truthvalue_conversion. * decl2.c (get_guard_cond): Same. From-SVN: r140598
2008-09-23 16:55:14 +02:00
extern tree cp_build_binary_op (location_t,
enum tree_code, tree, tree,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern tree build_x_vec_perm_expr (location_t,
tree, tree, tree,
tsubst_flags_t);
#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true)
extern tree build_simple_component_ref (tree, tree);
extern tree build_ptrmemfunc_access_expr (tree, tree);
extern tree build_address (tree);
extern tree build_nop (tree, tree);
extern tree non_reference (tree);
extern tree lookup_anon_field (tree, tree);
extern bool invalid_nonstatic_memfn_p (location_t, tree,
tsubst_flags_t);
re PR c++/52422 ([C++11][SFINAE] Hard errors with void or arithmetic expressions) /cp 2012-04-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52422 * cp-tree.h (build_addr_func, decay_conversion, get_member_function_from_ptrfunc, build_m_component_ref, convert_member_func_to_ptr): Add tsubst_flags_t parameter. * typeck.c (cp_default_conversion): Add. (decay_conversion, default_conversion, get_member_function_from_ptrfunc, convert_member_func_to_ptr): Add tsubst_flags_t parameter and use it throughout. (cp_build_indirect_ref, cp_build_array_ref, cp_build_function_call_vec, convert_arguments, build_x_binary_op, cp_build_binary_op, cp_build_unary_op, build_reinterpret_cast_1, build_const_cast_1, expand_ptrmemfunc_cst, convert_for_initialization): Adjust. * init.c (build_vec_init): Adjust. * decl.c (grok_reference_init, get_atexit_node): Likewise. * rtti.c (build_dynamic_cast_1, tinfo_base_init): Likewise. * except.c (build_throw): Likewise. * typeck2.c (build_x_arrow): Likewise. (build_m_component_ref): Add tsubst_flags_t parameter and use it throughout. * pt.c (convert_nontype_argument): Adjust. * semantics.c (finish_asm_stmt, maybe_add_lambda_conv_op): Likewise. * decl2.c (build_offset_ref_call_from_tree): Likewise. * call.c (build_addr_func): Add tsubst_flags_t parameter and use it throughout. (build_call_a, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, build_over_call, build_special_member_call): Adjust. * cvt.c (cp_convert_to_pointer, force_rvalue, build_expr_type_conversion): Likewise. /testsuite 2012-04-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52422 * g++.dg/cpp0x/sfinae33.C: New. * g++.dg/cpp0x/sfinae34.C: Likewise. From-SVN: r186565
2012-04-18 12:21:43 +02:00
extern tree convert_member_func_to_ptr (tree, tree, tsubst_flags_t);
extern tree convert_ptrmem (tree, tree, bool, bool,
tsubst_flags_t);
extern int lvalue_or_else (tree, enum lvalue_use,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tsubst_flags_t);
extern void check_template_keyword (tree);
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
extern bool check_raw_literal_operator (const_tree decl);
extern bool check_literal_operator_args (const_tree, bool *, bool *);
extern void maybe_warn_about_useless_cast (tree, tree, tsubst_flags_t);
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
extern tree cp_perform_integral_promotions (tree, tsubst_flags_t);
1994-02-24 02:02:37 +01:00
extern tree finish_left_unary_fold_expr (tree, int);
extern tree finish_right_unary_fold_expr (tree, int);
extern tree finish_binary_fold_expr (tree, tree, int);
/* in typeck2.c */
extern void require_complete_eh_spec_types (tree, tree);
re PR c/70756 (Wrong column number shown for "error: invalid use of flexible array member") PR c/70756 * c-common.c (pointer_int_sum): Call size_in_bytes_loc instead of size_in_bytes and pass LOC to it. * c-decl.c (build_compound_literal): Pass LOC down to c_incomplete_type_error. * c-tree.h (require_complete_type): Adjust declaration. (c_incomplete_type_error): Likewise. * c-typeck.c (require_complete_type): Add location parameter, pass it down to c_incomplete_type_error. (c_incomplete_type_error): Add location parameter, pass it down to error_at. (build_component_ref): Pass location down to c_incomplete_type_error. (default_conversion): Pass location down to require_complete_type. (build_array_ref): Likewise. (build_function_call_vec): Likewise. (convert_arguments): Likewise. (build_unary_op): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (c_finish_omp_clauses): Likewise. * call.c (build_new_op_1): Pass LOC to cp_build_modify_expr. * cp-tree.h (cp_build_modify_expr): Update declaration. (cxx_incomplete_type_error, cxx_incomplete_type_diagnostic): New inline overloads. * cp-ubsan.c (cp_ubsan_dfs_initialize_vtbl_ptrs): Pass INPUT_LOCATION to cp_build_modify_expr. * decl2.c (set_guard): Likewise. (handle_tls_init): Likewise. * init.c (perform_member_init): Likewise. (expand_virtual_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (get_temp_regvar): Likewise. (build_vec_init): Likewise. * method.c (do_build_copy_assign): Likewise. (assignable_expr): Likewise. * semantics.c (finish_omp_for): Likewise. * typeck.c (cp_build_binary_op): Pass LOCATION to pointer_diff and cp_pointer_int_sum. (cp_pointer_int_sum): Add location parameter. Pass it down to pointer_int_sum. (pointer_diff): Add location parameter. Use it. (build_modify_expr): Pass location down to cp_build_modify_expr. (cp_build_modify_expr): Add location parameter. Use it. (build_x_modify_expr): Pass location down to cp_build_modify_expr. * typeck2.c (cxx_incomplete_type_diagnostic, cxx_incomplete_type_error): Add location parameter. * langhooks-def.h (lhd_incomplete_type_error): Adjust declaration. * langhooks.c (lhd_incomplete_type_error): Add location parameter. * langhooks.h (incomplete_type_error): Likewise. * tree.c (size_in_bytes_loc): Renamed from size_in_bytes. Add location parameter, pass it down to incomplete_type_error. * tree.h (size_in_bytes): New inline overload. (size_in_bytes_loc): Renamed from size_in_bytes. * c-c++-common/pr70756-2.c: New test. * c-c++-common/pr70756.c: New test. From-SVN: r236180
2016-05-12 17:28:08 +02:00
extern void cxx_incomplete_type_diagnostic (location_t, const_tree,
const_tree, diagnostic_t);
inline void
cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
diagnostic_t diag_kind)
{
cxx_incomplete_type_diagnostic (EXPR_LOC_OR_LOC (value, input_location),
value, type, diag_kind);
}
extern void cxx_incomplete_type_error (location_t, const_tree,
const_tree);
inline void
cxx_incomplete_type_error (const_tree value, const_tree type)
{
cxx_incomplete_type_diagnostic (value, type, DK_ERROR);
}
extern void cxx_incomplete_type_inform (const_tree);
extern tree error_not_base_type (tree, tree);
extern tree binfo_or_else (tree, tree);
extern void cxx_readonly_error (tree, enum lvalue_use);
extern void complete_type_check_abstract (tree);
extern int abstract_virtuals_error (tree, tree);
extern int abstract_virtuals_error (abstract_class_use, tree);
extern int abstract_virtuals_error_sfinae (tree, tree, tsubst_flags_t);
extern int abstract_virtuals_error_sfinae (abstract_class_use, tree, tsubst_flags_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
extern tree store_init_value (tree, tree, vec<tree, va_gc>**, int);
extern tree split_nonconstant_init (tree, tree);
extern bool check_narrowing (tree, tree, tsubst_flags_t);
extern tree digest_init (tree, tree, tsubst_flags_t);
extern tree digest_init_flags (tree, tree, int, tsubst_flags_t);
extern tree digest_nsdmi_init (tree, tree);
extern tree build_scoped_ref (tree, tree, tree *);
extern tree build_x_arrow (location_t, tree,
tsubst_flags_t);
re PR c++/52422 ([C++11][SFINAE] Hard errors with void or arithmetic expressions) /cp 2012-04-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52422 * cp-tree.h (build_addr_func, decay_conversion, get_member_function_from_ptrfunc, build_m_component_ref, convert_member_func_to_ptr): Add tsubst_flags_t parameter. * typeck.c (cp_default_conversion): Add. (decay_conversion, default_conversion, get_member_function_from_ptrfunc, convert_member_func_to_ptr): Add tsubst_flags_t parameter and use it throughout. (cp_build_indirect_ref, cp_build_array_ref, cp_build_function_call_vec, convert_arguments, build_x_binary_op, cp_build_binary_op, cp_build_unary_op, build_reinterpret_cast_1, build_const_cast_1, expand_ptrmemfunc_cst, convert_for_initialization): Adjust. * init.c (build_vec_init): Adjust. * decl.c (grok_reference_init, get_atexit_node): Likewise. * rtti.c (build_dynamic_cast_1, tinfo_base_init): Likewise. * except.c (build_throw): Likewise. * typeck2.c (build_x_arrow): Likewise. (build_m_component_ref): Add tsubst_flags_t parameter and use it throughout. * pt.c (convert_nontype_argument): Adjust. * semantics.c (finish_asm_stmt, maybe_add_lambda_conv_op): Likewise. * decl2.c (build_offset_ref_call_from_tree): Likewise. * call.c (build_addr_func): Add tsubst_flags_t parameter and use it throughout. (build_call_a, build_conditional_expr_1, build_new_op_1, convert_like_real, convert_arg_to_ellipsis, build_over_call, build_special_member_call): Adjust. * cvt.c (cp_convert_to_pointer, force_rvalue, build_expr_type_conversion): Likewise. /testsuite 2012-04-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52422 * g++.dg/cpp0x/sfinae33.C: New. * g++.dg/cpp0x/sfinae34.C: Likewise. From-SVN: r186565
2012-04-18 12:21:43 +02:00
extern tree build_m_component_ref (tree, tree, tsubst_flags_t);
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
extern tree build_functional_cast (tree, tree, tsubst_flags_t);
extern tree add_exception_specifier (tree, tree, int);
extern tree merge_exception_specifiers (tree, tree);
1994-02-24 02:02:37 +01:00
/* in mangle.c */
extern bool maybe_remove_implicit_alias (tree);
extern void init_mangle (void);
extern void mangle_decl (tree);
extern const char *mangle_type_string (tree);
extern tree mangle_typeinfo_for_type (tree);
extern tree mangle_typeinfo_string_for_type (tree);
extern tree mangle_vtbl_for_type (tree);
extern tree mangle_vtt_for_type (tree);
extern tree mangle_ctor_vtbl_for_type (tree, tree);
extern tree mangle_thunk (tree, int, tree, tree, tree);
extern tree mangle_conv_op_name_for_type (tree);
extern tree mangle_guard_variable (tree);
extern tree mangle_tls_init_fn (tree);
extern tree mangle_tls_wrapper_fn (tree);
extern bool decl_tls_wrapper_p (tree);
extern tree mangle_ref_init_variable (tree);
Commit the vtable verification feature. Commit the vtable verification feature. This feature is designed to detect, at run time, if/when the vtable pointer in a C++ object has been corrupted, before allowing virtual calls through that pointer. If pointer corruption is detected, execution of the program is halted. libstdc++-v3 ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * fragment.am: Add XTEMPLATE_FLAGS. * configure.ac: Add definitions for --enable-vtable-verify. * acinclude.m4: Add --enable-vtable-verify and --disable-vtable-verify; define --enable-vtable-verify; define VTV_CXXFLAGS, VTV_PCH_CXXFLAGS and VTV_CXXLINKFLAGS. * config/abi/pre/gnu.ver: Export symbols for vtable verification. * libsupc++/Makefile.am: Define vtv_sources and add it to libsupc___la_SOURCES and libsupc__convenience_la_SOURCES. * libsupc++/vtv_stubs.cc: New file. * include/Makefile.am: Add VTV_PCH_CXXFLAGS to PCHFLAGS. * src/Makefile.am: Add VTV_CXXFLAGS to AM_CXXFLAGS; add VTV_CXXLINKFLAGS to CXXLINK. * src/c++98/Makefile.am: Comment out XTEMPLATE_FLAGS; add VTV_CXXFLAGS to AM_CXXFLAGS; add VTV_CXXXLINKFLAGS to CXXLINK. * src/C++11/Makefile.am: Ditto. * doc/xml/manual/configure.xml: Add entry for --enable-vtable-verify. * scripts/testsuite_flags.in: Add cxxvtvflags to Usage; cause cxxvtvflags to use VTV_CXXFLAGS and VTV_CXXLINKFLAGS. * testsuite/lib/libstdc++.exp: Add cxxvtvflags; add code to locate libvtv if --enable-vtable-verify was used; set cxxvtvflags; add cxxvtvflags to cxx_final. * testsuite/18_support/bad_exception/23591_thread-1.c: Add -fvtable-verify=none to compiler flags. * testsuite/17_intro/freestanding.cc: Add -fvtable-verify=none to compiler flags. * configure: Regenerated. * Makefile.in: Regenerated. * python/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * libsupc++/Makefile.in: Regenerated. * config.h.in: Regenerated. * po/Makefile.in: Regenerated. * src/Makefile.in: Regenerated. * src/c++98/Makefile.in: Regenerated. * src/c++11/Makefile.in: Regenerated. * doc/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. top level ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * configure.ac: Add target-libvtv to target_libraries; disable libvtv on non-linux systems; add target-libvtv to noconfigdirs; add libsupc++/.libs to C++ library search paths. * configure: Regenerated. * Makefile.def: Add libvtv to target_modules; make libvtv depend on libstdc++ and libgcc. * Makefile.in: Regenerated. include/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * vtv-change-permission.h: New file. contrib/ChangeLog: 2013-08-06 Caroline Tice4 <cmtice@google.com> * gcc_update: Add libvtv files. libgcc/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> config.host (extra_parts): Add vtv_start.o, vtv_end.o vtv_start_preinit.o and vtv_end_preinit.o. configure.ac: Add code to check/set enable_vtable_verify. Makefile.in: Add rules to build vtv_*.o, if enable_vtable_verify is true. vtv_start_preinit.c: New file. vtv_end_preinit.c: New file. vtv_start.c: New file. vtv_end.c: New file. configure: Regenerated. gcc/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * gcc.c (VTABLE_VERIFICATION_SPEC): New definition. (LINK_COMMAND_SPEC): Add VTABLE_VERIFICATION_SPEC. * tree-pass.h: Add pass_vtable_verify. * varasm.c (assemble_variable): Add code to properly set the comdat section and name for the .vtable_map_vars section. (assemble_vtyv_preinit_initializer): New function. (default_sectin_type_flags): Make sure .vtable_map_vars section has LINK_ONCE flag. * output.h: Add function decl for assemble_vtv_preinit_initializer. * vtable-verify.c: New file. * vtable-verify.h: New file. * flag-types.h (enum vtv_priority): Defintions for flag_vtable_verify initialiation levels. * timevar.def (TV_VTABLE_VERIFICATION): New definition. * passes.def: Insert pass_vtable_verify. * aclocal.m4: Reorder includes. * doc/invoke.texi: Add documentation for the flags -fvtable-verify=, -fvtv-debug and -fvtv-counts. * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Add vtv_start*.o, as appropriate, if -fvtable-verify=... is used. (GNU_USER_TARGET_ENDFILE_SPEC): Add vtv_end*.o as appropriate, if -fvtable-verify=... is used. * Makefile.in (OBJS): Add vtable-verify.o to list. (vtable-verify.o): Add new build rule. (GTFILES): Add vtable-verify.c to list. * common.opt (fvtable-verify=): New flag. (vtv_priority): Values for fvtable-verify= flag. (fvtv-counts): New flag. (fvtv-debug): New flag. * tree.h (save_vtable_map_decl): New extern function decl. gcc/cp/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * Make-lang.in (*CXX_AND_OBJCXX_OBJS): Add vtable-class-hierarchy.o to list. (vtable-class-hierarchy.o): Add build rule. * cp-tree.h (vtv_start_verification_constructor_init_function): New extern function decl. (vtv_finish_verification_constructor_init_function): New extern function decl. (build_vtbl_address): New extern function decl. (get_mangled_vtable_map_var_name): New extern function decl. (vtv_compute_class_hierarchy_transitive_closure): New extern function decl. (vtv_generate_init_routine): New extern function decl. (vtv_save_class_info): New extern function decl. (vtv_recover_class_info): New extern function decl. (vtv_build_vtable_verify_fndecl): New extern function decl. * class.c (finish_struct_1): Add call to vtv_save_class_info if flag_vtable_verify is true. * config-lang.in: Add vtable-class-hierarchy.c to gtfiles list. * vtable-class-hierarchy.c: New file. * mangle.c (get_mangled_vtable_map_var_name): New function. * decl2.c (start_objects): Update function comment. (cp_write_global_declarations): Call vtv_recover_class_info, vtv_compute_class_hierarchy_transitive_closure and vtv_build_vtable_verify_fndecl, before calling finalize_compilation_unit, and call vtv_generate_init_rount after, IFF flag_vtable_verify is true. (vtv_start_verification_constructor_init_function): New function. (vtv_finish_verification_constructor_init_function): New function. * init.c (build_vtbl_address): Remove static qualifier from function. libvtv/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> Initial check-in of new vtable verification feature. * configure.ac : New file. * acinclude.m4 : New file. * Makefile.am : New file. * aclocal.m4 : New file. * configure.tgt : New file. * configure: New file (generated). * Makefile.in: New file (generated). * vtv_set.h : New file. * vtv_utils.cc : New file. * vtv_utils.h : New file. * vtv_malloc.cc : New file. * vtv_rts.cc : New file. * vtv_malloc.h : New file. * vtv_rts.h : New file. * vtv_fail.cc : New file. * vtv_fail.h : New file. * vtv_map.h : New file. * scripts/run-testsuite.sh : New file. * scripts/sum-vtv-counts.c : New file. * testsuite/parts-test-main.h : New file. * testusite/dataentry.cc : New file. * testsuite/temp_deriv.cc : New file. * testsuite/register_pair.cc : New file. * testsuite/virtual_inheritance.cc : New file. * testsuite/field-test.cc : New file. * testsuite/nested_vcall_test.cc : New file. * testsuite/template-list-iostream.cc : New file. * testsuite/register_pair_inserts.cc : New file. * testsuite/register_pair_inserts_mt.cc : New file. * testsuite/event.list : New file. * testsuite/parts-test-extra-parts-views.cc : New file. * testsuite/parts-test-extra-parts-views.h : New file. * testsuite/environment-fail-32.s : New file. * testsuite/parts-test-extra-parts.h : New file. * testsuite/temp_deriv2.cc : New file. * testsuite/dlopen_mt.cc : New file. * testsuite/event.h : New file. * testsuite/template-list.cc : New file. * testsuite/replace-fail.cc : New file. * testsuite/Makefile.am : New file. * testsuite/Makefile.in: New file (generated). * testsuite/mempool_negative.c : New file. * testsuite/parts-test-main.cc : New file. * testsuite/event-private.cc : New file. * testsuite/thunk.cc : New file. * testsuite/event-defintiions.cc : New file. * testsuite/event-private.h : New file. * testsuite/parts-test.list : New file. * testusite/register_pair_mt.cc : New file. * testsuite/povray-derived.cc : New file. * testsuite/event-main.cc : New file. * testsuite/environment.cc : New file. * testsuite/template-list2.cc : New file. * testsuite/thunk_vtable_map_attack.cc : New file. * testsuite/parts-test-extra-parts.cc : New file. * testsuite/environment-fail-64.s : New file. * testsuite/dlopen.cc : New file. * testsuite/so.cc : New file. * testsuite/temp_deriv3.cc : New file. * testsuite/const_vtable.cc : New file. * testsuite/mempool_positive.c : New file. * testsuite/dup_name.cc : New file. From-SVN: r201555
2013-08-07 05:38:59 +02:00
extern char * get_mangled_vtable_map_var_name (tree);
extern bool mangle_return_type_p (tree);
extern tree mangle_decomp (tree, vec<tree> &);
Makefile.in (C_AND_OBJC_OBJS): Add c-dump.o. * Makefile.in (C_AND_OBJC_OBJS): Add c-dump.o. (c-dump.o): New target. * c-common.h (flag_dump_translation_unit): New variable. (C_TYPE_QUALS): New macro. (strip_array_types): New function. (DECL_C_BIT_FIELD): New macro. (SET_DECL_C_BIT_FIELD): Likewise. (CLEAR_DECL_C_BIT_FIELD): Likewise. (dump_info_p): New typedef. (dump_tree_fn): Likewise. (lang_dump_tree): New variable. (dump_node_to_file): New function. * c-common.c (flag_dump_translation_unit): Define it. (strip_array_types): New function. * c-decl.c (c_decode_option): Handle -fdump-translation-unit. * c-lang.c (finish_file): Call dump_node_to_file if flag_dump_translation_unit. * c-semantics.c (mark_rtl_for_local_static): Fix typo in comment. * c-tree.h (DECL_C_BIT_FIELD): Remove declaration. * c-dump.c: New file. * Make-lang.in (CXX_C_OBJS): Add c-dump.o. (dump.o): Update dependency list. * cp-tree.h (DECL_MAYBE_TEMPLATE): Remove. (flag_dump_translation_unit): Likewise. (CP_TYPE_QUALS): Adjust definition. (DECL_C_BIT_FIELD): Remove. (SET_DECL_C_BIT_FIELD): Likewise. (CLEAR_DECL_C_BIT_FIELD): Likewise. (add_maybe_template): Likewise. (strip_array_types): Likewise. (dump_node_to_file): Likewise. (cp_dump_tree): New function. * decl.c (init_decl_processing): Set lang_dump_tree. * decl2.c (flag_dump_translation_unit): Remove. * dump.c: Move most of it to ../c-dump.c. (cp_dump_tree): New function. * pt.c (add_maybe_template): Remove. * typeck.c (strip_array_types): Likewise. From-SVN: r37358
2000-11-10 05:29:45 +01:00
/* in dump.c */
extern bool cp_dump_tree (void *, tree);
Makefile.in (C_AND_OBJC_OBJS): Add c-dump.o. * Makefile.in (C_AND_OBJC_OBJS): Add c-dump.o. (c-dump.o): New target. * c-common.h (flag_dump_translation_unit): New variable. (C_TYPE_QUALS): New macro. (strip_array_types): New function. (DECL_C_BIT_FIELD): New macro. (SET_DECL_C_BIT_FIELD): Likewise. (CLEAR_DECL_C_BIT_FIELD): Likewise. (dump_info_p): New typedef. (dump_tree_fn): Likewise. (lang_dump_tree): New variable. (dump_node_to_file): New function. * c-common.c (flag_dump_translation_unit): Define it. (strip_array_types): New function. * c-decl.c (c_decode_option): Handle -fdump-translation-unit. * c-lang.c (finish_file): Call dump_node_to_file if flag_dump_translation_unit. * c-semantics.c (mark_rtl_for_local_static): Fix typo in comment. * c-tree.h (DECL_C_BIT_FIELD): Remove declaration. * c-dump.c: New file. * Make-lang.in (CXX_C_OBJS): Add c-dump.o. (dump.o): Update dependency list. * cp-tree.h (DECL_MAYBE_TEMPLATE): Remove. (flag_dump_translation_unit): Likewise. (CP_TYPE_QUALS): Adjust definition. (DECL_C_BIT_FIELD): Remove. (SET_DECL_C_BIT_FIELD): Likewise. (CLEAR_DECL_C_BIT_FIELD): Likewise. (add_maybe_template): Likewise. (strip_array_types): Likewise. (dump_node_to_file): Likewise. (cp_dump_tree): New function. * decl.c (init_decl_processing): Set lang_dump_tree. * decl2.c (flag_dump_translation_unit): Remove. * dump.c: Move most of it to ../c-dump.c. (cp_dump_tree): New function. * pt.c (add_maybe_template): Remove. * typeck.c (strip_array_types): Likewise. From-SVN: r37358
2000-11-10 05:29:45 +01:00
Yet more Objective-C++... * cp-objcp-common.h (cxx_get_alias_set): Move from here... (cxx_warn_unused_global_decl): Likewise. (cp_expr_size): Likewise. (cp_tree_size): Likewise. (cp_var_mod_type_p): Likewise. (cxx_initialize_diagnostics): Likewise. (cxx_types_compatible_p): Likewise. * cp-tree.h: to here. (do_poplevel): Add. * lex.c (D_OBJC): Add. (init_reswords): Add. * Make-lang.in (cp/pt.o): Add cp/cp-objcp-common.h. * parser.c: Add c-common.h include. * pt.c: Add c-common.h and cp-objcp-common.h includes. (template_args_equal): Use objc_comptypes as well. (tsubst_copy_and_build): Use objcp_tsubst_copy_and_build as well. * semantics.c (do_poplevel): Remove static. * decl.c (objc_mark_locals_volatile): Don't change decls that are already ok. * decl2.c (generate_ctor_or_dtor_function): Add code to initialize Objective C++ early enough. * lex.c (struct resword reswords): Add Objective-C++ support. * parser.c (cp_lexer_get_preprocessor_token): Add Objective-C++. (cp_parser_objc_message_receiver): Add. (cp_parser_objc_message_args): Likewise. (cp_parser_objc_message_expression): Likewise. (cp_parser_objc_encode_expression): Likewise. (cp_parser_objc_defs_expression): Likewise. (cp_parser_objc_protocol_expression): Likewise. (cp_parser_objc_selector_expression): Likewise. (cp_parser_objc_expression): Likewise. (cp_parser_objc_visibility_spec): Likewise. (cp_parser_objc_method_type): Likewise. (cp_parser_objc_protocol_qualifiers): Likewise. (cp_parser_objc_typename): Likewise. (cp_parser_objc_selector_p): Likewise. (cp_parser_objc_selector): Likewise. (cp_parser_objc_method_keyword_params): Likewise. (cp_parser_objc_method_tail_params_opt): Likewise. (cp_parser_objc_interstitial_code): Likewise. (cp_parser_objc_method_signature): Likewise. (cp_parser_objc_method_prototype_list): Likewise. (cp_parser_objc_method_definition_list): Likewise. (cp_parser_objc_class_ivars): Likewise. (cp_parser_objc_identifier_list): Likewise. (cp_parser_objc_alias_declaration): Likewise. (cp_parser_objc_class_declaration): Likewise. (cp_parser_objc_protocol_declaration): Likewise. (cp_parser_objc_protocol_refs_opt): Likewise. (cp_parser_objc_superclass_or_category): Likewise. (cp_parser_objc_class_interface): Likewise. (cp_parser_objc_class_implementation): Likewise. (cp_parser_objc_end_implementation): Likewise. (cp_parser_objc_declaration): Likewise. (cp_parser_objc_try_catch_finally_statement): Likewise. (cp_parser_objc_synchronized_statement): Likewise. (cp_parser_objc_throw_statement): Likewise. (cp_parser_objc_statement): Likewise. (cp_parser_primary_expression): Add Objective-C++. (cp_parser_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_type_name): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_member_declaration) Likewise. * tree.c: Include debug.h. * typeck.c (composite_pointer_type): Add Objective-C++ support. (finish_class_member_access_expr): Likewise. (build_function_call): Allow objc to rewrite FUNCTION_DECLs. (build_modify_expr): Allow objc to generate write barriers. * Make-lang.in (cp/tree.o): Add debug.h. * tree.c (lvalue_p_1, case CONST_DECL): Add. From-SVN: r99855
2005-05-17 22:05:24 +02:00
/* In cp/cp-objcp-common.c. */
alias.h (alias_set_type): Define new type. ./: * alias.h (alias_set_type): Define new type. (ALIAS_SET_MEMORY_BARRIER): Use it. * rtl.h: Include alias.h. (struct mem_attrs): Use alias_set_type. * tree.h: Include alias.h (struct tree_type): Use alias_set_type. (struct tree_struct_field_tag): Likewise. (struct tree_decl_common): Likewise. * alias.c (struct alias_set_entry): Use alias_set_type. (get_alias_set_entry, alias_set_subset_of): Likewise. (alias_sets_conflict_p): Likewise. (alias_sets_must_conflict_p): Likewise. (objects_must_conflict_p): Likewise. (get_alias_set, new_alias_set): Likewise. (record_alias_subset, record_component_aliases): Likewise. (varargs_set, frame_set): Change to alias_set_type. (get_varargs_alias_set): Use alias_set_type. (get_frame_alias_set): Likewise. * builtins.c (setjmp_alias_set): Change to alias_set_type. * dse.c (struct store_info): Use alias_set_type. (struct read_info, struct clear_alias_mode_holder): Likewise. (clear_alias_set_lookup, canon_address): Likewise. (record_store, check_mem_read_rtx): Likewise. (dse_record_singleton_alias_set): Likewise. (dse_invalidate_singleton_alias_set): Likewise. * emit-rtl.c (get_mem_attrs): Likewise. (set_mem_attributes_minus_bitpos): Likewise. (set_mem_alias_set): Likewise. * expr.c (store_constructor_field, store_field): Likewise. * gimplify.c (struct gimplify_init_ctor_preeval_data): Likewise. * langhooks.c (lhd_get_alias_set): Likewise. * langhooks-def.h (lhd_get_alias_set): Likewise. * reload1.c (alter_reg): Likewise. * tree-flow.h (struct fieldoff): Likewise. * tree-ssa-alias.c (struct alias_map_d): Likewise. (may_alias_p, get_smt_for, create_sft): Likewise. * tree-ssa-alias-warnings.c (nonstandard_alias_types_p): Likewise. * tree-ssa-structalias.c (set_uids_in_ptset): Likewise. (merge_smts_into): Likewise. * varasm.c (const_alias_set): Likewise. * c-common.c (strict_aliasing_warning): Likewise. (c_common_get_alias_set): Likewise. * dse.h (dse_record_singleton_alias_set): Update declaration. (dse_invalidate_singleton_alias_set): Likewise. * emit-rtl.h (set_mem_alias_set): Likewise. * c-common.h (c_common_get_alias_set): Likewise. * print-rtl.c (print_rtx): Cast MEM_ALIAS_SET when printing it. * print-tree.c (print_node): Likewise. * config/alpha/alpha.c (alpha_sr_alias_set): Change to alias_set_type. (alpha_setup_incoming_varargs): Use alias_set_type. * config/i386/i386.c (setup_incoming_varargs_64): Use alias_set_type. (setup_incoming_varargs_ms_64): Likewise. (ix86_GOT_alias_set): Likewise. * config/mn10300/mn10300.c (mn10300_builtin_saveregs): Likewise. * config/rs6000/rs6000.c (setup_incoming_varargs): Likewise. (set): Change to alias_set_type. (get_TOC_alias_set): Use alias_set_type. * config/rs6000/rs6000-protos.h (get_TOC_alias_set): Update declaration. * config/sh/sh.c (sh_builtin_saveregs): Use alias_set_type. * config/sparc/sparc.c (sparc_sr_alias_set): Change to alias_set_type. (struct_value_alias_set): Likewise. * Makefile.in (GTFILES): Add $(srcdir)/alias.h. ada/: * misc.c (gnat_get_alias_set): Change return type to alias_set_type. cp/: * cp-objcp-common.c (cxx_get_alias_set): Change return type to alias_set_type. * cp/cp-tree.h (cxx_get_alias_set): Update declaration. fortran:/ * f95-lang.c (gfc_get_alias_set): Change return type to alias_set_type. From-SVN: r127362
2007-08-11 19:21:56 +02:00
extern alias_set_type cxx_get_alias_set (tree);
c-common.c (const_strip_array_types): New. * c-common.c (const_strip_array_types): New. * c-common.h (lang_missing_noreturn_ok_p): Delete. (const_strip_array_types): New. * c-objc-common.c (c_disregard_inline_limits, c_warn_unused_global_decl): Constify. * c-tree.h (c_disregard_inline_limits, c_warn_unused_global_decl, c_vla_type_p, c_incomplete_type_error): Likewise. * c-typeck.c (c_incomplete_type_error, c_vla_type_p): Likewise. * hooks.c (hook_bool_const_tree_false): New. * hooks.h (hook_bool_const_tree_false): Likewise. * langhooks-def.h (lhd_warn_unused_global_decl, lhd_incomplete_type_error, lhd_expr_size, lhd_tree_inlining_disregard_inline_limits, lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, LANG_HOOKS_GENERIC_TYPE_P, LANG_HOOKS_TYPE_MAX_SIZE): Constify. * langhooks.c (lhd_warn_unused_global_decl, lhd_incomplete_type_error, lhd_tree_inlining_disregard_inline_limits, lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, lhd_expr_size): Likewise. * langhooks.h (lang_hooks_for_tree_inlining, lang_hooks_for_tree_dump, lang_hooks_for_types, lang_hooks_for_decls, lang_hooks): Likewise. * pointer-set.c (pointer_set_t, pointer_set_create, pointer_set_contains, insert_aux, pointer_set_insert, pointer_set_traverse, pointer_map_t, pointer_map_create, pointer_map_contains, pointer_map_insert, pointer_map_traverse): Likewise. * pointer-set.h (pointer_set_contains, pointer_set_insert, pointer_set_traverse, pointer_map_contains, pointer_map_insert, pointer_map_traverse): Likewise. * predict.c (assert_is_empty): Likewise. * tree-affine.c (free_name_expansion): Likewise. * tree-cfg.c (edge_to_cases_cleanup): Likewise. * tree.c (size_in_bytes, max_int_size_in_bytes): Likewise. * tree.h (size_in_bytes, max_int_size_in_bytes): Likewise. ada: * misc.c (gnat_type_max_size): Constify. cp: * cp-objcp-common.c (cxx_warn_unused_global_decl, cp_expr_size): Constify. * cp-tree.h (local_variable_p, nonstatic_local_decl_p, class_tmpl_impl_spec_p, cp_auto_var_in_fn_p, cp_type_quals, cxx_incomplete_type_diagnostic, cxx_incomplete_type_error, cxx_warn_unused_global_decl, cp_expr_size): Likewise. * decl.c (local_variable_p, nonstatic_local_decl_p): Likewise. * tree.c (class_tmpl_impl_spec_p, cp_auto_var_in_fn_p): Likewise. * typeck.c (cp_type_quals): Likewise. * typeck2.c (cxx_incomplete_type_diagnostic, cxx_incomplete_type_error): Likewise. From-SVN: r127560
2007-08-16 16:31:21 +02:00
extern bool cxx_warn_unused_global_decl (const_tree);
extern size_t cp_tree_size (enum tree_code);
extern bool cp_var_mod_type_p (tree, tree);
opts-common.c (handle_option, [...]): Add diagnostic_context parameter. * opts-common.c (handle_option, handle_generated_option, read_cmdline_option, set_option): Add diagnostic_context parameter. Update calls among these functions. (set_option): Don't use global_dc. * opts.c (read_cmdline_options): Pass global_dc to read_cmdline_option. (decode_options): Pass global_dc to enable_warning_as_error. (common_handle_option): Pass global_dc to enable_warning_as_error. (enable_warning_as_error): Add diagnostic_context parameter. Document parameters. Don't use global_dc. Pass diagnostic_context parameter to handle_generated_option. * opts.h (set_option, handle_option, handle_generated_option, read_cmdline_option, enable_warning_as_error): Add diagnostic_context parameter. * Makefile.in (lto-opts.o): Update dependencies. * coretypes.h (struct diagnostic_context, diagnostic_context): Declare here. * diagnostic.h (diagnostic_context): Don't declare typedef here. * gcc.c (process_command): Pass global_dc to read_cmdline_option. * langhooks-def.h (struct diagnostic_context): Don't declare here. (lhd_print_error_function, lhd_initialize_diagnostics): Declare using diagnostic_context typedef. * langhooks.c (lhd_initialize_diagnostics): Declare using diagnostic_context typedef. * langhooks.h (struct diagnostic_context): Don't declare here. (initialize_diagnostics, print_error_function): Declare using diagnostic_context typedef. * lto-opts.c: Include diagnostic.h. (lto_reissue_options): Pass global_dc to set_option. Pass DK_UNSPECIFIED not 0. * plugin.c (plugins_internal_error_function): Declare using diagnostic_context typedef. * plugin.h (struct diagnostic_context): Don't declare here. (plugins_internal_error_function): Declare using diagnostic_context typedef. c-family: * c-common.h (struct diagnostic_context): Don't declare here. (c_common_initialize_diagnostics): Declare using diagnostic_context typedef. * c-opts.c (c_common_handle_option): Pass global_dc to handle_generated_option. cp: * cp-tree.h (cxx_print_error_function, cxx_initialize_diagnostics): Declare using diagnostic_context typedef. From-SVN: r164991
2010-10-05 16:28:39 +02:00
extern void cxx_initialize_diagnostics (diagnostic_context *);
extern int cxx_types_compatible_p (tree, tree);
extern void init_shadowed_var_for_decl (void);
extern bool cxx_block_may_fallthru (const_tree);
Yet more Objective-C++... * cp-objcp-common.h (cxx_get_alias_set): Move from here... (cxx_warn_unused_global_decl): Likewise. (cp_expr_size): Likewise. (cp_tree_size): Likewise. (cp_var_mod_type_p): Likewise. (cxx_initialize_diagnostics): Likewise. (cxx_types_compatible_p): Likewise. * cp-tree.h: to here. (do_poplevel): Add. * lex.c (D_OBJC): Add. (init_reswords): Add. * Make-lang.in (cp/pt.o): Add cp/cp-objcp-common.h. * parser.c: Add c-common.h include. * pt.c: Add c-common.h and cp-objcp-common.h includes. (template_args_equal): Use objc_comptypes as well. (tsubst_copy_and_build): Use objcp_tsubst_copy_and_build as well. * semantics.c (do_poplevel): Remove static. * decl.c (objc_mark_locals_volatile): Don't change decls that are already ok. * decl2.c (generate_ctor_or_dtor_function): Add code to initialize Objective C++ early enough. * lex.c (struct resword reswords): Add Objective-C++ support. * parser.c (cp_lexer_get_preprocessor_token): Add Objective-C++. (cp_parser_objc_message_receiver): Add. (cp_parser_objc_message_args): Likewise. (cp_parser_objc_message_expression): Likewise. (cp_parser_objc_encode_expression): Likewise. (cp_parser_objc_defs_expression): Likewise. (cp_parser_objc_protocol_expression): Likewise. (cp_parser_objc_selector_expression): Likewise. (cp_parser_objc_expression): Likewise. (cp_parser_objc_visibility_spec): Likewise. (cp_parser_objc_method_type): Likewise. (cp_parser_objc_protocol_qualifiers): Likewise. (cp_parser_objc_typename): Likewise. (cp_parser_objc_selector_p): Likewise. (cp_parser_objc_selector): Likewise. (cp_parser_objc_method_keyword_params): Likewise. (cp_parser_objc_method_tail_params_opt): Likewise. (cp_parser_objc_interstitial_code): Likewise. (cp_parser_objc_method_signature): Likewise. (cp_parser_objc_method_prototype_list): Likewise. (cp_parser_objc_method_definition_list): Likewise. (cp_parser_objc_class_ivars): Likewise. (cp_parser_objc_identifier_list): Likewise. (cp_parser_objc_alias_declaration): Likewise. (cp_parser_objc_class_declaration): Likewise. (cp_parser_objc_protocol_declaration): Likewise. (cp_parser_objc_protocol_refs_opt): Likewise. (cp_parser_objc_superclass_or_category): Likewise. (cp_parser_objc_class_interface): Likewise. (cp_parser_objc_class_implementation): Likewise. (cp_parser_objc_end_implementation): Likewise. (cp_parser_objc_declaration): Likewise. (cp_parser_objc_try_catch_finally_statement): Likewise. (cp_parser_objc_synchronized_statement): Likewise. (cp_parser_objc_throw_statement): Likewise. (cp_parser_objc_statement): Likewise. (cp_parser_primary_expression): Add Objective-C++. (cp_parser_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_type_name): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_member_declaration) Likewise. * tree.c: Include debug.h. * typeck.c (composite_pointer_type): Add Objective-C++ support. (finish_class_member_access_expr): Likewise. (build_function_call): Allow objc to rewrite FUNCTION_DECLs. (build_modify_expr): Allow objc to generate write barriers. * Make-lang.in (cp/tree.o): Add debug.h. * tree.c (lvalue_p_1, case CONST_DECL): Add. From-SVN: r99855
2005-05-17 22:05:24 +02:00
/* in cp-gimplify.c */
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
extern int cp_gimplify_expr (tree *, gimple_seq *,
gimple_seq *);
extern void cp_genericize (tree);
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * testsuite/libgomp.c/atomic-11.c: New test. * testsuite/libgomp.c/atomic-12.c: New test. * testsuite/libgomp.c/atomic-13.c: New test. * testsuite/libgomp.c/atomic-14.c: New test. * testsuite/libgomp.c/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
extern bool cxx_omp_const_qual_no_mutable (tree);
extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree);
extern tree cxx_omp_clause_default_ctor (tree, tree, tree);
extern tree cxx_omp_clause_copy_ctor (tree, tree, tree);
extern tree cxx_omp_clause_assign_op (tree, tree, tree);
extern tree cxx_omp_clause_dtor (tree, tree);
gimplify.c (omp_notice_variable): If n is non-NULL and no flags change in ORT_TARGET region, don't jump to do_outer. * gimplify.c (omp_notice_variable): If n is non-NULL and no flags change in ORT_TARGET region, don't jump to do_outer. (struct gimplify_adjust_omp_clauses_data): New type. (gimplify_adjust_omp_clauses_1): Adjust for data being a struct gimplify_adjust_omp_clauses_data pointer instead of tree *. Pass pre_p as a new argument to lang_hooks.decls.omp_finish_clause hook. (gimplify_adjust_omp_clauses): Add pre_p argument, adjust splay_tree_foreach to pass both list_p and pre_p. (gimplify_omp_parallel, gimplify_omp_task, gimplify_omp_for, gimplify_omp_workshare, gimplify_omp_target_update): Adjust gimplify_adjust_omp_clauses callers. * langhooks.c (lhd_omp_finish_clause): New function. * langhooks-def.h (lhd_omp_finish_clause): New prototype. (LANG_HOOKS_OMP_FINISH_CLAUSE): Define to lhd_omp_finish_clause. * langhooks.h (struct lang_hooks_for_decls): Add a new gimple_seq * argument to omp_finish_clause hook. * omp-low.c (scan_sharing_clauses): Call scan_omp_op on non-DECL_P OMP_CLAUSE_DECL if ctx->outer. (scan_omp_parallel, lower_omp_for): When adding _LOOPTEMP_ clause var, add it to outer ctx's decl_map as identity. * tree-core.h (OMP_CLAUSE_MAP_TO_PSET): New map kind. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Handle various OpenMP 4.0 clauses. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_MAP_TO_PSET. gcc/cp/ * cp-gimplify.c (cxx_omp_finish_clause): Add a gimple_seq * argument. * cp-tree.h (cxx_omp_finish_clause): Adjust prototype. gcc/fortran/ * cpp.c (cpp_define_builtins): Change _OPENMP macro to 201307. * dump-parse-tree.c (show_omp_namelist): Add list_type argument. Adjust for rop being u.reduction_op now, handle depend_op or map_op. (show_omp_node): Adjust callers. Print some new OpenMP 4.0 clauses, adjust for OMP_LIST_DEPEND_{IN,OUT} becoming a single OMP_LIST_DEPEND. * f95-lang.c (gfc_handle_omp_declare_target_attribute): New function. (gfc_attribute_table): New variable. (LANG_HOOKS_OMP_FINISH_CLAUSE, LANG_HOOKS_ATTRIBUTE_TABLE): Redefine. * frontend-passes.c (gfc_code_walker): Handle new OpenMP target EXEC_OMP_* codes and new clauses. * gfortran.h (gfc_statement): Add ST_OMP_TARGET, ST_OMP_END_TARGET, ST_OMP_TARGET_DATA, ST_OMP_END_TARGET_DATA, ST_OMP_TARGET_UPDATE, ST_OMP_DECLARE_TARGET, ST_OMP_TEAMS, ST_OMP_END_TEAMS, ST_OMP_DISTRIBUTE, ST_OMP_END_DISTRIBUTE, ST_OMP_DISTRIBUTE_SIMD, ST_OMP_END_DISTRIBUTE_SIMD, ST_OMP_DISTRIBUTE_PARALLEL_DO, ST_OMP_END_DISTRIBUTE_PARALLEL_DO, ST_OMP_DISTRIBUTE_PARALLEL_DO_SIMD, ST_OMP_END_DISTRIBUTE_PARALLEL_DO_SIMD, ST_OMP_TARGET_TEAMS, ST_OMP_END_TARGET_TEAMS, ST_OMP_TEAMS_DISTRIBUTE, ST_OMP_END_TEAMS_DISTRIBUTE, ST_OMP_TEAMS_DISTRIBUTE_SIMD, ST_OMP_END_TEAMS_DISTRIBUTE_SIMD, ST_OMP_TARGET_TEAMS_DISTRIBUTE, ST_OMP_END_TARGET_TEAMS_DISTRIBUTE, ST_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD, ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_SIMD, ST_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO, ST_OMP_END_TEAMS_DISTRIBUTE_PARALLEL_DO, ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO, ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO, ST_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, ST_OMP_END_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD and ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD. (symbol_attribute): Add omp_declare_target field. (gfc_omp_depend_op, gfc_omp_map_op): New enums. (gfc_omp_namelist): Replace rop field with union containing reduction_op, depend_op and map_op. (OMP_LIST_DEPEND_IN, OMP_LIST_DEPEND_OUT): Remove. (OMP_LIST_DEPEND, OMP_LIST_MAP, OMP_LIST_TO, OMP_LIST_FROM): New. (gfc_omp_clauses): Add num_teams, device, thread_limit, dist_sched_kind, dist_chunk_size fields. (gfc_common_head): Add omp_declare_target field. (gfc_exec_op): Add EXEC_OMP_TARGET, EXEC_OMP_TARGET_DATA, EXEC_OMP_TEAMS, EXEC_OMP_DISTRIBUTE, EXEC_OMP_DISTRIBUTE_SIMD, EXEC_OMP_DISTRIBUTE_PARALLEL_DO, EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD, EXEC_OMP_TARGET_TEAMS, EXEC_OMP_TEAMS_DISTRIBUTE, EXEC_OMP_TEAMS_DISTRIBUTE_SIMD, EXEC_OMP_TARGET_TEAMS_DISTRIBUTE, EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD, EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO, EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO, EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD and EXEC_OMP_TARGET_UPDATE. (gfc_add_omp_declare_target): New prototype. * match.h (gfc_match_omp_declare_target, gfc_match_omp_distribute, gfc_match_omp_distribute_parallel_do, gfc_match_omp_distribute_parallel_do_simd, gfc_match_omp_distribute_simd, gfc_match_omp_target, gfc_match_omp_target_data, gfc_match_omp_target_teams, gfc_match_omp_target_teams_distribute, gfc_match_omp_target_teams_distribute_parallel_do, gfc_match_omp_target_teams_distribute_parallel_do_simd, gfc_match_omp_target_teams_distribute_simd, gfc_match_omp_target_update, gfc_match_omp_teams, gfc_match_omp_teams_distribute, gfc_match_omp_teams_distribute_parallel_do, gfc_match_omp_teams_distribute_parallel_do_simd, gfc_match_omp_teams_distribute_simd): New prototypes. * module.c (ab_attribute): Add AB_OMP_DECLARE_TARGET. (attr_bits): Likewise. (mio_symbol_attribute): Handle omp_declare_target attribute. (gfc_free_omp_clauses): Free num_teams, device, thread_limit and dist_chunk_size expressions. (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE, OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE, OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION, OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE, OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE, OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH, OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND, OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM): Use 1U instead of 1. (OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO, OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT, OMP_CLAUSE_DIST_SCHEDULE): Define. (gfc_match_omp_clauses): Change mask parameter to unsigned int. Adjust for rop becoming u.reduction_op. Disallow inbranch with notinbranch. For depend clause, always create OMP_LIST_DEPEND and fill in u.depend_op. Handle num_teams, device, map, to, from, thread_limit and dist_schedule clauses. (OMP_DECLARE_SIMD_CLAUSES): Or in OMP_CLAUSE_INBRANCH and OMP_CLAUSE_NOTINBRANCH. (OMP_TARGET_CLAUSES, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_TEAMS_CLAUSES, OMP_DISTRIBUTE_CLAUSES): Define. (match_omp): New function. (gfc_match_omp_do, gfc_match_omp_do_simd, gfc_match_omp_parallel, gfc_match_omp_parallel_do, gfc_match_omp_parallel_do_simd, gfc_match_omp_parallel_sections, gfc_match_omp_parallel_workshare, gfc_match_omp_sections, gfc_match_omp_simd, gfc_match_omp_single, gfc_match_omp_task): Rewritten using match_omp. (gfc_match_omp_threadprivate, gfc_match_omp_declare_reduction): Diagnose if the directives are followed by unexpected junk. (gfc_match_omp_distribute, gfc_match_omp_distribute_parallel_do, gfc_match_omp_distribute_parallel_do_simd, gfc_match_omp_distrbute_simd, gfc_match_omp_declare_target, gfc_match_omp_target, gfc_match_omp_target_data, gfc_match_omp_target_teams, gfc_match_omp_target_teams_distribute, gfc_match_omp_target_teams_distribute_parallel_do, gfc_match_omp_target_teams_distribute_parallel_do_simd, gfc_match_omp_target_teams_distrbute_simd, gfc_match_omp_target_update, gfc_match_omp_teams, gfc_match_omp_teams_distribute, gfc_match_omp_teams_distribute_parallel_do, gfc_match_omp_teams_distribute_parallel_do_simd, gfc_match_omp_teams_distrbute_simd): New functions. * openmp.c (resolve_omp_clauses): Adjust for OMP_LIST_DEPEND_{IN,OUT} being changed to OMP_LIST_DEPEND. Handle OMP_LIST_MAP, OMP_LIST_FROM, OMP_LIST_TO, num_teams, device, dist_chunk_size and thread_limit. (gfc_resolve_omp_parallel_blocks): Only put sharing clauses into ctx.sharing_clauses. Call gfc_resolve_omp_do_blocks for various new EXEC_OMP_* codes. (resolve_omp_do): Handle various new EXEC_OMP_* codes. (gfc_resolve_omp_directive): Likewise. (gfc_resolve_omp_declare_simd): Add missing space to diagnostics. * parse.c (decode_omp_directive): Handle parsing of OpenMP 4.0 offloading related directives. (case_executable): Add ST_OMP_TARGET_UPDATE. (case_exec_markers): Add ST_OMP_TARGET*, ST_OMP_TEAMS*, ST_OMP_DISTRIBUTE*. (case_decl): Add ST_OMP_DECLARE_TARGET. (gfc_ascii_statement): Handle new ST_OMP_* codes. (parse_omp_do): Handle various new ST_OMP_* codes. (parse_executable): Likewise. * resolve.c (gfc_resolve_blocks): Handle various new EXEC_OMP_* codes. (resolve_code): Likewise. (resolve_symbol): Change that !$OMP DECLARE TARGET variables are saved. * st.c (gfc_free_statement): Handle various new EXEC_OMP_* codes. * symbol.c (check_conflict): Check omp_declare_target conflicts. (gfc_add_omp_declare_target): New function. (gfc_copy_attr): Copy omp_declare_target. * trans.c (trans_code): Handle various new EXEC_OMP_* codes. * trans-common.c (build_common_decl): Add "omp declare target" attribute if needed. * trans-decl.c (add_attributes_to_decl): Likewise. * trans.h (gfc_omp_finish_clause): New prototype. * trans-openmp.c (gfc_omp_finish_clause): New function. (gfc_trans_omp_reduction_list): Adjust for rop being renamed to u.reduction_op. (gfc_trans_omp_clauses): Adjust for OMP_LIST_DEPEND_{IN,OUT} change to OMP_LIST_DEPEND and fix up depend handling. Handle OMP_LIST_MAP, OMP_LIST_TO, OMP_LIST_FROM, num_teams, thread_limit, device, dist_chunk_size and dist_sched_kind. (gfc_trans_omp_do): Handle EXEC_OMP_DISTRIBUTE. (GFC_OMP_SPLIT_DISTRIBUTE, GFC_OMP_SPLIT_TEAMS, GFC_OMP_SPLIT_TARGET, GFC_OMP_SPLIT_NUM, GFC_OMP_MASK_DISTRIBUTE, GFC_OMP_MASK_TEAMS, GFC_OMP_MASK_TARGET, GFC_OMP_MASK_NUM): New. (gfc_split_omp_clauses): Handle splitting of clauses for new EXEC_OMP_* codes. (gfc_trans_omp_do_simd): Add pblock argument, adjust for being callable for combined constructs. (gfc_trans_omp_parallel_do, gfc_trans_omp_parallel_do_simd): Likewise. (gfc_trans_omp_distribute, gfc_trans_omp_teams, gfc_trans_omp_target, gfc_trans_omp_target_data, gfc_trans_omp_target_update): New functions. (gfc_trans_omp_directive): Adjust gfc_trans_omp_* callers, handle new EXEC_OMP_* codes. gcc/testsuite/ * gfortran.dg/gomp/declare-simd-1.f90: New test. * gfortran.dg/gomp/depend-1.f90: New test. * gfortran.dg/gomp/target1.f90: New test. * gfortran.dg/gomp/target2.f90: New test. * gfortran.dg/gomp/target3.f90: New test. * gfortran.dg/gomp/udr4.f90: Adjust expected diagnostics. * gfortran.dg/openmp-define-3.f90: Expect _OPENMP 201307 instead of 201107. libgomp/ * omp_lib.f90.in (openmp_version): Set to 201307. * omp_lib.h.in (openmp_version): Likewise. * testsuite/libgomp.c/target-8.c: New test. * testsuite/libgomp.fortran/declare-simd-1.f90: Add notinbranch and inbranch clauses. * testsuite/libgomp.fortran/depend-3.f90: New test. * testsuite/libgomp.fortran/openmp_version-1.f: Adjust for new openmp_version. * testsuite/libgomp.fortran/openmp_version-2.f90: Likewise. * testsuite/libgomp.fortran/target1.f90: New test. * testsuite/libgomp.fortran/target2.f90: New test. * testsuite/libgomp.fortran/target3.f90: New test. * testsuite/libgomp.fortran/target4.f90: New test. * testsuite/libgomp.fortran/target5.f90: New test. * testsuite/libgomp.fortran/target6.f90: New test. * testsuite/libgomp.fortran/target7.f90: New test. From-SVN: r211768
2014-06-18 09:16:12 +02:00
extern void cxx_omp_finish_clause (tree, gimple_seq *);
extern bool cxx_omp_privatize_by_reference (const_tree);
builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, [...]): New. gcc/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. * cgraph.h (enum cgraph_simd_clone_arg_type): Add SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP, SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP. (struct cgraph_simd_clone_arg): Adjust comment. * coretypes.h (struct gomp_ordered): New forward decl. * gimple.c (gimple_build_omp_critical): Add CLAUSES argument, set critical clauses to it. (gimple_build_omp_ordered): Return gomp_ordered * instead of gimple *. Add CLAUSES argument, set ordered clauses to it. (gimple_copy): Unshare clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimple.def (GIMPLE_OMP_ORDERED): Change from GSS_OMP to GSS_OMP_SINGLE_LAYOUT, move it after GIMPLE_OMP_TEAMS. * gimple.h (enum gf_mask): Add GF_OMP_TASK_TASKLOOP. Add another bit to GF_OMP_FOR_KIND_MASK mask. Add GF_OMP_FOR_KIND_TASKLOOP, renumber GF_OMP_FOR_KIND_CILKFOR and GF_OMP_FOR_KIND_OACC_LOOP. Adjust GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED and GF_OMP_FOR_COMBINED_INTO. Add another bit to GF_OMP_TARGET_KIND_MASK mask. Add GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, renumber GF_OMP_TARGET_KIND_OACC_{PARALLEL,KERNELS,DATA,UPDATE,ENTER_EXIT_DATA}. (gomp_critical): Add clauses field. (gomp_ordered): New struct. (is_a_helper <gomp_ordered *>::test): New inline. (gimple_build_omp_critical): Add CLAUSES argument. (gimple_build_omp_ordered): Likewise. Return gomp_ordered * instead of gimple *. (gimple_omp_critical_clauses, gimple_omp_critical_clauses_ptr, gimple_omp_critical_set_clauses, gimple_omp_ordered_clauses, gimple_omp_ordered_clauses_ptr, gimple_omp_ordered_set_clauses, gimple_omp_task_taskloop_p, gimple_omp_task_set_taskloop_p): New inline functions. * gimple-pretty-print.c (dump_gimple_omp_for): Handle taskloop. (dump_gimple_omp_target): Handle enter data and exit data. (dump_gimple_omp_block): Don't handle GIMPLE_OMP_ORDERED here. (dump_gimple_omp_critical): Print clauses. (dump_gimple_omp_ordered): New function. (dump_gimple_omp_task): Handle taskloop. (pp_gimple_stmt_1): Use dump_gimple_omp_ordered for GIMPLE_OMP_ORDERED. * gimple-walk.c (walk_gimple_op): Walk clauses on GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED. * gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_0LEN_ARRAY. (enum omp_region_type): Add ORT_COMBINED_TARGET and ORT_NONE. (struct gimplify_omp_ctx): Add loop_iter_var, target_map_scalars_firstprivate, target_map_pointers_as_0len_arrays and target_firstprivatize_array_bases fields. (delete_omp_context): Release loop_iter_var. (gimplify_bind_expr): Handle ORT_NONE. (maybe_fold_stmt): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (is_gimple_stmt): Return true for OMP_TASKLOOP, OMP_TEAMS and OMP_TARGET{,_DATA,_UPDATE,_ENTER_DATA,_EXIT_DATA}. (omp_firstprivatize_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle ctx->target_map_scalars_firstprivate. (omp_add_variable): Handle ORT_NONE. Allow map clause together with data sharing clauses. For data sharing clause with VLA decl on omp target/target data don't add firstprivate for the pointer. Call omp_notice_variable on TYPE_SIZE_UNIT only if it is a DECL_P. (omp_notice_threadprivate_variable): Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (omp_notice_variable): Handle ORT_NONE. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Handle implicit mapping of pointers as zero length array sections and ctx->target_map_scalars_firstprivate mapping of scalars as firstprivate data sharing. (omp_check_private): Handle omp_member_access_dummy_var vars. (find_decl_expr): New function. (gimplify_scan_omp_clauses): Add CODE argument. For OMP_CLAUSE_IF complain if OMP_CLAUSE_IF_MODIFIER is present and does not match code. Handle OMP_CLAUSE_GANG separately. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. Diagnose linear clause on combined distribute {, parallel for} simd construct, unless it is the loop iterator. Handle struct element GOMP_MAP_FIRSTPRIVATE_POINTER. Handle map clauses with COMPONENT_REF. Initialize ctx->target_map_scalars_firstprivate, ctx->target_firstprivatize_array_bases and ctx->target_map_pointers_as_0len_arrays. Add firstprivate for linear clause even to target region if combined. Remove map clauses with GOMP_MAP_FIRSTPRIVATE_POINTER kind from OMP_TARGET_{,ENTER_,EXIT_}DATA. For GOMP_MAP_FIRSTPRIVATE_POINTER map kind with non-INTEGER_CST OMP_CLAUSE_SIZE firstprivatize the bias. Handle OMP_CLAUSE_DEPEND_{SINK,SOURCE}. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. For linear clause on worksharing loop combined with parallel add shared clause on the parallel. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set DECL_NAME on omp_member_access_dummy_var vars. Add lastprivate clause to outer taskloop if needed. (gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_0LEN_ARRAY. If gimplify_omp_ctxp->target_firstprivatize_array_bases, use GOMP_MAP_FIRSTPRIVATE_POINTER map kind instead of GOMP_MAP_POINTER. (gimplify_adjust_omp_clauses): Add CODE argument. Handle removal of GOMP_MAP_FIRSTPRIVATE_POINTER struct elements for struct not seen in target body. Handle removal of struct mapping if struct is not seen in target body. Remove GOMP_MAP_STRUCT map clause on OMP_TARGET_EXIT_DATA. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. Use GOMP_MAP_FIRSTPRIVATE_POINTER instead of GOMP_MAP_POINTER if ctx->target_firstprivatize_array_bases for VLAs. Set OMP_CLAUSE_MAP_PRIVATE if both data sharing and map clause appear together. Handle OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}. Don't remove map clause if it has map-type-modifier always. Handle OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN} clauses. (gimplify_oacc_cache, gimplify_omp_parallel, gimplify_omp_task): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. (gimplify_omp_for): Likewise. Handle OMP_TASKLOOP. Initialize loop_iter_var. Use OMP_FOR_ORIG_DECLS. Fix handling of lastprivate iterators in doacross loops. (gimplify_omp_workshare): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Use ORT_COMBINED_TARGET for OMP_TARGET_COMBINED. Adjust check for ORT_TARGET for the addition of ORT_COMBINED_TARGET. (gimplify_omp_target_update): Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses callers. Handle OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. (gimplify_omp_ordered): New function. (gimplify_expr): Handle OMP_TASKLOOP, OMP_TARGET_ENTER_DATA and OMP_TARGET_EXIT_DATA. Use gimplify_omp_ordered for OMP_ORDERED. Gimplify clauses on OMP_CRITICAL. * internal-fn.c (expand_GOMP_SIMD_ORDERED_START, expand_GOMP_SIMD_ORDERED_END): New functions. * internal-fn.def (GOMP_SIMD_ORDERED_START, GOMP_SIMD_ORDERED_END): New internal functions. * omp-builtins.def (BUILT_IN_GOMP_LOOP_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_STATIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, BUILT_IN_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, BUILT_IN_GOMP_DOACROSS_POST, BUILT_IN_GOMP_DOACROSS_WAIT, BUILT_IN_GOMP_DOACROSS_ULL_POST, BUILT_IN_GOMP_DOACROSS_ULL_WAIT, BUILT_IN_GOMP_TARGET_ENTER_EXIT_DATA, BUILT_IN_GOMP_TASKLOOP, BUILT_IN_GOMP_TASKLOOP_ULL): New built-ins. (BUILT_IN_GOMP_TASK): Add INT argument to the end. (BUILT_IN_GOMP_TARGET): Rename from GOMP_target to GOMP_target_41, adjust type. (BUILT_IN_GOMP_TARGET_DATA): Rename from GOMP_target_data to GOMP_target_data_41, adjust type. (BUILT_IN_GOMP_TARGET_UPDATE): Rename from GOMP_target_update to GOMP_target_update_41, adjust type. * omp-low.c (struct omp_region): Adjust comments, add ord_stmt field. (struct omp_for_data): Add ordered and simd_schedule fields. (omp_member_access_dummy_var, unshare_and_remap_1, unshare_and_remap, is_taskloop_ctx): New functions. (is_taskreg_ctx): Use is_parallel_ctx and is_task_ctx. (extract_omp_for_data): Handle taskloops and doacross loops and simd schedule modifier. (omp_adjust_chunk_size): New function. (get_ws_args_for): Use it. (lookup_sfield): Change first argument to splay_tree_key, add overload with first argument tree. (maybe_lookup_field): Likewise. (use_pointer_for_field): Handle omp_member_access_dummy_var. (omp_copy_decl_2): If var is TREE_ADDRESSABLE listed in task_shared_vars, clear TREE_ADDRESSABLE on the copy. (build_outer_var_ref): Add LASTPRIVATE argument, handle taskloops and omp_member_access_dummy_var vars. (build_sender_ref): Change first argument to splay_tree_key, add overload with first argument tree. (install_var_field): For mask & 8 use &DECL_UID as key instead of the tree itself. (fixup_child_record_type): Const qualify *.omp_data_i. (scan_sharing_clauses): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE, C/C++ array reductions, OMP_CLAUSE_{IS,USE}_DEVICE_PTR clauses, OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,SIMDLEN,THREADS,SIMD} and OMP_CLAUSE_{NOGROUP,DEFAULTMAP} clauses, OMP_CLAUSE__LOOPTEMP_ clause on taskloop, GOMP_MAP_FIRSTPRIVATE_POINTER, OMP_CLAUSE_MAP_PRIVATE. (create_omp_child_function): Set TREE_READONLY on .omp_data_i. (find_combined_for): Allow searching for different GIMPLE_OMP_FOR kinds. (add_taskreg_looptemp_clauses): New function. (scan_omp_parallel): Use it. (scan_omp_task): Likewise. (finish_taskreg_scan): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. For taskloop, move fields for the first two _LOOPTEMP_ clauses first. (check_omp_nesting_restrictions): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Formatting fixes. Allow the sandwiched taskloop constructs. Type check OMP_CLAUSE_DEPEND_{KIND,SOURCE}. Allow ordered simd inside of simd region. Diagnose depend(source) or depend(sink:...) on target constructs or task/taskloop. (handle_simd_reference): Use get_name. (lower_rec_input_clauses): Likewise. Ignore all OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses on taskloop construct. Allow _LOOPTEMP_ clause on GOMP_TASK. Unshare new_var before passing it to omp_clause_{default,copy}_ctor. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Set lastprivate_firstprivate flag for linear that needs copyin and copyout. Use BUILT_IN_ALLOCA_WITH_ALIGN instead of BUILT_IN_ALLOCA. (lower_lastprivate_clauses): For OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE on taskloop lookup decl in outer context. Pass true to build_outer_var_ref lastprivate argument. Handle OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV lastprivate if the decl is global outside of outer taskloop for. (lower_reduction_clauses): Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. (lower_send_clauses): Ignore first two _LOOPTEMP_ clauses in taskloop GOMP_TASK. Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. Handle omp_member_access_dummy_var vars. Handle OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL. Use new lookup_sfield overload. (lower_send_shared_vars): Ignore fields with NULL or FIELD_DECL abstract origin. Handle omp_member_access_dummy_var vars. (expand_parallel_call): Use expand_omp_build_assign. (expand_task_call): Handle taskloop construct expansion. Add REGION argument. Use GOMP_TASK_* defines instead of hardcoded integers. Add priority argument to GOMP_task* calls. Or in GOMP_TASK_FLAG_PRIORITY into flags if priority is present for GOMP_task call. (expand_omp_build_assign): Add prototype. Add AFTER argument, if true emit statements after *GSI_P and continue linking. (expand_omp_taskreg): Adjust expand_task_call caller. (expand_omp_for_init_counts): Rename zero_iter_bb argument to zero_iter1_bb and first_zero_iter to first_zero_iter1, add zero_iter2_bb and first_zero_iter2 arguments, handle computation of counts even for ordered loops. (expand_omp_for_init_vars): Handle GOMP_TASK inner_stmt. (expand_omp_ordered_source, expand_omp_ordered_sink, expand_omp_ordered_source_sink, expand_omp_for_ordered_loops): New functions. (expand_omp_for_generic): Use omp_adjust_chunk_size. Handle linear clauses on worksharing loop. Handle DOACROSS loop expansion. (expand_omp_for_static_nochunk): Handle linear clauses on worksharing loop. Adjust expand_omp_for_init_counts callers. (expand_omp_for_static_chunk): Likewise. Use omp_adjust_chunk_size. (expand_omp_simd): Handle addressable fd->loop.v. Adjust expand_omp_for_init_counts callers. (expand_omp_taskloop_for_outer, expand_omp_taskloop_for_inner): New functions. (expand_omp_for): Call expand_omp_taskloop_for_* for taskloop. Handle doacross loops. (expand_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Pass flags and depend arguments to GOMP_target_{41,update_41,enter_exit_data} libcalls. (expand_omp): Don't expand ordered depend constructs here, record ord_stmt instead for later expand_omp_for_generic. (build_omp_regions_1): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (lower_omp_ordered_clauses): New function. (lower_omp_ordered): Handle OMP_CLAUSE_SIMD, for OMP_CLAUSE_DEPEND don't lower anything. (lower_omp_for_lastprivate): Use last _looptemp_ clause on taskloop for comparison. (lower_omp_for): Handle taskloop constructs. Adjust OMP_CLAUSE_DECL and OMP_CLAUSE_LINEAR_STEP so that expand_omp_for_* can use it during expansion for linear adjustments. (create_task_copyfn): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE. (lower_depend_clauses): Assert not seeing sink/source depend kinds. Set TREE_ADDRESSABLE on array. Change first argument from gimple * to tree * pointing to the stmt's clauses. (lower_omp_taskreg): Adjust lower_depend_clauses caller. (lower_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA, depend clauses, GOMP_MAP_{RELEASE,ALWAYS_{TO,FROM,TOFROM},FIRSTPRIVATE_POINTER,STRUCT} map kinds, OMP_CLAUSE_{FIRSTPRIVATE,PRIVATE,{IS,USE}_DEVICE_PTR clauses. Always use short kind and 8-bit align shift. (lower_omp_regimplify_p): Use IS_TYPE_OR_DECL_P macro. (struct lower_omp_regimplify_operands_data): New type. (lower_omp_regimplify_operands_p, lower_omp_regimplify_operands): New functions. (lower_omp_1): Use lower_omp_regimplify_operands instead of gimple_regimplify_operands. (make_gimple_omp_edges): Handle GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA. Treat GIMPLE_OMP_ORDERED with depend clause as stand-alone directive. (simd_clone_clauses_extract): Honor OMP_CLAUSE_LINEAR_KIND. (simd_clone_mangle): Mangle the various linear kinds per the new ABI. (simd_clone_adjust_argument_types): Handle SIMD_CLONE_ARG_TYPE_LINEAR_*_CONSTANT_STEP. (simd_clone_init_simd_arrays): Don't do anything for uval. (simd_clone_adjust): Handle SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP. Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP. * omp-low.h (omp_member_access_dummy_var): New prototype. * passes.def (pass_simduid_cleanup): Schedule another copy of the pass after all optimizations. * tree.c (omp_clause_code_name): Add entries for OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (omp_clause_num_ops): Likewise. Bump number of OMP_CLAUSE_REDUCTION arguments to 5 and for OMP_CLAUSE_ORDERED to 1. (walk_tree_1): Adjust for OMP_CLAUSE_ORDERED having 1 argument and OMP_CLAUSE_REDUCTION 5 arguments. Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD} clauses. * tree-core.h (enum omp_clause_linear_kind): New. (struct tree_omp_clause): Change type of map_kind from unsigned char to unsigned int. Add subcode.if_modifier and subcode.linear_kind fields. (enum omp_clause_code): Add OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT} and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}. (OMP_CLAUSE_REDUCTION): Document OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_{SOURCE,SINK}. * tree.def (OMP_FOR): Add OMP_FOR_ORIG_DECLS operand. (OMP_CRITICAL): Move before OMP_SINGLE. Add OMP_CRITICAL_CLAUSES operand. (OMP_ORDERED): Move before OMP_SINGLE. Add OMP_ORDERED_CLAUSES operand. (OMP_TASKLOOP, OMP_TARGET_ENTER_DATA, OMP_TARGET_EXIT_DATA): New tree codes. * tree.h (OMP_BODY): Replace OMP_CRITICAL with OMP_TASKGROUP. (OMP_CLAUSE_SET_MAP_KIND): Cast to unsigned int rather than unsigned char. (OMP_CRITICAL_NAME): Adjust to be 3rd operand instead of 2nd. (OMP_CLAUSE_NUM_TASKS_EXPR): Formatting fix. (OMP_STANDALONE_CLAUSES): Adjust to cover OMP_TARGET_{ENTER,EXIT}_DATA. (OMP_CLAUSE_DEPEND_SINK_NEGATIVE, OMP_TARGET_COMBINED, OMP_CLAUSE_MAP_PRIVATE, OMP_FOR_ORIG_DECLS, OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION, OMP_CRITICAL_CLAUSES, OMP_CLAUSE_PRIVATE_TASKLOOP_IV, OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, OMP_CLAUSE_HINT_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER, OMP_CLAUSE_SHARED_FIRSTPRIVATE, OMP_ORDERED_CLAUSES, OMP_TARGET_ENTER_DATA_CLAUSES, OMP_TARGET_EXIT_DATA_CLAUSES, OMP_CLAUSE_NUM_TASKS_EXPR, OMP_CLAUSE_GRAINSIZE_EXPR, OMP_CLAUSE_PRIORITY_EXPR, OMP_CLAUSE_ORDERED_EXPR): Define. * tree-inline.c (remap_gimple_stmt): Handle clauses on GIMPLE_OMP_ORDERED and GIMPLE_OMP_CRITICAL. For IFN_GOMP_SIMD_ORDERED_{START,END} set has_simduid_loops. * tree-nested.c (convert_nonlocal_omp_clauses): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER. (convert_local_omp_clauses): Likewise. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD} and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP} clauses. Handle OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_ORDERED_EXPR, OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_DEPEND_{SOURCE,SINK}. Use "delete" for GOMP_MAP_FORCE_DEALLOC. Handle GOMP_MAP_{ALWAYS_{TO,FROM,TOFROM},RELEASE,FIRSTPRIVATE_POINTER,STRUCT}. (dump_generic_node): Handle OMP_TASKLOOP, OMP_TARGET_{ENTER,EXIT}_DATA and clauses on OMP_ORDERED and OMP_CRITICAL. * tree-vectorizer.c (adjust_simduid_builtins): Adjust comment. Remove IFN_GOMP_SIMD_ORDERED_{START,END}. (vectorize_loops): Adjust comments. (pass_simduid_cleanup::execute): Likewise. * tree-vect-stmts.c (vectorizable_simd_clone_call): Handle SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_CONSTANT_STEP. * wide-int.h (wi::gcd): New. gcc/c-family/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-common.c (enum c_builtin_type): Define DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10 and DEF_FUNCTION_TYPE_11. (c_define_builtins): Likewise. * c-common.h (enum c_omp_clause_split): Add C_OMP_CLAUSE_SPLIT_TASKLOOP. (c_finish_omp_critical, c_finish_omp_ordered): Add CLAUSES argument. (c_finish_omp_for): Add ORIG_DECLV argument. * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP as 201511 instead of 201307. * c-omp.c (c_finish_omp_critical): Add CLAUSES argument, set OMP_CRITICAL_CLAUSES to it. (c_finish_omp_ordered): Add CLAUSES argument, set OMP_ORDERED_CLAUSES to it. (c_finish_omp_for): Add ORIG_DECLV argument, set OMP_FOR_ORIG_DECLS to it if OMP_FOR. Clear DECL_INITIAL on the IVs. (c_omp_split_clauses): Handle OpenMP 4.5 combined/composite constructs and new OpenMP 4.5 clauses. Clear OMP_CLAUSE_SCHEDULE_SIMD if not combined with OMP_SIMD. Add verification code. * c-pragma.c (omp_pragmas_simd): Add taskloop. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKLOOP. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_{DEFAULTMAP,GRAINSIZE,HINT,{IS,USE}_DEVICE_PTR} and PRAGMA_OMP_CLAUSE_{LINK,NOGROUP,NUM_TASKS,PRIORITY,SIMD,THREADS}. gcc/c/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-parser.c (c_parser_pragma): Handle PRAGMA_OMP_ORDERED here. (c_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (c_parser_omp_variable_list): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Formatting fixes. (c_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize, c_parser_omp_clause_priority, c_parser_omp_clause_hint, c_parser_omp_clause_defaultmap, c_parser_omp_clause_use_device_ptr, c_parser_omp_clause_is_device_ptr): New functions. (c_parser_omp_clause_ordered): Parse optional parameter. (c_parser_omp_clause_reduction): Handle array reductions. (c_parser_omp_clause_schedule): Parse optional simd modifier. (c_parser_omp_clause_nogroup, c_parser_omp_clause_orderedkind): New functions. (c_parser_omp_clause_linear): Parse linear clause modifiers. (c_parser_omp_clause_depend_sink): New function. (c_parser_omp_clause_depend): Parse source/sink depend kinds. (c_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (c_parser_oacc_all_clauses): Adjust c_parser_omp_clause_if and c_finish_omp_clauses callers. (c_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (c_parser_oacc_cache): Adjust c_finish_omp_clauses caller. (OMP_CRITICAL_CLAUSE_MASK): Define. (c_parser_omp_critical): Parse critical clauses. (c_parser_omp_for_loop): Handle doacross loops, adjust c_finish_omp_for and c_finish_omp_clauses callers. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (c_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (c_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (c_parser_omp_ordered): Add CONTEXT argument, remove LOC argument, parse clauses and if depend clause is found, don't parse a body. (c_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (c_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (c_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (c_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (c_parser_omp_declare_reduction): Use STRIP_NOPS when checking for &omp_priv. (OMP_TASKLOOP_CLAUSE_MASK): Define. (c_parser_omp_taskloop): New function. (c_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (c_parser_cilk_for): Adjust c_finish_omp_clauses callers. * c-tree.h (c_finish_omp_clauses): Add two new arguments. * c-typeck.c (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (c_finish_omp_clauses): Add IS_OMP and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones. gcc/cp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * class.c (finish_struct_1): Call finish_omp_declare_simd_methods. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_TASKLOOP. (cp_genericize_r): Likewise. (cxx_omp_finish_clause): Don't diagnose references. (cxx_omp_disregard_value_expr): New function. * cp-objcp-common.h (LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR): Redefine. * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Document for OMP_TASKLOOP. (DECL_OMP_PRIVATIZED_MEMBER): Define. (finish_omp_declare_simd_methods, push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses, omp_privatize_field, cxx_omp_disregard_value_expr): New prototypes. (finish_omp_clauses): Add two new arguments. (finish_omp_for): Add ORIG_DECLV argument. * parser.c (cp_parser_lambda_body): Call save_omp_privatization_clauses and restore_omp_privatization_clauses. (cp_parser_omp_clause_name): Handle OpenMP 4.5 clauses. (cp_parser_omp_var_list_no_open): Handle structure elements for map, to and from clauses. Handle array sections in reduction clause. Parse this keyword. Formatting fixes. (cp_parser_omp_clause_if): Add IS_OMP argument, handle parsing of if clause modifiers. (cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority, cp_parser_omp_clause_hint, cp_parser_omp_clause_defaultmap): New functions. (cp_parser_omp_clause_ordered): Parse optional parameter. (cp_parser_omp_clause_reduction): Handle array reductions. (cp_parser_omp_clause_schedule): Parse optional simd modifier. (cp_parser_omp_clause_nogroup, cp_parser_omp_clause_orderedkind): New functions. (cp_parser_omp_clause_linear): Parse linear clause modifiers. (cp_parser_omp_clause_depend_sink): New function. (cp_parser_omp_clause_depend): Parse source/sink depend kinds. (cp_parser_omp_clause_map): Parse release/delete map kinds and optional always modifier. (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_if and finish_omp_clauses callers. (cp_parser_omp_all_clauses): Likewise. Parse OpenMP 4.5 clauses. Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive. (OMP_CRITICAL_CLAUSE_MASK): Define. (cp_parser_omp_critical): Parse critical clauses. (cp_parser_omp_for_incr): Use cp_tree_equal if processing_template_decl. (cp_parser_omp_for_loop_init): Return tree instead of bool. Handle non-static data member iterators. (cp_parser_omp_for_loop): Handle doacross loops, adjust finish_omp_for and finish_omp_clauses callers. (cp_omp_split_clauses): Adjust finish_omp_clauses caller. (OMP_SIMD_CLAUSE_MASK): Add simdlen clause. (cp_parser_omp_simd): Allow ordered clause if it has no parameter. (OMP_FOR_CLAUSE_MASK): Add linear clause. (cp_parser_omp_for): Disallow ordered clause when combined with distribute. Disallow linear clause when combined with distribute and not combined with simd. (OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define. (cp_parser_omp_ordered): Add CONTEXT argument, return bool instead of tree, parse clauses and if depend clause is found, don't parse a body. (cp_parser_omp_parallel): Disallow copyin clause on target parallel. Allow target parallel without for after it. (OMP_TASK_CLAUSE_MASK): Add priority clause. (OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause. (cp_parser_omp_target_data): Diagnose no map clauses or clauses with invalid kinds. (OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses. (OMP_TARGET_ENTER_DATA_CLAUSE_MASK, OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define. (cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): New functions. (OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate, defaultmap and is_device_ptr clauses. (cp_parser_omp_target): Parse target parallel and target simd. Set OMP_TARGET_COMBINED on combined constructs. Parse target enter data and target exit data. Diagnose invalid map kinds. (cp_parser_oacc_cache): Adjust finish_omp_clauses caller. (OMP_DECLARE_TARGET_CLAUSE_MASK): Define. (cp_parser_omp_declare_target): Parse OpenMP 4.5 forms of this construct. (OMP_TASKLOOP_CLAUSE_MASK): Define. (cp_parser_omp_taskloop): New function. (cp_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here, handle PRAGMA_OMP_TASKLOOP. (cp_parser_pragma): Handle PRAGMA_OMP_ORDERED here directly, handle PRAGMA_OMP_TASKLOOP, call push_omp_privatization_clauses and pop_omp_privatization_clauses around parsing calls. (cp_parser_cilk_for): Adjust finish_omp_clauses caller. * pt.c (apply_late_template_attributes): Adjust tsubst_omp_clauses and finish_omp_clauses callers. (tsubst_omp_clause_decl): Return NULL if decl is NULL. For TREE_LIST, copy over OMP_CLAUSE_DEPEND_SINK_NEGATIVE bit. Use tsubst_expr instead of tsubst_copy, undo convert_from_reference effects. (tsubst_omp_clauses): Add ALLOW_FIELDS argument. Handle new OpenMP 4.5 clauses. Use tsubst_omp_clause_decl for more clauses. If ALLOW_FIELDS, handle non-static data members in the clauses. Clear OMP_CLAUSE_LINEAR_STEP if it has been cleared before. (omp_parallel_combined_clauses): New variable. (tsubst_omp_for_iterator): Add ORIG_DECLV argument, recur on OMP_FOR_ORIG_DECLS, handle non-static data member iterators. Improve handling of clauses on combined constructs. (tsubst_expr): Call push_omp_privatization_clauses and pop_omp_privatization_clauses around instantiation of certain OpenMP constructs, improve handling of clauses on combined constructs, handle OMP_TASKLOOP, adjust tsubst_omp_for_iterator, tsubst_omp_clauses and finish_omp_for callers, handle clauses on critical and ordered, handle OMP_TARGET_{ENTER,EXIT}_DATA. (instantiate_decl): Call save_omp_privatization_clauses and restore_omp_privatization_clauses around instantiation. (dependent_omp_for_p): Fix up comment typo. Handle SCOPE_REF. * semantics.c (omp_private_member_map, omp_private_member_vec, omp_private_member_ignore_next): New variables. (finish_non_static_data_member): Return dummy decl for privatized non-static data members. (omp_clause_decl_field, omp_clause_printable_decl, omp_note_field_privatization, omp_privatize_field): New functions. (handle_omp_array_sections_1): Fix comment typo. Add IS_OMP argument, handle structure element bases, diagnose bitfields, pass IS_OMP recursively, diagnose known zero length array sections in depend clauses, handle array sections in reduction clause, diagnose negative length even for pointers. (handle_omp_array_sections): Add IS_OMP argument, use auto_vec for types, pass IS_OMP down to handle_omp_array_sections_1, handle array sections in reduction clause, set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP. (finish_omp_reduction_clause): Handle array sections and arrays. Use omp_clause_printable_decl. (finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink): New functions. (finish_omp_clauses): Add ALLOW_FIELDS and DECLARE_SIMD arguments. Handle new OpenMP 4.5 clauses and new restrictions for the old ones, handle non-static data members, reject this keyword when not allowed. (push_omp_privatization_clauses, pop_omp_privatization_clauses, save_omp_privatization_clauses, restore_omp_privatization_clauses): New functions. (handle_omp_for_class_iterator): Handle OMP_TASKLOOP class iterators. Add collapse and ordered arguments. Fix handling of lastprivate iterators in doacross loops. (finish_omp_for): Add ORIG_DECLV argument, handle doacross loops, adjust c_finish_omp_for, handle_omp_for_class_iterator and finish_omp_clauses callers. Fill in OMP_CLAUSE_LINEAR_STEP on simd loops with non-static data member iterators. gcc/fortran/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * f95-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11, DEF_FUNCTION_TYPE_VAR_1): Define. * trans-openmp.c (gfc_trans_omp_clauses): Set OMP_CLAUSE_IF_MODIFIER to ERROR_MARK, OMP_CLAUSE_ORDERED_EXPR to NULL. (gfc_trans_omp_critical): Adjust for addition of clauses. (gfc_trans_omp_ordered): Likewise. * types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR, BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR, BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL, BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New. (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR, BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove. gcc/lto/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * lto-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/jit/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/ada/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> * gcc-interface/utils.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. gcc/testsuite/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * c-c++-common/gomp/cancel-1.c (f2): Add map clause to target data. * c-c++-common/gomp/clauses-1.c: New test. * c-c++-common/gomp/clauses-2.c: New test. * c-c++-common/gomp/clauses-3.c: New test. * c-c++-common/gomp/clauses-4.c: New test. * c-c++-common/gomp/declare-target-1.c: New test. * c-c++-common/gomp/declare-target-2.c: New test. * c-c++-common/gomp/depend-3.c: New test. * c-c++-common/gomp/depend-4.c: New test. * c-c++-common/gomp/doacross-1.c: New test. * c-c++-common/gomp/if-1.c: New test. * c-c++-common/gomp/if-2.c: New test. * c-c++-common/gomp/linear-1.c: New test. * c-c++-common/gomp/map-2.c: New test. * c-c++-common/gomp/map-3.c: New test. * c-c++-common/gomp/nesting-1.c (f_omp_parallel, f_omp_target_data): Add map clause to target data. * c-c++-common/gomp/nesting-warn-1.c (f_omp_target): Likewise. * c-c++-common/gomp/ordered-1.c: New test. * c-c++-common/gomp/ordered-2.c: New test. * c-c++-common/gomp/ordered-3.c: New test. * c-c++-common/gomp/pr61486-1.c (foo): Remove linear clause on non-iterator. * c-c++-common/gomp/pr61486-2.c (test, test2): Remove ordered clause and ordered construct where no longer allowed. * c-c++-common/gomp/priority-1.c: New test. * c-c++-common/gomp/reduction-1.c: New test. * c-c++-common/gomp/schedule-simd-1.c: New test. * c-c++-common/gomp/sink-1.c: New test. * c-c++-common/gomp/sink-2.c: New test. * c-c++-common/gomp/sink-3.c: New test. * c-c++-common/gomp/sink-4.c: New test. * c-c++-common/gomp/udr-1.c: New test. * c-c++-common/taskloop-1.c: New test. * c-c++-common/cpp/openmp-define-3.c: Adjust for the new value of _OPENMP macro. * c-c++-common/cilk-plus/PS/body.c (foo): Adjust expected diagnostics. * c-c++-common/goacc-gomp/nesting-fail-1.c (f_acc_parallel, f_acc_kernels, f_acc_data, f_acc_loop): Add map clause to target data. * gcc.dg/gomp/clause-1.c: * gcc.dg/gomp/reduction-1.c: New test. * gcc.dg/gomp/sink-fold-1.c: New test. * gcc.dg/gomp/sink-fold-2.c: New test. * gcc.dg/gomp/sink-fold-3.c: New test. * gcc.dg/vect/vect-simd-clone-15.c: New test. * g++.dg/gomp/clause-1.C (T::test): Remove dg-error on privatization of non-static data members. * g++.dg/gomp/clause-3.C (foo): Remove one dg-error directive. Add some linear clause tests. * g++.dg/gomp/declare-simd-3.C: New test. * g++.dg/gomp/linear-1.C: New test. * g++.dg/gomp/member-1.C: New test. * g++.dg/gomp/member-2.C: New test. * g++.dg/gomp/pr66571-2.C: New test. * g++.dg/gomp/pr67504.C (foo): Add test for ordered clause with dependent argument. * g++.dg/gomp/pr67522.C (foo): Add test for invalid array section in reduction clause. * g++.dg/gomp/reference-1.C: New test. * g++.dg/gomp/sink-1.C: New test. * g++.dg/gomp/sink-2.C: New test. * g++.dg/gomp/sink-3.C: New test. * g++.dg/gomp/task-1.C: Remove both dg-error directives. * g++.dg/gomp/this-1.C: New test. * g++.dg/gomp/this-2.C: New test. * g++.dg/vect/simd-clone-2.cc: New test. * g++.dg/vect/simd-clone-2.h: New test. * g++.dg/vect/simd-clone-3.cc: New test. * g++.dg/vect/simd-clone-4.cc: New test. * g++.dg/vect/simd-clone-4.h: New test. * g++.dg/vect/simd-clone-5.cc: New test. include/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define. (enum gomp_map_kind): Add GOMP_MAP_FIRSTPRIVATE, GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_DELETE, GOMP_MAP_RELEASE, GOMP_MAP_FIRSTPRIVATE_POINTER. (GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Define. (GOMP_TASK_FLAG_UNTIED, GOMP_TASK_FLAG_FINAL, GOMP_TASK_FLAG_MERGEABLE, GOMP_TASK_FLAG_DEPEND, GOMP_TASK_FLAG_PRIORITY, GOMP_TASK_FLAG_UP, GOMP_TASK_FLAG_GRAINSIZE, GOMP_TASK_FLAG_IF, GOMP_TASK_FLAG_NOGROUP, GOMP_TARGET_FLAG_NOWAIT, GOMP_TARGET_FLAG_EXIT_DATA, GOMP_TARGET_FLAG_UPDATE): Define. libgomp/ 2015-10-13 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> Ilya Verbin <ilya.verbin@intel.com> * config/linux/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/linux/doacross.h: New file. * config/posix/affinity.c (omp_get_place_num_procs, omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions. * config/posix/doacross.h: New file. * env.c: Include gomp-constants.h. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (gomp_max_task_priority_var): New variable. (parse_schedule): Rename run_sched_modifier to run_sched_chunk_size. (handle_omp_display_env): Change _OPENMP value from 201307 to 201511. Print OMP_MAX_TASK_PRIORITY. (initialize_env): Parse OMP_MAX_TASK_PRIORITY. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size and run_sched_modifier to run_sched_chunk_size. (omp_get_max_task_priority, omp_get_initial_device, omp_get_num_places, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums): New functions. * fortran.c (omp_set_schedule_, omp_set_schedule_8_, omp_get_schedule_, omp_get_schedule_8_): Rename modifier argument to chunk_size. (omp_get_num_places_, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num_, omp_get_partition_num_places_, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device_, omp_get_max_task_priority_): New functions. * libgomp_g.h (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_doacross_ull_post, GOMP_doacross_wait, GOMP_taskloop, GOMP_taskloop_ull, GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data): New prototypes. (GOMP_task): Add prototype argument. * libgomp.h (_LIBGOMP_CHECKING_): Define to 0 if not yet defined. (struct gomp_doacross_work_share): New type. (struct gomp_work_share): Add doacross field. (struct gomp_task_icv): Rename run_sched_modifier to run_sched_chunk_size. (enum gomp_task_kind): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. Add comments. (struct gomp_task_depend_entry): Add comments. (struct gomp_task): Likewise. (struct gomp_taskgroup): Likewise. (struct gomp_target_task): New type. (struct gomp_team): Add comment. (gomp_get_place_proc_ids_8, gomp_doacross_init, gomp_doacross_ull_init, gomp_task_maybe_wait_for_dependencies, gomp_create_target_task, gomp_target_task_fn): New prototypes. (struct target_var_desc): New type. (struct target_mem_desc): Adjust comment. Use struct target_var_desc instead of splay_tree_key for list. (REFCOUNT_INFINITY): Define. (struct splay_tree_key_s): Remove copy_from field. (struct gomp_device_descr): Add dev2dev_func field. (enum gomp_map_vars_kind): New enum. (gomp_map_vars): Add one argument. * libgomp.map (OMP_4.5): Export omp_get_max_task_priority, omp_get_max_task_priority_, omp_get_num_places, omp_get_num_places_, omp_get_place_num_procs, omp_get_place_num_procs_, omp_get_place_num_procs_8_, omp_get_place_proc_ids, omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num, omp_get_place_num_, omp_get_partition_num_places, omp_get_partition_num_places_, omp_get_partition_place_nums, omp_get_partition_place_nums_, omp_get_partition_place_nums_8_, omp_get_initial_device, omp_get_initial_device_, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr and omp_target_disassociate_ptr. (GOMP_4.0.2): Renamed to ... (GOMP_4.5): ... this. Export GOMP_target_41, GOMP_target_data_41, GOMP_target_update_41, GOMP_target_enter_exit_data, GOMP_taskloop, GOMP_taskloop_ull, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_loop_doacross_static_start, GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start, GOMP_loop_ull_doacross_static_start, GOMP_doacross_ull_post and GOMP_doacross_ull_wait. * libgomp.texi: Document omp_get_max_task_priority. Rename modifier argument to chunk_size for omp_set_schedule and omp_get_schedule. Document OMP_MAX_TASK_PRIORITY env var. * loop.c (GOMP_loop_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ordered_runtime_start): Likewise. (gomp_loop_doacross_static_start, gomp_loop_doacross_dynamic_start, gomp_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start, GOMP_parallel_loop_runtime_start): New functions. (GOMP_parallel_loop_runtime): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start): New functions or aliases. * loop_ull.c (GOMP_loop_ull_runtime_start): Adjust for run_sched_modifier to run_sched_chunk_size renaming. (GOMP_loop_ull_ordered_runtime_start): Likewise. (gomp_loop_ull_doacross_static_start, gomp_loop_ull_doacross_dynamic_start, gomp_loop_ull_doacross_guided_start, GOMP_loop_ull_doacross_runtime_start): New functions. (GOMP_loop_ull_doacross_static_start, GOMP_loop_ull_doacross_dynamic_start, GOMP_loop_ull_doacross_guided_start): New functions or aliases. * oacc-mem.c (acc_map_data, present_create_copy, gomp_acc_insert_pointer): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (gomp_acc_remove_pointer): Use copy_from from target_var_desc. * oacc-parallel.c (GOACC_data_start): Pass GOMP_MAP_VARS_OPENACC instead of false to gomp_map_vars. (GOACC_parallel_keyed): Likewise. Use copy_from from target_var_desc. * omp.h.in (omp_lock_hint_t): New type. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr): New prototypes. * omp_lib.f90.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New interfaces. (omp_set_schedule, omp_get_schedule): Rename modifier argument to chunk_size. * omp_lib.h.in (omp_lock_hint_kind): New parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint, omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids, omp_get_place_num, omp_get_partition_num_places, omp_get_partition_place_nums, omp_get_initial_device, omp_get_max_task_priority): New functions and subroutines. * ordered.c: Include stdarg.h and string.h. (MAX_COLLAPSED_BITS): Define. (gomp_doacross_init, GOMP_doacross_post, GOMP_doacross_wait, gomp_doacross_ull_init, GOMP_doacross_ull_post, GOMP_doacross_ull_wait): New functions. * target.c: Include errno.h. (resolve_device): If device is not initialized, call gomp_init_device on it. (gomp_map_lookup): New function. (gomp_map_vars_existing): Add tgt_var argument, fill it in. Don't bump refcount if REFCOUNT_INFINITY. Handle GOMP_MAP_ALWAYS_TO_P. (get_kind): Rename is_openacc argument to short_mapkind. (gomp_map_pointer): Use gomp_map_lookup. (gomp_map_fields_existing): New function. (gomp_map_vars): Rename is_openacc argument to short_mapkind and is_target to pragma_kind. Handle GOMP_MAP_VARS_ENTER_DATA, handle GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_STRUCT, GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION. Adjust for tgt->list changed type and copy_from living in there. (gomp_copy_from_async): Adjust for tgt->list changed type and copy_from living in there. (gomp_unmap_vars): Likewise. (gomp_update): Likewise. Rename is_openacc argument to short_mapkind. Don't fail if object is not mapped. (gomp_load_image_to_device): Initialize refcount to REFCOUNT_INFINITY. (gomp_target_fallback): New function. (gomp_get_target_fn_addr): Likewise. (GOMP_target): Adjust gomp_map_vars caller, use gomp_get_target_fn_addr and gomp_target_fallback. (GOMP_target_41): New function. (gomp_target_data_fallback): New function. (GOMP_target_data): Use it, adjust gomp_map_vars caller. (GOMP_target_data_41): New function. (GOMP_target_update): Adjust gomp_update caller. (GOMP_target_update_41): New function. (gomp_exit_data, GOMP_target_enter_exit_data, gomp_target_task_fn, omp_target_alloc, omp_target_free, omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect_worker, omp_target_memcpy_rect, omp_target_associate_ptr, omp_target_disassociate_ptr, gomp_load_plugin_for_device): New functions. * task.c: Include gomp-constants.h. Include taskloop.c twice to get GOMP_taskloop and GOMP_taskloop_ull definitions. (gomp_task_handle_depend): New function. (GOMP_task): Use it. Add priority argument. Use gomp-constant.h constants instead of hardcoded numbers. Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (gomp_create_target_task): New function. (verify_children_queue, verify_taskgroup_queue, verify_task_queue): New functions. (gomp_task_run_pre): Call verify_*_queue functions. If an upcoming tied task is about to leave the sibling or taskgroup queues in an invalid state, adjust appropriately. Remove taskgroup argument. Add comments. (gomp_task_run_post_handle_dependers): Add comments. (gomp_task_run_post_remove_parent): Likewise. (gomp_barrier_handle_tasks): Adjust gomp_task_run_pre caller. (GOMP_taskwait): Likewise. Add comments. (gomp_task_maybe_wait_for_dependencies): Fix scheduling problem such that the first non parent_depends_on task does not end up at the end of the children queue. (GOMP_taskgroup_start): Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED. (GOMP_taskgroup_end): Adjust gomp_task_run_pre caller. * taskloop.c: New file. * testsuite/lib/libgomp.exp (check_effective_target_offload_device_nonshared_as): New proc. * testsuite/libgomp.c/affinity-2.c: New test. * testsuite/libgomp.c/doacross-1.c: New test. * testsuite/libgomp.c/doacross-2.c: New test. * testsuite/libgomp.c/examples-4/declare_target-1.c (fib_wrapper): Add map clause to target. * testsuite/libgomp.c/examples-4/declare_target-4.c (accum): Likewise. * testsuite/libgomp.c/examples-4/declare_target-5.c (accum): Likewise. * testsuite/libgomp.c/examples-4/device-1.c (main): Likewise. * testsuite/libgomp.c/examples-4/device-3.c (main): Likewise. * testsuite/libgomp.c/examples-4/target_data-3.c (gramSchmidt): Likewise. * testsuite/libgomp.c/examples-4/teams-2.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-3.c (dotprod): Likewise. * testsuite/libgomp.c/examples-4/teams-4.c (dotprod): Likewise. * testsuite/libgomp.c/for-2.h (OMPTGT, OMPTO, OMPFROM): Define if not defined. Use those where needed. * testsuite/libgomp.c/for-4.c: New test. * testsuite/libgomp.c/for-5.c: New test. * testsuite/libgomp.c/for-6.c: New test. * testsuite/libgomp.c/linear-1.c: New test. * testsuite/libgomp.c/ordered-4.c: New test. * testsuite/libgomp.c/pr66199-2.c (f2): Adjust for linear clause only allowed on the loop iterator. * testsuite/libgomp.c/pr66199-3.c: New test. * testsuite/libgomp.c/pr66199-4.c: New test. * testsuite/libgomp.c/reduction-7.c: New test. * testsuite/libgomp.c/reduction-8.c: New test. * testsuite/libgomp.c/reduction-9.c: New test. * testsuite/libgomp.c/reduction-10.c: New test. * testsuite/libgomp.c/target-1.c (fn2, fn3, fn4): Add map(tofrom:s). * testsuite/libgomp.c/target-2.c (fn2, fn3, fn4): Likewise. * testsuite/libgomp.c/target-7.c (foo): Add map(h) where needed. * testsuite/libgomp.c/target-11.c: New test. * testsuite/libgomp.c/target-12.c: New test. * testsuite/libgomp.c/target-13.c: New test. * testsuite/libgomp.c/target-14.c: New test. * testsuite/libgomp.c/target-15.c: New test. * testsuite/libgomp.c/target-16.c: New test. * testsuite/libgomp.c/target-17.c: New test. * testsuite/libgomp.c/target-18.c: New test. * testsuite/libgomp.c/target-19.c: New test. * testsuite/libgomp.c/target-20.c: New test. * testsuite/libgomp.c/target-21.c: New test. * testsuite/libgomp.c/target-22.c: New test. * testsuite/libgomp.c/target-23.c: New test. * testsuite/libgomp.c/target-24.c: New test. * testsuite/libgomp.c/target-25.c: New test. * testsuite/libgomp.c/target-26.c: New test. * testsuite/libgomp.c/target-27.c: New test. * testsuite/libgomp.c/taskloop-1.c: New test. * testsuite/libgomp.c/taskloop-2.c: New test. * testsuite/libgomp.c/taskloop-3.c: New test. * testsuite/libgomp.c/taskloop-4.c: New test. * testsuite/libgomp.c++/ctor-13.C: New test. * testsuite/libgomp.c++/doacross-1.C: New test. * testsuite/libgomp.c++/examples-4/declare_target-2.C: Replace offload_device with offload_device_nonshared_as. * testsuite/libgomp.c++/for-12.C: New test. * testsuite/libgomp.c++/for-13.C: New test. * testsuite/libgomp.c++/for-14.C: New test. * testsuite/libgomp.c++/linear-1.C: New test. * testsuite/libgomp.c++/member-1.C: New test. * testsuite/libgomp.c++/member-2.C: New test. * testsuite/libgomp.c++/member-3.C: New test. * testsuite/libgomp.c++/member-4.C: New test. * testsuite/libgomp.c++/member-5.C: New test. * testsuite/libgomp.c++/ordered-1.C: New test. * testsuite/libgomp.c++/reduction-5.C: New test. * testsuite/libgomp.c++/reduction-6.C: New test. * testsuite/libgomp.c++/reduction-7.C: New test. * testsuite/libgomp.c++/reduction-8.C: New test. * testsuite/libgomp.c++/reduction-9.C: New test. * testsuite/libgomp.c++/reduction-10.C: New test. * testsuite/libgomp.c++/reference-1.C: New test. * testsuite/libgomp.c++/simd14.C: New test. * testsuite/libgomp.c++/target-2.C (fn2): Add map(tofrom: s) clause. * testsuite/libgomp.c++/target-5.C: New test. * testsuite/libgomp.c++/target-6.C: New test. * testsuite/libgomp.c++/target-7.C: New test. * testsuite/libgomp.c++/target-8.C: New test. * testsuite/libgomp.c++/target-9.C: New test. * testsuite/libgomp.c++/target-10.C: New test. * testsuite/libgomp.c++/target-11.C: New test. * testsuite/libgomp.c++/target-12.C: New test. * testsuite/libgomp.c++/taskloop-1.C: New test. * testsuite/libgomp.c++/taskloop-2.C: New test. * testsuite/libgomp.c++/taskloop-3.C: New test. * testsuite/libgomp.c++/taskloop-4.C: New test. * testsuite/libgomp.c++/taskloop-5.C: New test. * testsuite/libgomp.c++/taskloop-6.C: New test. * testsuite/libgomp.c++/taskloop-7.C: New test. * testsuite/libgomp.c++/taskloop-8.C: New test. * testsuite/libgomp.c++/taskloop-9.C: New test. * testsuite/libgomp.fortran/affinity1.f90: New test. * testsuite/libgomp.fortran/affinity2.f90: New test. liboffloadmic/ 2015-10-13 Ilya Verbin <ilya.verbin@intel.com> * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New function. * plugin/offload_target_main.cpp (__offload_target_tgt2tgt): New static function, register it in liboffloadmic. From-SVN: r228777
2015-10-13 21:06:23 +02:00
extern bool cxx_omp_disregard_value_expr (tree, bool);
extern void cp_fold_function (tree);
Merge C++ delayed folding branch. * call.c (build_conditional_expr_1, convert_like_real) (convert_arg_to_ellipsis, convert_for_arg_passing): Don't fold. (build_new_op_1, build_over_call, build_cxx_call): Fold for warnings. * class.c (build_base_path, determine_primary_bases) (update_vtable_entry_for_fn, check_bitfield_decl) (layout_nonempty_base_or_field, layout_empty_base) (propagate_binfo_offsets, include_empty_classes) (layout_class_type, build_vbase_offset_vtbl_entries): Use fold_convert. * constexpr.c (cxx_eval_builtin_function_call): Fold away the NOP_EXPR. (cxx_eval_call_expression): Handle MEM_REF. (cxx_eval_pointer_plus_expression): Fold the second operand. (cxx_eval_constant_expression): Handle MEM_REF, UNARY_PLUS_EXPR. (fold_simple_1, fold_simple): New. (maybe_constant_value_1): Factor out from maybe_constant_value. (cv_cache, maybe_constant_value): Cache results. (maybe_constant_init): Handle null input. (potential_constant_expression_1): Handle RESULT_DECL, EMPTY_CLASS_EXPR. * cp-array-notation.c (build_array_notation_ref): Fold operands. * cp-gimplify.c (cp_fold_r, cp_fold): New. (cp_genericize_r): Use fold_convert. Don't fold SIZEOF_EXPR. (cp_genericize): Fold everything. (contains_label_1, contains_label_p): New. (cp_fold, cp_fully_fold): New. * cp-tree.h (class cache_map): New. * cvt.c (cp_convert_to_pointer, ocp_convert): Use convert_to_*_nofold. (cp_convert_and_check): Use cp_fully_fold. (convert, convert_force): Don't fold. * decl.c (fold_sizeof_expr): Change from fold_sizeof_expr_r. (compute_array_index_type): Use cp_fully_fold. (build_enumerator): Use fold_convert. * decl2.c (get_guard_cond, set_guard): Use fold_convert. * init.c (build_zero_init_1): Fold zero-initializers. (build_new_1): Fold nelts calculations. (build_vec_delete_1): Fold conversions. (build_vec_init): Fold maxindex. * parser.c (cp_parser_binary_expression): Fold LHS of || and &&. (cp_parser_question_colon_clause): Fold LHS. * pt.c (convert_nontype_argument): Fold nullptr conversion. * semantics.c (finish_unary_op_expr): Fold for warnings. (handle_omp_array_sections_1): Fold length and low bound. (handle_omp_for_class_iterator): Fold various things. * tree.c (builtin_valid_in_constant_expr_p): Add BUILT_IN_ATOMIC_ALWAYS_LOCK_FREE. (convert_bitfield_to_declared_type): Don't fold. (handle_init_priority_attribute): Fold. (fold_if_not_in_template): Remove. * typeck.c (decay_conversion, build_class_member_access_expr) (build_simple_component_ref, cp_build_array_ref, build_vec_cmp) (cp_pointer_int_sum, pointer_diff): Don't fold. (cp_build_binary_op): Fold for warnings and PMF ops. (cp_build_unary_op): Fold negation of a constant, nothing else. (expand_ptrmemfunc_cst): Fold operations. * typeck2.c (split_nonconstant_init): Fold initializer. (store_init_value): Likewise. (check_narrowing): Try folding. * config-lang.in (gtfiles): Add cp-gimplify.c. From-SVN: r230365
2015-11-14 01:08:05 +01:00
extern tree cp_fully_fold (tree);
extern void clear_fold_cache (void);
/* in name-lookup.c */
extern void suggest_alternatives_for (location_t, tree, bool);
extern bool suggest_alternative_in_explicit_scope (location_t, tree, tree);
re PR c++/6936 (member "using" binds wrong) PR c++/6936 PR c++/25994 PR c++/26256 PR c++/30195 * search.c (lookup_field_1): Look through USING_DECL. (lookup_field_r): Call lookup_fnfields_slot instead of lookup_fnfields_1. * semantics.c (finish_member_declaration): Remove the check that prevents USING_DECLs from being verified by pushdecl_class_level. Call add_method for using declarations that designates functions if the using declaration is in a template class. Set DECL_IGNORED_P on class-scope using declarations. * typeck.c (build_class_member_access_expr): Handle USING_DECLs. * class.c (check_field_decls): Keep using declarations. (add_method): Remove two diagnostics about conflicting using declarations. * parser.c (cp_parser_nonclass_name): Handle USING_DECLs. * decl.c (start_enum): Call xref_tag whenever possible. * cp-tree.h (strip_using_decl): Declare, and reident the previous function. * name-lookup.c (strip_using_decl): New function. (supplement_binding_1): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Also check that the target decl and the target bval does not refer to the same declaration. Allow pushing an enum multiple times in a template class. Adjustment to diagnose using redeclarations. Call diagnose_name_conflict. (push_class_level_binding): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Return true if both decl and bval refer to USING_DECLs and are dependent. (diagnose_name_conflict): New function. From-SVN: r181359
2011-11-14 18:55:57 +01:00
extern tree strip_using_decl (tree);
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
/* Tell the binding oracle what kind of binding we are looking for. */
enum cp_oracle_request
{
CP_ORACLE_IDENTIFIER
};
/* If this is non-NULL, then it is a "binding oracle" which can lazily
create bindings when needed by the C compiler. The oracle is told
the name and type of the binding to create. It can call pushdecl
or the like to ensure the binding is visible; or do nothing,
leaving the binding untouched. c-decl.c takes note of when the
oracle has been called and will not call it again if it fails to
create a given binding. */
typedef void cp_binding_oracle_function (enum cp_oracle_request, tree identifier);
extern cp_binding_oracle_function *cp_binding_oracle;
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
/* in constraint.cc */
extern void init_constraint_processing ();
extern bool constraint_p (tree);
extern tree conjoin_constraints (tree, tree);
extern tree conjoin_constraints (tree);
extern tree get_constraints (tree);
extern void set_constraints (tree, tree);
extern void remove_constraints (tree);
extern tree current_template_constraints (void);
extern tree associate_classtype_constraints (tree);
extern tree build_constraints (tree, tree);
extern tree get_shorthand_constraints (tree);
extern tree build_concept_check (tree, tree, tree = NULL_TREE);
extern tree build_constrained_parameter (tree, tree, tree = NULL_TREE);
extern tree make_constrained_auto (tree, tree);
extern void placeholder_extract_concept_and_args (tree, tree&, tree&);
extern bool equivalent_placeholder_constraints (tree, tree);
extern hashval_t hash_placeholder_constraint (tree);
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
extern bool deduce_constrained_parameter (tree, tree&, tree&);
extern tree resolve_constraint_check (tree);
extern tree check_function_concept (tree);
extern tree finish_template_introduction (tree, tree);
extern bool valid_requirements_p (tree);
extern tree finish_concept_name (tree);
extern tree finish_shorthand_constraint (tree, tree);
extern tree finish_requires_expr (tree, tree);
extern tree finish_simple_requirement (tree);
extern tree finish_type_requirement (tree);
extern tree finish_compound_requirement (tree, tree, bool);
extern tree finish_nested_requirement (tree);
extern void check_constrained_friend (tree, tree);
extern tree tsubst_requires_expr (tree, tree, tsubst_flags_t, tree);
extern tree tsubst_constraint (tree, tree, tsubst_flags_t, tree);
extern tree tsubst_constraint_info (tree, tree, tsubst_flags_t, tree);
extern bool function_concept_check_p (tree);
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
extern tree normalize_expression (tree);
extern tree expand_concept (tree, tree);
extern bool expanding_concept ();
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
extern tree evaluate_constraints (tree, tree);
extern tree evaluate_function_concept (tree, tree);
extern tree evaluate_variable_concept (tree, tree);
extern tree evaluate_constraint_expression (tree, tree);
extern bool constraints_satisfied_p (tree);
extern bool constraints_satisfied_p (tree, tree);
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
extern tree lookup_constraint_satisfaction (tree, tree);
extern tree memoize_constraint_satisfaction (tree, tree, tree);
extern tree lookup_concept_satisfaction (tree, tree);
extern tree memoize_concept_satisfaction (tree, tree, tree);
extern tree get_concept_expansion (tree, tree);
extern tree save_concept_expansion (tree, tree, tree);
extern bool* lookup_subsumption_result (tree, tree);
extern bool save_subsumption_result (tree, tree, bool);
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
extern bool equivalent_constraints (tree, tree);
extern bool equivalently_constrained (tree, tree);
extern bool subsumes_constraints (tree, tree);
extern bool strictly_subsumes (tree, tree);
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
extern int more_constrained (tree, tree);
extern void diagnose_constraints (location_t, tree, tree);
/* in logic.cc */
extern tree decompose_conclusions (tree);
extern bool subsumes (tree, tree);
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
/* In class.c */
extern void cp_finish_injected_record_type (tree);
Commit the vtable verification feature. Commit the vtable verification feature. This feature is designed to detect, at run time, if/when the vtable pointer in a C++ object has been corrupted, before allowing virtual calls through that pointer. If pointer corruption is detected, execution of the program is halted. libstdc++-v3 ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * fragment.am: Add XTEMPLATE_FLAGS. * configure.ac: Add definitions for --enable-vtable-verify. * acinclude.m4: Add --enable-vtable-verify and --disable-vtable-verify; define --enable-vtable-verify; define VTV_CXXFLAGS, VTV_PCH_CXXFLAGS and VTV_CXXLINKFLAGS. * config/abi/pre/gnu.ver: Export symbols for vtable verification. * libsupc++/Makefile.am: Define vtv_sources and add it to libsupc___la_SOURCES and libsupc__convenience_la_SOURCES. * libsupc++/vtv_stubs.cc: New file. * include/Makefile.am: Add VTV_PCH_CXXFLAGS to PCHFLAGS. * src/Makefile.am: Add VTV_CXXFLAGS to AM_CXXFLAGS; add VTV_CXXLINKFLAGS to CXXLINK. * src/c++98/Makefile.am: Comment out XTEMPLATE_FLAGS; add VTV_CXXFLAGS to AM_CXXFLAGS; add VTV_CXXXLINKFLAGS to CXXLINK. * src/C++11/Makefile.am: Ditto. * doc/xml/manual/configure.xml: Add entry for --enable-vtable-verify. * scripts/testsuite_flags.in: Add cxxvtvflags to Usage; cause cxxvtvflags to use VTV_CXXFLAGS and VTV_CXXLINKFLAGS. * testsuite/lib/libstdc++.exp: Add cxxvtvflags; add code to locate libvtv if --enable-vtable-verify was used; set cxxvtvflags; add cxxvtvflags to cxx_final. * testsuite/18_support/bad_exception/23591_thread-1.c: Add -fvtable-verify=none to compiler flags. * testsuite/17_intro/freestanding.cc: Add -fvtable-verify=none to compiler flags. * configure: Regenerated. * Makefile.in: Regenerated. * python/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * libsupc++/Makefile.in: Regenerated. * config.h.in: Regenerated. * po/Makefile.in: Regenerated. * src/Makefile.in: Regenerated. * src/c++98/Makefile.in: Regenerated. * src/c++11/Makefile.in: Regenerated. * doc/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. top level ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * configure.ac: Add target-libvtv to target_libraries; disable libvtv on non-linux systems; add target-libvtv to noconfigdirs; add libsupc++/.libs to C++ library search paths. * configure: Regenerated. * Makefile.def: Add libvtv to target_modules; make libvtv depend on libstdc++ and libgcc. * Makefile.in: Regenerated. include/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * vtv-change-permission.h: New file. contrib/ChangeLog: 2013-08-06 Caroline Tice4 <cmtice@google.com> * gcc_update: Add libvtv files. libgcc/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> config.host (extra_parts): Add vtv_start.o, vtv_end.o vtv_start_preinit.o and vtv_end_preinit.o. configure.ac: Add code to check/set enable_vtable_verify. Makefile.in: Add rules to build vtv_*.o, if enable_vtable_verify is true. vtv_start_preinit.c: New file. vtv_end_preinit.c: New file. vtv_start.c: New file. vtv_end.c: New file. configure: Regenerated. gcc/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * gcc.c (VTABLE_VERIFICATION_SPEC): New definition. (LINK_COMMAND_SPEC): Add VTABLE_VERIFICATION_SPEC. * tree-pass.h: Add pass_vtable_verify. * varasm.c (assemble_variable): Add code to properly set the comdat section and name for the .vtable_map_vars section. (assemble_vtyv_preinit_initializer): New function. (default_sectin_type_flags): Make sure .vtable_map_vars section has LINK_ONCE flag. * output.h: Add function decl for assemble_vtv_preinit_initializer. * vtable-verify.c: New file. * vtable-verify.h: New file. * flag-types.h (enum vtv_priority): Defintions for flag_vtable_verify initialiation levels. * timevar.def (TV_VTABLE_VERIFICATION): New definition. * passes.def: Insert pass_vtable_verify. * aclocal.m4: Reorder includes. * doc/invoke.texi: Add documentation for the flags -fvtable-verify=, -fvtv-debug and -fvtv-counts. * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Add vtv_start*.o, as appropriate, if -fvtable-verify=... is used. (GNU_USER_TARGET_ENDFILE_SPEC): Add vtv_end*.o as appropriate, if -fvtable-verify=... is used. * Makefile.in (OBJS): Add vtable-verify.o to list. (vtable-verify.o): Add new build rule. (GTFILES): Add vtable-verify.c to list. * common.opt (fvtable-verify=): New flag. (vtv_priority): Values for fvtable-verify= flag. (fvtv-counts): New flag. (fvtv-debug): New flag. * tree.h (save_vtable_map_decl): New extern function decl. gcc/cp/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> * Make-lang.in (*CXX_AND_OBJCXX_OBJS): Add vtable-class-hierarchy.o to list. (vtable-class-hierarchy.o): Add build rule. * cp-tree.h (vtv_start_verification_constructor_init_function): New extern function decl. (vtv_finish_verification_constructor_init_function): New extern function decl. (build_vtbl_address): New extern function decl. (get_mangled_vtable_map_var_name): New extern function decl. (vtv_compute_class_hierarchy_transitive_closure): New extern function decl. (vtv_generate_init_routine): New extern function decl. (vtv_save_class_info): New extern function decl. (vtv_recover_class_info): New extern function decl. (vtv_build_vtable_verify_fndecl): New extern function decl. * class.c (finish_struct_1): Add call to vtv_save_class_info if flag_vtable_verify is true. * config-lang.in: Add vtable-class-hierarchy.c to gtfiles list. * vtable-class-hierarchy.c: New file. * mangle.c (get_mangled_vtable_map_var_name): New function. * decl2.c (start_objects): Update function comment. (cp_write_global_declarations): Call vtv_recover_class_info, vtv_compute_class_hierarchy_transitive_closure and vtv_build_vtable_verify_fndecl, before calling finalize_compilation_unit, and call vtv_generate_init_rount after, IFF flag_vtable_verify is true. (vtv_start_verification_constructor_init_function): New function. (vtv_finish_verification_constructor_init_function): New function. * init.c (build_vtbl_address): Remove static qualifier from function. libvtv/ChangeLog: 2013-08-06 Caroline Tice <cmtice@google.com> Initial check-in of new vtable verification feature. * configure.ac : New file. * acinclude.m4 : New file. * Makefile.am : New file. * aclocal.m4 : New file. * configure.tgt : New file. * configure: New file (generated). * Makefile.in: New file (generated). * vtv_set.h : New file. * vtv_utils.cc : New file. * vtv_utils.h : New file. * vtv_malloc.cc : New file. * vtv_rts.cc : New file. * vtv_malloc.h : New file. * vtv_rts.h : New file. * vtv_fail.cc : New file. * vtv_fail.h : New file. * vtv_map.h : New file. * scripts/run-testsuite.sh : New file. * scripts/sum-vtv-counts.c : New file. * testsuite/parts-test-main.h : New file. * testusite/dataentry.cc : New file. * testsuite/temp_deriv.cc : New file. * testsuite/register_pair.cc : New file. * testsuite/virtual_inheritance.cc : New file. * testsuite/field-test.cc : New file. * testsuite/nested_vcall_test.cc : New file. * testsuite/template-list-iostream.cc : New file. * testsuite/register_pair_inserts.cc : New file. * testsuite/register_pair_inserts_mt.cc : New file. * testsuite/event.list : New file. * testsuite/parts-test-extra-parts-views.cc : New file. * testsuite/parts-test-extra-parts-views.h : New file. * testsuite/environment-fail-32.s : New file. * testsuite/parts-test-extra-parts.h : New file. * testsuite/temp_deriv2.cc : New file. * testsuite/dlopen_mt.cc : New file. * testsuite/event.h : New file. * testsuite/template-list.cc : New file. * testsuite/replace-fail.cc : New file. * testsuite/Makefile.am : New file. * testsuite/Makefile.in: New file (generated). * testsuite/mempool_negative.c : New file. * testsuite/parts-test-main.cc : New file. * testsuite/event-private.cc : New file. * testsuite/thunk.cc : New file. * testsuite/event-defintiions.cc : New file. * testsuite/event-private.h : New file. * testsuite/parts-test.list : New file. * testusite/register_pair_mt.cc : New file. * testsuite/povray-derived.cc : New file. * testsuite/event-main.cc : New file. * testsuite/environment.cc : New file. * testsuite/template-list2.cc : New file. * testsuite/thunk_vtable_map_attack.cc : New file. * testsuite/parts-test-extra-parts.cc : New file. * testsuite/environment-fail-64.s : New file. * testsuite/dlopen.cc : New file. * testsuite/so.cc : New file. * testsuite/temp_deriv3.cc : New file. * testsuite/const_vtable.cc : New file. * testsuite/mempool_positive.c : New file. * testsuite/dup_name.cc : New file. From-SVN: r201555
2013-08-07 05:38:59 +02:00
/* in vtable-class-hierarchy.c */
extern void vtv_compute_class_hierarchy_transitive_closure (void);
extern void vtv_generate_init_routine (void);
extern void vtv_save_class_info (tree);
extern void vtv_recover_class_info (void);
extern void vtv_build_vtable_verify_fndecl (void);
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
/* In cp/cp-array-notations.c */
extern tree expand_array_notation_exprs (tree);
bool cilkplus_an_triplet_types_ok_p (location_t, tree, tree, tree,
tree);
semantics.c (is_instantiation_of_constexpr, [...]): Moved definitions... 2014-10-15 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (is_instantiation_of_constexpr, literal_type_p, ensure_literal_type_for_constexpr_object, constexpr_fundef_hasher::equal, constexpr_fundef_hasher::hash, retrieve_constexpr_fundef, is_valid_constexpr_fn, build_anon_member_initialization, build_data_member_initialization, check_constexpr_bind_expr_vars, check_constexpr_ctor_body_1, check_constexpr_ctor_body, sort_constexpr_mem_initializers, build_constexpr_constructor_member_initializers, constexpr_fn_retval, massage_constexpr_body, cx_check_missing_mem_inits, register_constexpr_fundef, explain_invalid_constexpr_fn, constexpr_call_hasher::hash, constexpr_call_hasher::equal, maybe_initialize_constexpr_call_table, get_function_named_in_call, get_nth_callarg, lookup_parameter_binding, cxx_eval_builtin_function_call, adjust_temp_type, cxx_bind_parameters_in_call, push_cx_call_context, pop_cx_call_context, cx_error_context, cxx_eval_call_expression, reduced_constant_expression_p, verify_constant, cxx_eval_unary_expression, cxx_eval_binary_expression, cxx_eval_conditional_expression, cxx_eval_array_reference, cxx_eval_component_reference, cxx_eval_bit_field_ref, cxx_eval_logical_expression, base_field_constructor_elt, cxx_eval_bare_aggregate, cxx_eval_vec_init_1, cxx_eval_vec_init, cxx_fold_indirect_ref, cxx_eval_indirect_ref, non_const_var_error, cxx_eval_trinary_expression, var_in_constexpr_fn, cxx_eval_constant_expression, cxx_eval_outermost_constant_expr, is_sub_constant_expr, cxx_constant_value, maybe_constant_value, maybe_constant_init, potential_constant_expression_1, potential_constant_expression, potential_rvalue_constant_expression, require_potential_constant_expression, require_potential_rvalue_constant_expression): Moved definitions... * constexpr.c: ... here, new file. * Make-lang.in: Update. * config-lang.in: Likewise. From-SVN: r216263
2014-10-15 16:40:54 +02:00
/* In constexpr.c */
extern void fini_constexpr (void);
semantics.c (is_instantiation_of_constexpr, [...]): Moved definitions... 2014-10-15 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (is_instantiation_of_constexpr, literal_type_p, ensure_literal_type_for_constexpr_object, constexpr_fundef_hasher::equal, constexpr_fundef_hasher::hash, retrieve_constexpr_fundef, is_valid_constexpr_fn, build_anon_member_initialization, build_data_member_initialization, check_constexpr_bind_expr_vars, check_constexpr_ctor_body_1, check_constexpr_ctor_body, sort_constexpr_mem_initializers, build_constexpr_constructor_member_initializers, constexpr_fn_retval, massage_constexpr_body, cx_check_missing_mem_inits, register_constexpr_fundef, explain_invalid_constexpr_fn, constexpr_call_hasher::hash, constexpr_call_hasher::equal, maybe_initialize_constexpr_call_table, get_function_named_in_call, get_nth_callarg, lookup_parameter_binding, cxx_eval_builtin_function_call, adjust_temp_type, cxx_bind_parameters_in_call, push_cx_call_context, pop_cx_call_context, cx_error_context, cxx_eval_call_expression, reduced_constant_expression_p, verify_constant, cxx_eval_unary_expression, cxx_eval_binary_expression, cxx_eval_conditional_expression, cxx_eval_array_reference, cxx_eval_component_reference, cxx_eval_bit_field_ref, cxx_eval_logical_expression, base_field_constructor_elt, cxx_eval_bare_aggregate, cxx_eval_vec_init_1, cxx_eval_vec_init, cxx_fold_indirect_ref, cxx_eval_indirect_ref, non_const_var_error, cxx_eval_trinary_expression, var_in_constexpr_fn, cxx_eval_constant_expression, cxx_eval_outermost_constant_expr, is_sub_constant_expr, cxx_constant_value, maybe_constant_value, maybe_constant_init, potential_constant_expression_1, potential_constant_expression, potential_rvalue_constant_expression, require_potential_constant_expression, require_potential_rvalue_constant_expression): Moved definitions... * constexpr.c: ... here, new file. * Make-lang.in: Update. * config-lang.in: Likewise. From-SVN: r216263
2014-10-15 16:40:54 +02:00
extern bool literal_type_p (tree);
extern tree register_constexpr_fundef (tree, tree);
extern bool is_valid_constexpr_fn (tree, bool);
semantics.c (is_instantiation_of_constexpr, [...]): Moved definitions... 2014-10-15 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (is_instantiation_of_constexpr, literal_type_p, ensure_literal_type_for_constexpr_object, constexpr_fundef_hasher::equal, constexpr_fundef_hasher::hash, retrieve_constexpr_fundef, is_valid_constexpr_fn, build_anon_member_initialization, build_data_member_initialization, check_constexpr_bind_expr_vars, check_constexpr_ctor_body_1, check_constexpr_ctor_body, sort_constexpr_mem_initializers, build_constexpr_constructor_member_initializers, constexpr_fn_retval, massage_constexpr_body, cx_check_missing_mem_inits, register_constexpr_fundef, explain_invalid_constexpr_fn, constexpr_call_hasher::hash, constexpr_call_hasher::equal, maybe_initialize_constexpr_call_table, get_function_named_in_call, get_nth_callarg, lookup_parameter_binding, cxx_eval_builtin_function_call, adjust_temp_type, cxx_bind_parameters_in_call, push_cx_call_context, pop_cx_call_context, cx_error_context, cxx_eval_call_expression, reduced_constant_expression_p, verify_constant, cxx_eval_unary_expression, cxx_eval_binary_expression, cxx_eval_conditional_expression, cxx_eval_array_reference, cxx_eval_component_reference, cxx_eval_bit_field_ref, cxx_eval_logical_expression, base_field_constructor_elt, cxx_eval_bare_aggregate, cxx_eval_vec_init_1, cxx_eval_vec_init, cxx_fold_indirect_ref, cxx_eval_indirect_ref, non_const_var_error, cxx_eval_trinary_expression, var_in_constexpr_fn, cxx_eval_constant_expression, cxx_eval_outermost_constant_expr, is_sub_constant_expr, cxx_constant_value, maybe_constant_value, maybe_constant_init, potential_constant_expression_1, potential_constant_expression, potential_rvalue_constant_expression, require_potential_constant_expression, require_potential_rvalue_constant_expression): Moved definitions... * constexpr.c: ... here, new file. * Make-lang.in: Update. * config-lang.in: Likewise. From-SVN: r216263
2014-10-15 16:40:54 +02:00
extern bool check_constexpr_ctor_body (tree, tree, bool);
extern tree ensure_literal_type_for_constexpr_object (tree);
extern bool potential_constant_expression (tree);
extern bool potential_nondependent_constant_expression (tree);
extern bool potential_nondependent_static_init_expression (tree);
extern bool potential_static_init_expression (tree);
semantics.c (is_instantiation_of_constexpr, [...]): Moved definitions... 2014-10-15 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (is_instantiation_of_constexpr, literal_type_p, ensure_literal_type_for_constexpr_object, constexpr_fundef_hasher::equal, constexpr_fundef_hasher::hash, retrieve_constexpr_fundef, is_valid_constexpr_fn, build_anon_member_initialization, build_data_member_initialization, check_constexpr_bind_expr_vars, check_constexpr_ctor_body_1, check_constexpr_ctor_body, sort_constexpr_mem_initializers, build_constexpr_constructor_member_initializers, constexpr_fn_retval, massage_constexpr_body, cx_check_missing_mem_inits, register_constexpr_fundef, explain_invalid_constexpr_fn, constexpr_call_hasher::hash, constexpr_call_hasher::equal, maybe_initialize_constexpr_call_table, get_function_named_in_call, get_nth_callarg, lookup_parameter_binding, cxx_eval_builtin_function_call, adjust_temp_type, cxx_bind_parameters_in_call, push_cx_call_context, pop_cx_call_context, cx_error_context, cxx_eval_call_expression, reduced_constant_expression_p, verify_constant, cxx_eval_unary_expression, cxx_eval_binary_expression, cxx_eval_conditional_expression, cxx_eval_array_reference, cxx_eval_component_reference, cxx_eval_bit_field_ref, cxx_eval_logical_expression, base_field_constructor_elt, cxx_eval_bare_aggregate, cxx_eval_vec_init_1, cxx_eval_vec_init, cxx_fold_indirect_ref, cxx_eval_indirect_ref, non_const_var_error, cxx_eval_trinary_expression, var_in_constexpr_fn, cxx_eval_constant_expression, cxx_eval_outermost_constant_expr, is_sub_constant_expr, cxx_constant_value, maybe_constant_value, maybe_constant_init, potential_constant_expression_1, potential_constant_expression, potential_rvalue_constant_expression, require_potential_constant_expression, require_potential_rvalue_constant_expression): Moved definitions... * constexpr.c: ... here, new file. * Make-lang.in: Update. * config-lang.in: Likewise. From-SVN: r216263
2014-10-15 16:40:54 +02:00
extern bool potential_rvalue_constant_expression (tree);
extern bool require_potential_constant_expression (tree);
extern bool require_potential_rvalue_constant_expression (tree);
extern tree cxx_constant_value (tree, tree = NULL_TREE);
extern tree maybe_constant_value (tree, tree = NULL_TREE);
extern tree maybe_constant_init (tree, tree = NULL_TREE);
semantics.c (end_maybe_infinite_loop): Use fold_non_dependent_expr. 2014-11-14 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (end_maybe_infinite_loop): Use fold_non_dependent_expr. * parser.c (cp_parser_omp_clause_collapse): Likewise. (cp_parser_enumerator_definition): Don't call instantiate_non_dependent_expr... * decl.c (build_enumerator): ... call fold_non_dependent_expr here. * typeck2.c (massage_init_elt): Use fold_non_dependent_expr. * constexpr.c (maybe_constant_value): Allow VIEW_CONVERT_EXPR in the final gcc_assert. * constexpr.c (fold_non_dependent_expr): Add. * cp-tree.h (fold_non_dependent_expr): Declare it. * call.c (null_ptr_cst_p): Use it. * pt.c (tsubst_copy_and_build, build_non_dependent_expr): Likewise. * semantics.c (begin_maybe_infinite_loop): Likewise. * typeck.c (cp_build_binary_op): Likewise. * typeck2.c (check_narrowing): Likewise. * pt.c (fold_non_dependent_expr): Rename to instantiate_non_dependent_expr. (fold_non_dependent_expr_sfinae): Rename to instantiate_non_dependent_expr_sfinae. (convert_nontype_argument, build_non_dependent_expr): Adjust. * decl.c (compute_array_index_type): Likewise. * parser.c (cp_parser_parenthesized_expression_list, cp_parser_enumerator_definition, cp_parser_omp_clause_collapse): Likewise. * semantics.c (end_maybe_infinite_loop, finish_static_assert): Likewise. * typeck.c (cxx_alignas_expr): Likewise. * typeck2.c (store_init_value, massage_init_elt): Likewise. * call.c: Adjust comments. * class.c: Likewise. * constexpr.c: Likewise. * decl2.c: Likewise. * tree.c: Likewise. From-SVN: r217577
2014-11-14 17:59:52 +01:00
extern tree fold_non_dependent_expr (tree);
Merge C++ delayed folding branch. * call.c (build_conditional_expr_1, convert_like_real) (convert_arg_to_ellipsis, convert_for_arg_passing): Don't fold. (build_new_op_1, build_over_call, build_cxx_call): Fold for warnings. * class.c (build_base_path, determine_primary_bases) (update_vtable_entry_for_fn, check_bitfield_decl) (layout_nonempty_base_or_field, layout_empty_base) (propagate_binfo_offsets, include_empty_classes) (layout_class_type, build_vbase_offset_vtbl_entries): Use fold_convert. * constexpr.c (cxx_eval_builtin_function_call): Fold away the NOP_EXPR. (cxx_eval_call_expression): Handle MEM_REF. (cxx_eval_pointer_plus_expression): Fold the second operand. (cxx_eval_constant_expression): Handle MEM_REF, UNARY_PLUS_EXPR. (fold_simple_1, fold_simple): New. (maybe_constant_value_1): Factor out from maybe_constant_value. (cv_cache, maybe_constant_value): Cache results. (maybe_constant_init): Handle null input. (potential_constant_expression_1): Handle RESULT_DECL, EMPTY_CLASS_EXPR. * cp-array-notation.c (build_array_notation_ref): Fold operands. * cp-gimplify.c (cp_fold_r, cp_fold): New. (cp_genericize_r): Use fold_convert. Don't fold SIZEOF_EXPR. (cp_genericize): Fold everything. (contains_label_1, contains_label_p): New. (cp_fold, cp_fully_fold): New. * cp-tree.h (class cache_map): New. * cvt.c (cp_convert_to_pointer, ocp_convert): Use convert_to_*_nofold. (cp_convert_and_check): Use cp_fully_fold. (convert, convert_force): Don't fold. * decl.c (fold_sizeof_expr): Change from fold_sizeof_expr_r. (compute_array_index_type): Use cp_fully_fold. (build_enumerator): Use fold_convert. * decl2.c (get_guard_cond, set_guard): Use fold_convert. * init.c (build_zero_init_1): Fold zero-initializers. (build_new_1): Fold nelts calculations. (build_vec_delete_1): Fold conversions. (build_vec_init): Fold maxindex. * parser.c (cp_parser_binary_expression): Fold LHS of || and &&. (cp_parser_question_colon_clause): Fold LHS. * pt.c (convert_nontype_argument): Fold nullptr conversion. * semantics.c (finish_unary_op_expr): Fold for warnings. (handle_omp_array_sections_1): Fold length and low bound. (handle_omp_for_class_iterator): Fold various things. * tree.c (builtin_valid_in_constant_expr_p): Add BUILT_IN_ATOMIC_ALWAYS_LOCK_FREE. (convert_bitfield_to_declared_type): Don't fold. (handle_init_priority_attribute): Fold. (fold_if_not_in_template): Remove. * typeck.c (decay_conversion, build_class_member_access_expr) (build_simple_component_ref, cp_build_array_ref, build_vec_cmp) (cp_pointer_int_sum, pointer_diff): Don't fold. (cp_build_binary_op): Fold for warnings and PMF ops. (cp_build_unary_op): Fold negation of a constant, nothing else. (expand_ptrmemfunc_cst): Fold operations. * typeck2.c (split_nonconstant_init): Fold initializer. (store_init_value): Likewise. (check_narrowing): Try folding. * config-lang.in (gtfiles): Add cp-gimplify.c. From-SVN: r230365
2015-11-14 01:08:05 +01:00
extern tree fold_simple (tree);
semantics.c (is_instantiation_of_constexpr, [...]): Moved definitions... 2014-10-15 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (is_instantiation_of_constexpr, literal_type_p, ensure_literal_type_for_constexpr_object, constexpr_fundef_hasher::equal, constexpr_fundef_hasher::hash, retrieve_constexpr_fundef, is_valid_constexpr_fn, build_anon_member_initialization, build_data_member_initialization, check_constexpr_bind_expr_vars, check_constexpr_ctor_body_1, check_constexpr_ctor_body, sort_constexpr_mem_initializers, build_constexpr_constructor_member_initializers, constexpr_fn_retval, massage_constexpr_body, cx_check_missing_mem_inits, register_constexpr_fundef, explain_invalid_constexpr_fn, constexpr_call_hasher::hash, constexpr_call_hasher::equal, maybe_initialize_constexpr_call_table, get_function_named_in_call, get_nth_callarg, lookup_parameter_binding, cxx_eval_builtin_function_call, adjust_temp_type, cxx_bind_parameters_in_call, push_cx_call_context, pop_cx_call_context, cx_error_context, cxx_eval_call_expression, reduced_constant_expression_p, verify_constant, cxx_eval_unary_expression, cxx_eval_binary_expression, cxx_eval_conditional_expression, cxx_eval_array_reference, cxx_eval_component_reference, cxx_eval_bit_field_ref, cxx_eval_logical_expression, base_field_constructor_elt, cxx_eval_bare_aggregate, cxx_eval_vec_init_1, cxx_eval_vec_init, cxx_fold_indirect_ref, cxx_eval_indirect_ref, non_const_var_error, cxx_eval_trinary_expression, var_in_constexpr_fn, cxx_eval_constant_expression, cxx_eval_outermost_constant_expr, is_sub_constant_expr, cxx_constant_value, maybe_constant_value, maybe_constant_init, potential_constant_expression_1, potential_constant_expression, potential_rvalue_constant_expression, require_potential_constant_expression, require_potential_rvalue_constant_expression): Moved definitions... * constexpr.c: ... here, new file. * Make-lang.in: Update. * config-lang.in: Likewise. From-SVN: r216263
2014-10-15 16:40:54 +02:00
extern bool is_sub_constant_expr (tree);
extern bool reduced_constant_expression_p (tree);
extern bool is_instantiation_of_constexpr (tree);
extern bool var_in_constexpr_fn (tree);
extern bool var_in_maybe_constexpr_fn (tree);
semantics.c (is_instantiation_of_constexpr, [...]): Moved definitions... 2014-10-15 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (is_instantiation_of_constexpr, literal_type_p, ensure_literal_type_for_constexpr_object, constexpr_fundef_hasher::equal, constexpr_fundef_hasher::hash, retrieve_constexpr_fundef, is_valid_constexpr_fn, build_anon_member_initialization, build_data_member_initialization, check_constexpr_bind_expr_vars, check_constexpr_ctor_body_1, check_constexpr_ctor_body, sort_constexpr_mem_initializers, build_constexpr_constructor_member_initializers, constexpr_fn_retval, massage_constexpr_body, cx_check_missing_mem_inits, register_constexpr_fundef, explain_invalid_constexpr_fn, constexpr_call_hasher::hash, constexpr_call_hasher::equal, maybe_initialize_constexpr_call_table, get_function_named_in_call, get_nth_callarg, lookup_parameter_binding, cxx_eval_builtin_function_call, adjust_temp_type, cxx_bind_parameters_in_call, push_cx_call_context, pop_cx_call_context, cx_error_context, cxx_eval_call_expression, reduced_constant_expression_p, verify_constant, cxx_eval_unary_expression, cxx_eval_binary_expression, cxx_eval_conditional_expression, cxx_eval_array_reference, cxx_eval_component_reference, cxx_eval_bit_field_ref, cxx_eval_logical_expression, base_field_constructor_elt, cxx_eval_bare_aggregate, cxx_eval_vec_init_1, cxx_eval_vec_init, cxx_fold_indirect_ref, cxx_eval_indirect_ref, non_const_var_error, cxx_eval_trinary_expression, var_in_constexpr_fn, cxx_eval_constant_expression, cxx_eval_outermost_constant_expr, is_sub_constant_expr, cxx_constant_value, maybe_constant_value, maybe_constant_init, potential_constant_expression_1, potential_constant_expression, potential_rvalue_constant_expression, require_potential_constant_expression, require_potential_rvalue_constant_expression): Moved definitions... * constexpr.c: ... here, new file. * Make-lang.in: Update. * config-lang.in: Likewise. From-SVN: r216263
2014-10-15 16:40:54 +02:00
extern void explain_invalid_constexpr_fn (tree);
extern vec<tree> cx_error_context (void);
Merge C++ delayed folding branch. * call.c (build_conditional_expr_1, convert_like_real) (convert_arg_to_ellipsis, convert_for_arg_passing): Don't fold. (build_new_op_1, build_over_call, build_cxx_call): Fold for warnings. * class.c (build_base_path, determine_primary_bases) (update_vtable_entry_for_fn, check_bitfield_decl) (layout_nonempty_base_or_field, layout_empty_base) (propagate_binfo_offsets, include_empty_classes) (layout_class_type, build_vbase_offset_vtbl_entries): Use fold_convert. * constexpr.c (cxx_eval_builtin_function_call): Fold away the NOP_EXPR. (cxx_eval_call_expression): Handle MEM_REF. (cxx_eval_pointer_plus_expression): Fold the second operand. (cxx_eval_constant_expression): Handle MEM_REF, UNARY_PLUS_EXPR. (fold_simple_1, fold_simple): New. (maybe_constant_value_1): Factor out from maybe_constant_value. (cv_cache, maybe_constant_value): Cache results. (maybe_constant_init): Handle null input. (potential_constant_expression_1): Handle RESULT_DECL, EMPTY_CLASS_EXPR. * cp-array-notation.c (build_array_notation_ref): Fold operands. * cp-gimplify.c (cp_fold_r, cp_fold): New. (cp_genericize_r): Use fold_convert. Don't fold SIZEOF_EXPR. (cp_genericize): Fold everything. (contains_label_1, contains_label_p): New. (cp_fold, cp_fully_fold): New. * cp-tree.h (class cache_map): New. * cvt.c (cp_convert_to_pointer, ocp_convert): Use convert_to_*_nofold. (cp_convert_and_check): Use cp_fully_fold. (convert, convert_force): Don't fold. * decl.c (fold_sizeof_expr): Change from fold_sizeof_expr_r. (compute_array_index_type): Use cp_fully_fold. (build_enumerator): Use fold_convert. * decl2.c (get_guard_cond, set_guard): Use fold_convert. * init.c (build_zero_init_1): Fold zero-initializers. (build_new_1): Fold nelts calculations. (build_vec_delete_1): Fold conversions. (build_vec_init): Fold maxindex. * parser.c (cp_parser_binary_expression): Fold LHS of || and &&. (cp_parser_question_colon_clause): Fold LHS. * pt.c (convert_nontype_argument): Fold nullptr conversion. * semantics.c (finish_unary_op_expr): Fold for warnings. (handle_omp_array_sections_1): Fold length and low bound. (handle_omp_for_class_iterator): Fold various things. * tree.c (builtin_valid_in_constant_expr_p): Add BUILT_IN_ATOMIC_ALWAYS_LOCK_FREE. (convert_bitfield_to_declared_type): Don't fold. (handle_init_priority_attribute): Fold. (fold_if_not_in_template): Remove. * typeck.c (decay_conversion, build_class_member_access_expr) (build_simple_component_ref, cp_build_array_ref, build_vec_cmp) (cp_pointer_int_sum, pointer_diff): Don't fold. (cp_build_binary_op): Fold for warnings and PMF ops. (cp_build_unary_op): Fold negation of a constant, nothing else. (expand_ptrmemfunc_cst): Fold operations. * typeck2.c (split_nonconstant_init): Fold initializer. (store_init_value): Likewise. (check_narrowing): Try folding. * config-lang.in (gtfiles): Add cp-gimplify.c. From-SVN: r230365
2015-11-14 01:08:05 +01:00
extern tree fold_sizeof_expr (tree);
extern void clear_cv_and_fold_caches (void);
semantics.c (is_instantiation_of_constexpr, [...]): Moved definitions... 2014-10-15 Paolo Carlini <paolo.carlini@oracle.com> * semantics.c (is_instantiation_of_constexpr, literal_type_p, ensure_literal_type_for_constexpr_object, constexpr_fundef_hasher::equal, constexpr_fundef_hasher::hash, retrieve_constexpr_fundef, is_valid_constexpr_fn, build_anon_member_initialization, build_data_member_initialization, check_constexpr_bind_expr_vars, check_constexpr_ctor_body_1, check_constexpr_ctor_body, sort_constexpr_mem_initializers, build_constexpr_constructor_member_initializers, constexpr_fn_retval, massage_constexpr_body, cx_check_missing_mem_inits, register_constexpr_fundef, explain_invalid_constexpr_fn, constexpr_call_hasher::hash, constexpr_call_hasher::equal, maybe_initialize_constexpr_call_table, get_function_named_in_call, get_nth_callarg, lookup_parameter_binding, cxx_eval_builtin_function_call, adjust_temp_type, cxx_bind_parameters_in_call, push_cx_call_context, pop_cx_call_context, cx_error_context, cxx_eval_call_expression, reduced_constant_expression_p, verify_constant, cxx_eval_unary_expression, cxx_eval_binary_expression, cxx_eval_conditional_expression, cxx_eval_array_reference, cxx_eval_component_reference, cxx_eval_bit_field_ref, cxx_eval_logical_expression, base_field_constructor_elt, cxx_eval_bare_aggregate, cxx_eval_vec_init_1, cxx_eval_vec_init, cxx_fold_indirect_ref, cxx_eval_indirect_ref, non_const_var_error, cxx_eval_trinary_expression, var_in_constexpr_fn, cxx_eval_constant_expression, cxx_eval_outermost_constant_expr, is_sub_constant_expr, cxx_constant_value, maybe_constant_value, maybe_constant_init, potential_constant_expression_1, potential_constant_expression, potential_rvalue_constant_expression, require_potential_constant_expression, require_potential_rvalue_constant_expression): Moved definitions... * constexpr.c: ... here, new file. * Make-lang.in: Update. * config-lang.in: Likewise. From-SVN: r216263
2014-10-15 16:40:54 +02:00
Added Compiler Support for _Cilk_spawn and _Cilk_sync for C++. gcc/c-family/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * cilk.c (cilk_outline): Made this function non-static. (gimplify_cilk_spawn): Removed pre_p and post_p arguments. (create_cilk_wrapper): Added a new parameter: a function pointer. (c_install_body_w_frame_cleanup): Remove (extract_free_variables): Added VEC_INIT_EXPR and CONSTRUCTOR case. * c-common.h (cilk_outline): New prototype. (gimplify_cilk_spawn): Removed two parameters. (cilk_install_body_with_frame_cleanup): New prototype. * c-gimplify.c (c_gimplify_expr): Added MODIFY_EXPR, CALL_EXPR and CILK_SPAWN_STMT case. gcc/c/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-objc-common.h (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Remove. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. (LANG_HOOKS_CILKPLUS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. * c-typeck.c (cilk_install_body_with_frame_cleanup): New function. gcc/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * langhooks.h (lang_hooks_for_decls): Remove lang_hooks_for_cilkplus. (lang_hooks_for_cilkplus): Remove. * langhooks.c (lhd_cilk_detect_spawn): Likewise. (lhd_install_body_with_frame_cleanup): Likewise. * langhooks-def.h (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. (LANG_HOOKS_CILKPLUS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. (LANG_HOOKS_DECLS): Remove LANG_HOOKS_CILKPLUS. * gimplify.c (gimplify_expr): Removed CILK_SPAWN_STMT case. (gimplify_modify_expr): Removed handling of _Cilk_spawn in expr. (gimplify_call_expr): Likewise. gcc/cp/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * cp-tree.h (cilk_valid_spawn): New prototype. (gimplify_cilk_spawn): Likewise. (create_try_catch_expr): Likewise. * decl.c (finish_function): Insert Cilk function-calls when a _Cilk_spawn is used in a function. * parser.c (cp_parser_postfix_expression): Added RID_CILK_SPAWN and RID_CILK_SYNC cases. * cp-cilkplus.c (set_cilk_except_flag): New function. (set_cilk_except_data): Likewise. (cilk_install_body_with_frame_cleanup): Likewise. * except.c (create_try_catch_expr): Likewise. * parser.h (IN_CILK_SPAWN): New #define. * pt.c (tsubst_expr): Added CILK_SPAWN_STMT and CILK_SYNC_STMT cases. * semantics.c (potential_constant_expression_1): Likewise. * typeck.c (cp_build_compound_expr): Reject a spawned function in a compound expression. (check_return_expr): Reject a spawned function in a return expression. * cp-gimplify.c (cp_gimplify_expr): Added a CILK_SPAWN_STMT and CALL_EXPR case. Added handling of spawned function in MODIFY_EXPR and INIT_EXPR. gcc/testsuite/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * g++.dg/cilk-plus/CK/catch_exc.cc: New test case. * g++.dg/cilk-plus/CK/const_spawn.cc: Likewise. * g++.dg/cilk-plus/CK/fib-opr-overload.cc: Likewise. * g++.dg/cilk-plus/CK/fib-tplt.cc: Likewise. * g++.dg/cilk-plus/CK/lambda_spawns.cc: Likewise. * g++.dg/cilk-plus/CK/lambda_spawns_tplt.cc: Likewise. * g++.dg/cilk-plus/cilk-plus.exp: Added support to run Cilk Keywords test stored in c-c++-common. Also, added the Cilk runtime's library to the ld_library_path. From-SVN: r205902
2013-12-11 19:23:27 +01:00
/* In c-family/cilk.c */
extern bool cilk_valid_spawn (tree);
flag-types.h (enum sanitize_code): Add SANITIZE_VPTR, include SANITIZE_VPTR in SANITIZE_UNDEFINED. * flag-types.h (enum sanitize_code): Add SANITIZE_VPTR, include SANITIZE_VPTR in SANITIZE_UNDEFINED. * opts.c (common_handle_option): Add -fsanitize=vptr. * sanitizer.def (BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS, BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS_ABORT): New. * ubsan.h (enum ubsan_null_ckind): Add UBSAN_DOWNCAST_POINTER, UBSAN_DOWNCAST_REFERENCE, UBSAN_UPCAST and UBSAN_CAST_TO_VBASE. (ubsan_expand_vptr_ifn): New prototype. * internal-fn.c (expand_ANNOTATE, expand_GOMP_SIMD_LANE, expand_GOMP_SIMD_VF, expand_GOMP_SIMD_LAST_LANE, expand_UBSAN_NULL, expand_UBSAN_BOUNDS, expand_UBSAN_OBJECT_SIZE, expand_ASAN_CHECK, expand_LOOP_VECTORIZED): Make argument nameless, remove ATTRIBUTE_UNUSED. (expand_UBSAN_VPTR): New function. * internal-fn.def (UBSAN_NULL, ASAN_CHECK): Use R instead of W in fn spec. (UBSAN_VPTR): New internal function. * sanopt.c (tree_map_traits): Renamed to ... (sanopt_tree_map_traits): ... this. (sanopt_tree_triplet, sanopt_tree_triplet_map_traits): New classes. (sanopt_ctx): Adjust asan_check_map type for tree_map_traits to sanopt_tree_map_traits renaming. Add vptr_check_map field. (maybe_optimize_ubsan_vptr_ifn): New function. (sanopt_optimize_walker): Handle IFN_UBSAN_VPTR. (pass_sanopt::execute): Likewise. Call sanopt_optimize even for -fsanitize=vptr. * tree-ssa-alias.c (call_may_clobber_ref_p_1): Handle certain internal calls like pure functions for aliasing, even when they have other side-effects that prevent making them ECF_PURE. * ubsan.c (ubsan_vptr_type_cache_decl): New variable. (ubsan_expand_vptr_ifn): New function. cp/ * cp-gimplify.c (cp_genericize_r): Call cp_ubsan_maybe_instrument_member_call for member calls. (cp_ubsan_check_member_access_r): New function. (cp_genericize_tree): Call cp_ubsan_instrument_member_accesses. * cp-tree.h (cp_ubsan_maybe_instrument_member_call, cp_ubsan_instrument_member_accesses, cp_ubsan_maybe_instrument_downcast, cp_ubsan_maybe_instrument_cast_to_vbase): New prototypes. * cp-ubsan.c: New file. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add cp/cp-ubsan.o. * constexpr.c (cxx_eval_call_expression): Return void_node for IFN_UBSAN_VPTR. (potential_constant_expression_1): Return true for UBSAN_NULL, UBSAN_BOUNDS and UBSAN_VPTR internal calls. * typeck.c (build_class_member_access_expr): Provide locus for COMPONENT_REFs. (build_static_cast_1): Instrument downcasts. * class.c (build_base_path): For -fsanitize=vptr and !fixed_type_p add ubsan instrumentation for virtual_access. * call.c: Include internal-fn.h. (set_flags_from_callee): Handle internal calls. gcc/testsuite/ * g++.dg/ubsan/vptr-1.C: New test. * g++.dg/ubsan/vptr-2.C: New test. * g++.dg/ubsan/vptr-3.C: New test. * g++.dg/ubsan/vptr-4.C: New test. * g++.dg/ubsan/vptr-5.C: New test. * g++.dg/ubsan/vptr-6.C: New test. * g++.dg/ubsan/vptr-7.C: New test. * g++.dg/ubsan/vptr-8.C: New test. * g++.dg/ubsan/vptr-9.C: New test. From-SVN: r219695
2015-01-15 23:58:42 +01:00
/* In cp-ubsan.c */
extern void cp_ubsan_maybe_instrument_member_call (tree);
extern void cp_ubsan_instrument_member_accesses (tree *);
extern tree cp_ubsan_maybe_instrument_downcast (location_t, tree, tree, tree);
flag-types.h (enum sanitize_code): Add SANITIZE_VPTR, include SANITIZE_VPTR in SANITIZE_UNDEFINED. * flag-types.h (enum sanitize_code): Add SANITIZE_VPTR, include SANITIZE_VPTR in SANITIZE_UNDEFINED. * opts.c (common_handle_option): Add -fsanitize=vptr. * sanitizer.def (BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS, BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS_ABORT): New. * ubsan.h (enum ubsan_null_ckind): Add UBSAN_DOWNCAST_POINTER, UBSAN_DOWNCAST_REFERENCE, UBSAN_UPCAST and UBSAN_CAST_TO_VBASE. (ubsan_expand_vptr_ifn): New prototype. * internal-fn.c (expand_ANNOTATE, expand_GOMP_SIMD_LANE, expand_GOMP_SIMD_VF, expand_GOMP_SIMD_LAST_LANE, expand_UBSAN_NULL, expand_UBSAN_BOUNDS, expand_UBSAN_OBJECT_SIZE, expand_ASAN_CHECK, expand_LOOP_VECTORIZED): Make argument nameless, remove ATTRIBUTE_UNUSED. (expand_UBSAN_VPTR): New function. * internal-fn.def (UBSAN_NULL, ASAN_CHECK): Use R instead of W in fn spec. (UBSAN_VPTR): New internal function. * sanopt.c (tree_map_traits): Renamed to ... (sanopt_tree_map_traits): ... this. (sanopt_tree_triplet, sanopt_tree_triplet_map_traits): New classes. (sanopt_ctx): Adjust asan_check_map type for tree_map_traits to sanopt_tree_map_traits renaming. Add vptr_check_map field. (maybe_optimize_ubsan_vptr_ifn): New function. (sanopt_optimize_walker): Handle IFN_UBSAN_VPTR. (pass_sanopt::execute): Likewise. Call sanopt_optimize even for -fsanitize=vptr. * tree-ssa-alias.c (call_may_clobber_ref_p_1): Handle certain internal calls like pure functions for aliasing, even when they have other side-effects that prevent making them ECF_PURE. * ubsan.c (ubsan_vptr_type_cache_decl): New variable. (ubsan_expand_vptr_ifn): New function. cp/ * cp-gimplify.c (cp_genericize_r): Call cp_ubsan_maybe_instrument_member_call for member calls. (cp_ubsan_check_member_access_r): New function. (cp_genericize_tree): Call cp_ubsan_instrument_member_accesses. * cp-tree.h (cp_ubsan_maybe_instrument_member_call, cp_ubsan_instrument_member_accesses, cp_ubsan_maybe_instrument_downcast, cp_ubsan_maybe_instrument_cast_to_vbase): New prototypes. * cp-ubsan.c: New file. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add cp/cp-ubsan.o. * constexpr.c (cxx_eval_call_expression): Return void_node for IFN_UBSAN_VPTR. (potential_constant_expression_1): Return true for UBSAN_NULL, UBSAN_BOUNDS and UBSAN_VPTR internal calls. * typeck.c (build_class_member_access_expr): Provide locus for COMPONENT_REFs. (build_static_cast_1): Instrument downcasts. * class.c (build_base_path): For -fsanitize=vptr and !fixed_type_p add ubsan instrumentation for virtual_access. * call.c: Include internal-fn.h. (set_flags_from_callee): Handle internal calls. gcc/testsuite/ * g++.dg/ubsan/vptr-1.C: New test. * g++.dg/ubsan/vptr-2.C: New test. * g++.dg/ubsan/vptr-3.C: New test. * g++.dg/ubsan/vptr-4.C: New test. * g++.dg/ubsan/vptr-5.C: New test. * g++.dg/ubsan/vptr-6.C: New test. * g++.dg/ubsan/vptr-7.C: New test. * g++.dg/ubsan/vptr-8.C: New test. * g++.dg/ubsan/vptr-9.C: New test. From-SVN: r219695
2015-01-15 23:58:42 +01:00
extern tree cp_ubsan_maybe_instrument_cast_to_vbase (location_t, tree, tree);
extern void cp_ubsan_maybe_initialize_vtbl_ptrs (tree);
flag-types.h (enum sanitize_code): Add SANITIZE_VPTR, include SANITIZE_VPTR in SANITIZE_UNDEFINED. * flag-types.h (enum sanitize_code): Add SANITIZE_VPTR, include SANITIZE_VPTR in SANITIZE_UNDEFINED. * opts.c (common_handle_option): Add -fsanitize=vptr. * sanitizer.def (BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS, BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS_ABORT): New. * ubsan.h (enum ubsan_null_ckind): Add UBSAN_DOWNCAST_POINTER, UBSAN_DOWNCAST_REFERENCE, UBSAN_UPCAST and UBSAN_CAST_TO_VBASE. (ubsan_expand_vptr_ifn): New prototype. * internal-fn.c (expand_ANNOTATE, expand_GOMP_SIMD_LANE, expand_GOMP_SIMD_VF, expand_GOMP_SIMD_LAST_LANE, expand_UBSAN_NULL, expand_UBSAN_BOUNDS, expand_UBSAN_OBJECT_SIZE, expand_ASAN_CHECK, expand_LOOP_VECTORIZED): Make argument nameless, remove ATTRIBUTE_UNUSED. (expand_UBSAN_VPTR): New function. * internal-fn.def (UBSAN_NULL, ASAN_CHECK): Use R instead of W in fn spec. (UBSAN_VPTR): New internal function. * sanopt.c (tree_map_traits): Renamed to ... (sanopt_tree_map_traits): ... this. (sanopt_tree_triplet, sanopt_tree_triplet_map_traits): New classes. (sanopt_ctx): Adjust asan_check_map type for tree_map_traits to sanopt_tree_map_traits renaming. Add vptr_check_map field. (maybe_optimize_ubsan_vptr_ifn): New function. (sanopt_optimize_walker): Handle IFN_UBSAN_VPTR. (pass_sanopt::execute): Likewise. Call sanopt_optimize even for -fsanitize=vptr. * tree-ssa-alias.c (call_may_clobber_ref_p_1): Handle certain internal calls like pure functions for aliasing, even when they have other side-effects that prevent making them ECF_PURE. * ubsan.c (ubsan_vptr_type_cache_decl): New variable. (ubsan_expand_vptr_ifn): New function. cp/ * cp-gimplify.c (cp_genericize_r): Call cp_ubsan_maybe_instrument_member_call for member calls. (cp_ubsan_check_member_access_r): New function. (cp_genericize_tree): Call cp_ubsan_instrument_member_accesses. * cp-tree.h (cp_ubsan_maybe_instrument_member_call, cp_ubsan_instrument_member_accesses, cp_ubsan_maybe_instrument_downcast, cp_ubsan_maybe_instrument_cast_to_vbase): New prototypes. * cp-ubsan.c: New file. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add cp/cp-ubsan.o. * constexpr.c (cxx_eval_call_expression): Return void_node for IFN_UBSAN_VPTR. (potential_constant_expression_1): Return true for UBSAN_NULL, UBSAN_BOUNDS and UBSAN_VPTR internal calls. * typeck.c (build_class_member_access_expr): Provide locus for COMPONENT_REFs. (build_static_cast_1): Instrument downcasts. * class.c (build_base_path): For -fsanitize=vptr and !fixed_type_p add ubsan instrumentation for virtual_access. * call.c: Include internal-fn.h. (set_flags_from_callee): Handle internal calls. gcc/testsuite/ * g++.dg/ubsan/vptr-1.C: New test. * g++.dg/ubsan/vptr-2.C: New test. * g++.dg/ubsan/vptr-3.C: New test. * g++.dg/ubsan/vptr-4.C: New test. * g++.dg/ubsan/vptr-5.C: New test. * g++.dg/ubsan/vptr-6.C: New test. * g++.dg/ubsan/vptr-7.C: New test. * g++.dg/ubsan/vptr-8.C: New test. * g++.dg/ubsan/vptr-9.C: New test. From-SVN: r219695
2015-01-15 23:58:42 +01:00
1994-02-24 02:02:37 +01:00
/* -- end of C++ */
#endif /* ! GCC_CP_TREE_H */